Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodor Truffer committed Feb 3, 2021
2 parents 77dd71f + 94f8065 commit 292b6e6
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 61 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [2.2.3]
- Change: changed Office-Online permission to general 'Edit in online editor' (shared with other cloud plugins) - **might require an ILIAS language reload**

## [2.2.2]
- Fix: 'invalid_token' bug (access tokens too long)

Expand Down
3 changes: 1 addition & 2 deletions classes/class.ilOneDriveActionListGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ private function checkOpenInOfficePerm()
global $DIC;
$user = $DIC->user();
$user_id = $user->getId();
$perm = ilOneDrivePlugin::getInstance()->getPrefix() . '_asl_open_msoffice';
$ref_id = $_GET["ref_id"];

return $DIC->access()->checkAccessOfUser($user_id, $perm, "", $ref_id);
return $DIC->access()->checkAccessOfUser($user_id, 'edit_in_online_editor', "", $ref_id);
}


Expand Down
5 changes: 2 additions & 3 deletions classes/class.ilOneDriveHeaderActionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ protected function checkOpenInOfficePerm()
global $DIC;
$user = $DIC->user();
$user_id = $user->getId();
$perm = ilOneDrivePlugin::getInstance()->getPrefix() . '_asl_open_msoffice';
$ref_id = $_GET["ref_id"];

return $DIC->access()->checkAccessOfUser($user_id, $perm, "", $ref_id);
return $DIC->access()->checkAccessOfUser($user_id, 'edit_in_online_editor', "", $ref_id);
}


Expand All @@ -60,4 +59,4 @@ public function getCustomListActions()

return $customActionList;
}
}
}
46 changes: 1 addition & 45 deletions classes/class.ilOneDrivePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,6 @@ public function getPluginName() {
return self::PLUGIN_NAME;
}


public function updateLanguages($a_lang_keys = null)
{
global $DIC;
parent::updateLanguages($a_lang_keys);
$lang_entries_de = [];
$lang_entries_en = [];
$lang_entries_de['cld_cldh_exod_asl_open_msoffice'] = 'In Office Online öffnen';
$lang_entries_en['cld_cldh_exod_asl_open_msoffice'] = 'Open in Office Online';
$lang_entries_de['cld_cld_cldh_exod_asl_open_msoffice'] = 'Benutzer können Dokumente in Office Online bearbeiten';
$lang_entries_en['cld_cld_cldh_exod_asl_open_msoffice'] = 'Users can edit documents in Office Online';

foreach ($lang_entries_de as $identifier => $value) {
ilObjLanguage::replaceLangEntry('rbac', $identifier, 'de', $value);
}

foreach ($lang_entries_en as $identifier => $value) {
ilObjLanguage::replaceLangEntry('rbac', $identifier, 'en', $value);
}

$q = "SELECT * FROM lng_modules WHERE " .
" lang_key = 'de'" .
" AND module = 'rbac'";
$set = $DIC->database()->query($q);
$row = $DIC->database()->fetchAssoc($set);
$arr2 = unserialize($row["lang_array"]);
if (is_array($arr2)) {
$lang_entries_de = array_merge($arr2, $lang_entries_de);
}
ilObjLanguage::replaceLangModule('de', 'rbac', $lang_entries_de);

$q = "SELECT * FROM lng_modules WHERE " .
" lang_key = 'en'" .
" AND module = 'rbac'";
$set = $DIC->database()->query($q);
$row = $DIC->database()->fetchAssoc($set);
$arr2 = unserialize($row["lang_array"]);
if (is_array($arr2)) {
$lang_entries_en = array_merge($arr2, $lang_entries_en);
}
ilObjLanguage::replaceLangModule('en', 'rbac', $lang_entries_en);
}


/**
* @param exodBearerToken $exodBearerToken
*
Expand Down Expand Up @@ -142,4 +98,4 @@ public function getCsvPath() {
public function getAjaxLink() {
return null;
}
}
}
4 changes: 1 addition & 3 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ add_new_default_base_folder#:#Hauptordner
add_new_default_base_folder_info#:#Auf Ihrem OneDrive wird innerhalb des Ordners ILIASCloud ein Unterordner erstellt. Der Titel oben ist identisch mit dem Namen des Unterordners. Wenn der Ordner bereits existiert, wird dessen Inhalt in ILIAS angezeigt.
app_secret#:#App-Secret
asl_open_msoffice#:#In Office Online öffnen
cld_cld_cldh_exod_asl_open_msoffice#:#In Office Online öffnen
cld_cldh_exod_asl_open_msoffice#:#In Office Online öffnen
asl_rename#:#Umbenennen
client_id#:#Client-ID
client_secret#:#Client-Secret
Expand Down Expand Up @@ -50,4 +48,4 @@ info_message_info#:#Die hier angegebene Meldung wird beim Erstellen von OneDrive
msg_name_already_exists#:#Eine Datei mit diesem Namen existiert bereits.
msg_illegal_characters#:#Der angegebene Name darf keine unzulässigen Zeichen enthalten.
msg_leading_or_trailing_spaces#:#Der angegebene Name darf keine führenden oder nachgestellten Leerzeichen enthalten.
msg_rename_failed#:#Umbenennen fehlgeschlagen
msg_rename_failed#:#Umbenennen fehlgeschlagen
4 changes: 1 addition & 3 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ add_new_default_base_folder#:#Main folder
add_new_default_base_folder_info#:#A subfolder will be added inside ILIASCloud on your OneDrive. The name of the folder will be the title above. If the folder already exists, the content will be shown here.
app_secret#:#App-Name
asl_open_msoffice#:#Open in Office Online
cld_cld_cldh_exod_asl_open_msoffice#:#Open in Office Online
cld_cldh_exod_asl_open_msoffice#:#Open in Office Online
asl_rename#:#Rename
client_id#:#Client-ID
client_secret#:#Client-Secret
Expand Down Expand Up @@ -50,4 +48,4 @@ info_message_info#:#This message will be shown when creating a new OneDrive obje
msg_name_already_exists#:#A file with the same name already exists.
msg_illegal_characters#:#The provided name cannot contain any illegal characters.
msg_leading_or_trailing_spaces#:#The provided name cannot contain leading, or trailing, spaces.
msg_rename_failed#:#Renaming failed
msg_rename_failed#:#Renaming failed
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$id = 'exod';
$version = '2.2.2';
$version = '2.2.3';
$ilias_min_version = '6.0';
$ilias_max_version = '6.999';
$responsible = 'studer + raimann ag';
Expand Down
22 changes: 18 additions & 4 deletions sql/dbupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
?>
<#4>
<?php
//Adding a new Permission ("Open in Office Online")
//Adding a new Permission ("Open in Online Editor")
require_once("./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php");
$cld_type_id = ilDBUpdateNewObjectType::getObjectTypeId('cld');

if ($cld_type_id) {
$open_ms_office = ilDBUpdateNewObjectType::addCustomRBACOperation(ilOneDrivePlugin::getInstance()->getPrefix() . '_asl_open_msoffice', 'open ms office', 'object', 280);
if ($open_ms_office) {
ilDBUpdateNewObjectType::addRBACOperation($cld_type_id, $open_ms_office);
$open_online_editor = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_in_online_editor', 'edit in online editor', 'object', 280);
if ($open_online_editor) {
ilDBUpdateNewObjectType::addRBACOperation($cld_type_id, $open_online_editor);
}
}
?>
Expand Down Expand Up @@ -127,3 +127,17 @@
]
);
?>
<#8>
<?php
// rename rbac operation
global $DIC;
$query = $DIC->database()->query('SELECT * FROM rbac_operations WHERE operation = "cld_cldh_exod_asl_open_msoffice"');
if ($res = $DIC->database()->fetchAssoc($query)) {
require_once("./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php");
if (ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_in_online_editor')) {
$DIC->database()->query('DELETE FROM rbac_operations WHERE ops_id = ' . $res['ops_id']);
} else {
$DIC->database()->query('UPDATE rbac_operations SET operation = "edit_in_online_editor", description = "edit in online editor" WHERE ops_id = ' . $res['ops_id']);
}
}
?>

0 comments on commit 292b6e6

Please sign in to comment.