From e01165c4abb7d7625e31b66174a95723903dc53a Mon Sep 17 00:00:00 2001 From: Maria-Sukhova Date: Fri, 8 Nov 2024 10:58:38 +0300 Subject: [PATCH 01/15] added emptyselection, exportusers --- lang/de/onlyofficedocspace.php | 2 ++ lang/es/onlyofficedocspace.php | 2 ++ lang/fr/onlyofficedocspace.php | 2 ++ lang/it/onlyofficedocspace.php | 2 ++ lang/ja/onlyofficedocspace.php | 2 ++ lang/ru/onlyofficedocspace.php | 2 ++ lang/zh/onlyofficedocspace.php | 2 ++ 7 files changed, 14 insertions(+) diff --git a/lang/de/onlyofficedocspace.php b/lang/de/onlyofficedocspace.php index b07fe00..6375fa7 100644 --- a/lang/de/onlyofficedocspace.php +++ b/lang/de/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'DocSpace-Benutzerstatus'; $string['docspaceusertype'] = 'DocSpace-Benutzertyp'; $string['documentserverurldescription'] = 'Die DocSpace Service-Adresse gibt die Adresse des Servers an'; +$string['emptyselection'] = 'Nichts ausgewählt'; $string['enterfullscreen'] = 'Vollbildmodus öffnen'; $string['exitfullscreen'] = 'Vollbildmodus verlassen'; +$string['exportusers'] = 'Benutzer exportieren'; $string['failedinvitations'] = 'Einladung für {$a} Benutzer fehlgeschlagen. Möglicherweise wurde das Limit der zahlenden DocSpace-Benutzer erreicht.'; $string['invitetodocspace'] = 'Zu DocSpace einladen'; $string['loginmodal:description'] = 'Bitte geben Sie Ihr DocSpace-Passwort ein'; diff --git a/lang/es/onlyofficedocspace.php b/lang/es/onlyofficedocspace.php index 514f241..94613e3 100644 --- a/lang/es/onlyofficedocspace.php +++ b/lang/es/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'Estado del usuario de DocSpace'; $string['docspaceusertype'] = 'Tipo del usuario de DocSpace'; $string['documentserverurldescription'] = 'La dirección del servicio DocSpace especifica la dirección del servidor '; +$string['emptyselection'] = 'Nada seleccionado'; $string['enterfullscreen'] = 'Abrir pantalla completa'; $string['exitfullscreen'] = 'Salir de pantalla completa'; +$string['exportusers'] = 'Exportar usuarios'; $string['failedinvitations'] = 'La invitación ha fallado para {$a} usuario(s). Puede que se haya alcanzado el límite de usuarios de pago de DocSpace.'; $string['invitetodocspace'] = 'Invitar a DocSpace'; $string['loginmodal:description'] = 'Por favor, introduzca su contraseña para DocSpace'; diff --git a/lang/fr/onlyofficedocspace.php b/lang/fr/onlyofficedocspace.php index 8ac686b..2add969 100644 --- a/lang/fr/onlyofficedocspace.php +++ b/lang/fr/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'Statut de l\'utilisateur de DocSpace'; $string['docspaceusertype'] = 'Type d\'utilisateur DocSpace'; $string['documentserverurldescription'] = 'L’adresse du service DocSpace spécifie l’adresse du serveur'; +$string['emptyselection'] = 'Aucun élément sélectionné'; $string['enterfullscreen'] = 'Ouvrir en plein écran'; $string['exitfullscreen'] = 'Quitter le plein écran'; +$string['exportusers'] = 'Exporter les utilisateurs'; $string['failedinvitations'] = 'L’invitation a échoué pour {$a} utilisateur(s). La limite du nombre d’utilisateurs payants de DocSpace a peut-être été atteinte.'; $string['invitetodocspace'] = 'Inviter à DocSpace'; $string['loginmodal:description'] = 'Veuillez saisir votre mot de passe DocSpace'; diff --git a/lang/it/onlyofficedocspace.php b/lang/it/onlyofficedocspace.php index f5a4c0d..e33e6e7 100644 --- a/lang/it/onlyofficedocspace.php +++ b/lang/it/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'Stato utente DocSpace'; $string['docspaceusertype'] = 'Tipo utente DocSpace'; $string['documentserverurldescription'] = 'L’indirizzo del servizio DocSpace specifica l’indirizzo del server'; +$string['emptyselection'] = 'Nessun elemento selezionato'; $string['enterfullscreen'] = 'Apri schermo intero'; $string['exitfullscreen'] = 'Chiudi schermo intero'; +$string['exportusers'] = 'Esporta utenti'; $string['failedinvitations'] = 'Invito non riuscito per {$a} utente(i). Il limite di utenti a pagamento di DocSpace potrebbe essere stato raggiunto.'; $string['invitetodocspace'] = 'Invita su DocSpace'; $string['loginmodal:description'] = 'Inserisci la tua password di DocSpace'; diff --git a/lang/ja/onlyofficedocspace.php b/lang/ja/onlyofficedocspace.php index 668258d..1bd6586 100644 --- a/lang/ja/onlyofficedocspace.php +++ b/lang/ja/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'DocSpaceユーザーのステータス'; $string['docspaceusertype'] = 'DocSpaceユーザーのタイプ'; $string['documentserverurldescription'] = 'DocSpaceサービスアドレスは、サーバーのアドレスを指定します。'; +$string['emptyselection'] = 'ご返信をこちらに入力してください'; $string['enterfullscreen'] = '全画面表示'; $string['exitfullscreen'] = '全画面表示を終了'; +$string['exportusers'] = 'コメントをこちらに入力してください'; $string['failedinvitations'] = '{$a}ユーザーの招待に失敗しました。 有料DocSpaceユーザーの人数制限に達している可能性があります。'; $string['invitetodocspace'] = 'DocSpaceへの招待'; $string['loginmodal:description'] = 'DocSpaceのパスワードを入力してください。'; diff --git a/lang/ru/onlyofficedocspace.php b/lang/ru/onlyofficedocspace.php index 0925061..9a59902 100644 --- a/lang/ru/onlyofficedocspace.php +++ b/lang/ru/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = 'Статус пользователя DocSpace'; $string['docspaceusertype'] = 'Тип пользователя DocSpace'; $string['documentserverurldescription'] = 'Адрес службы DocSpace Service указывает адрес сервера'; +$string['emptyselection'] = 'Ничего не выбрано'; $string['enterfullscreen'] = 'Открыть полный экран'; $string['exitfullscreen'] = 'Закрыть полный экран'; +$string['exportusers'] = 'Экспортировать пользователей'; $string['failedinvitations'] = 'Не удалось пригласить пользователя(ей) {$a}. Возможно, достигнут лимит платных пользователей DocSpace.'; $string['invitetodocspace'] = 'Пригласить в DocSpace'; $string['loginmodal:description'] = 'Пожалуйста, введите пароль для DocSpace'; diff --git a/lang/zh/onlyofficedocspace.php b/lang/zh/onlyofficedocspace.php index 174d18c..4a362b2 100644 --- a/lang/zh/onlyofficedocspace.php +++ b/lang/zh/onlyofficedocspace.php @@ -49,8 +49,10 @@ $string['docspaceuserstatus'] = '协作空间用户状态'; $string['docspaceusertype'] = '协作空间用户类型'; $string['documentserverurldescription'] = '协作空间服务地址指定了服务器的地址'; +$string['emptyselection'] = '未选择任何内容'; $string['enterfullscreen'] = '打开全屏'; $string['exitfullscreen'] = '退出全屏'; +$string['exportusers'] = '导出用户'; $string['failedinvitations'] = '{$a} 名用户邀请失败。 可能已达到付费协作空间用户的数量上限。'; $string['invitetodocspace'] = '邀请至协作空间'; $string['loginmodal:description'] = '请输入您的写作空间密码'; From 3fcf120c0309549f22a63b8ac2f8d60fb6155321 Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Mon, 11 Nov 2024 14:20:25 +0500 Subject: [PATCH 02/15] fix discrepant template names --- templates/docspace_editor.mustache | 2 +- templates/docspace_users.mustache | 2 +- templates/docspace_users_category.mustache | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/docspace_editor.mustache b/templates/docspace_editor.mustache index 9d379be..da5be8d 100644 --- a/templates/docspace_editor.mustache +++ b/templates/docspace_editor.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template mod_onlyofficedocspace/teacherslist + @template mod_onlyofficedocspace/docspace_editor Template purpose and description. diff --git a/templates/docspace_users.mustache b/templates/docspace_users.mustache index 7b7f31b..8355727 100644 --- a/templates/docspace_users.mustache +++ b/templates/docspace_users.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template mod_onlyofficedocspace/docspaceusers + @template mod_onlyofficedocspace/docspace_users Template purpose and description. diff --git a/templates/docspace_users_category.mustache b/templates/docspace_users_category.mustache index 13b4c13..0b3fcc3 100644 --- a/templates/docspace_users_category.mustache +++ b/templates/docspace_users_category.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template mod_onlyofficedocspace/teacherslist + @template mod_onlyofficedocspace/docspace_users_category Template purpose and description. From 82ab6533704605fea0399b07972ed82b603c47c7 Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Mon, 11 Nov 2024 14:22:59 +0500 Subject: [PATCH 03/15] add copyright and licence docblocks --- styles.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles.css b/styles.css index 9000b9a..d361639 100644 --- a/styles.css +++ b/styles.css @@ -1,3 +1,7 @@ +/* @copyright 2024 Ascensio System SIA + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + #ds-login-form { padding: 16px; border-radius: 8px; From 865ed5c20a66fa9c6ca374e2d9782c9e7d0358aa Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Mon, 11 Nov 2024 14:51:56 +0500 Subject: [PATCH 04/15] rename docspaceuser table --- classes/moodle/moodle_docspace_user_manager.php | 2 +- db/install.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/moodle/moodle_docspace_user_manager.php b/classes/moodle/moodle_docspace_user_manager.php index 184feca..bc83169 100644 --- a/classes/moodle/moodle_docspace_user_manager.php +++ b/classes/moodle/moodle_docspace_user_manager.php @@ -35,7 +35,7 @@ class moodle_docspace_user_manager { /** * @var $table table name */ - private $table = 'onlyofficedocspace_docspaceuser'; + private $table = 'onlyofficedocspace_dsuser'; /** * Moodle docspace user manager constructor. diff --git a/db/install.xml b/db/install.xml index 4459ebf..970ade9 100644 --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -28,7 +28,7 @@ - +
From 06a23b8c220e56a14aff6e7c42f054f6b01cadc8 Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Mon, 11 Nov 2024 16:26:38 +0500 Subject: [PATCH 05/15] use request param wrappers instead of superglobals --- .../requests/update_admin_settings_request.php | 18 +++++++----------- .../http/requests/update_password_request.php | 15 ++++++++------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/classes/http/requests/update_admin_settings_request.php b/classes/http/requests/update_admin_settings_request.php index d2b894f..65f0fbe 100644 --- a/classes/http/requests/update_admin_settings_request.php +++ b/classes/http/requests/update_admin_settings_request.php @@ -33,6 +33,7 @@ use mod_onlyofficedocspace\errors\invalid_credentials_error; use mod_onlyofficedocspace\errors\validation_error; use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; +use moodle_exception; /** * update_admin_settings_request @@ -62,20 +63,15 @@ class update_admin_settings_request { * @return void */ public function __construct() { - if ( - ! (isset($_POST['url']) && !empty($_POST['url']) - && isset($_POST['email']) && !empty($_POST['email']) - && isset($_POST['password']) && !empty($_POST['password']) - && isset($_POST['randomPassword']) && !empty($_POST['randomPassword'])) - ) { + try { + $this->docspaceurl = required_param('url', PARAM_URL); + $this->docspaceemail = required_param('email', PARAM_EMAIL); + $this->docspacepassword = required_param('password', PARAM_RAW); + $this->randompassword = required_param('randomPassword', PARAM_RAW); + } catch(moodle_exception) { throw new validation_error(get_string('paramsmissingvalidationerror', 'onlyofficedocspace')); } - $this->docspaceurl = $_POST['url']; - $this->docspaceemail = $_POST['email']; - $this->docspacepassword = $_POST['password']; - $this->randompassword = $_POST['randomPassword']; - $this->sanitize(); } diff --git a/classes/http/requests/update_password_request.php b/classes/http/requests/update_password_request.php index e472c25..657b60d 100644 --- a/classes/http/requests/update_password_request.php +++ b/classes/http/requests/update_password_request.php @@ -28,6 +28,7 @@ use mod_onlyofficedocspace\docspace\docspace_auth_manager; use mod_onlyofficedocspace\errors\validation_error; use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; +use moodle_exception; /** * update_password_request @@ -55,19 +56,19 @@ class update_password_request { public function __construct() { global $USER; - if ( - ! (isset($_POST['email']) && !empty($_POST['email']) - && isset($_POST['password']) && !empty($_POST['password'])) - ) { + try { + $email = required_param('email', PARAM_EMAIL); + $password = required_param('password', PARAM_RAW); + } catch(moodle_exception) { throw new validation_error(get_string('paramsmissingvalidationerror', 'onlyofficedocspace')); } - if ($USER->email !== $_POST['email']) { + if ($USER->email !== $email) { throw new validation_error(get_string('invalidparamsvalidationerror', 'onlyofficedocspace')); } - $this->docspaceemail = $_POST['email']; - $this->docspacepassword = $_POST['password']; + $this->docspaceemail = $email; + $this->docspacepassword = $password; } /** From dfe2375403a0fbb3b5626aba70f3873c6ad415cf Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Mon, 11 Nov 2024 17:18:56 +0500 Subject: [PATCH 06/15] move non-standard classes to the local folder --- api/inviteusers.php | 8 +++---- api/updateadminsettings.php | 10 ++++----- api/updateuserpassword.php | 8 +++---- classes/{ => local}/common/flash_message.php | 2 +- classes/{ => local}/common/http_request.php | 2 +- classes/{ => local}/common/http_response.php | 2 +- .../docspace/docspace_auth_manager.php | 8 +++---- .../docspace/docspace_file_manager.php | 6 +++--- .../docspace/docspace_settings.php | 6 +++--- .../docspace/docspace_user_manager.php | 8 +++---- .../docspace/docspace_users_collection.php | 2 +- .../docspace/enums/docspace_user_status.php | 2 +- .../docspace/enums/docspace_user_type.php | 2 +- classes/{ => local}/errors/docspace_error.php | 2 +- .../errors/invalid_credentials_error.php | 2 +- .../{ => local}/errors/validation_error.php | 2 +- .../http/requests/get_users_request.php | 14 ++++++------- .../http/requests/invite_users_request.php | 20 +++++++++--------- .../update_admin_settings_request.php | 21 +++++++++---------- .../http/requests/update_password_request.php | 10 ++++----- .../moodle/moodle_docspace_user_manager.php | 2 +- .../moodle/moodle_user_manager.php | 2 +- classes/output/docspaceusers.php | 10 ++++----- mod_form.php | 4 ++-- settings.php | 6 +++--- view.php | 10 ++++----- 26 files changed, 85 insertions(+), 86 deletions(-) rename classes/{ => local}/common/flash_message.php (97%) rename classes/{ => local}/common/http_request.php (98%) rename classes/{ => local}/common/http_response.php (97%) rename classes/{ => local}/docspace/docspace_auth_manager.php (90%) rename classes/{ => local}/docspace/docspace_file_manager.php (94%) rename classes/{ => local}/docspace/docspace_settings.php (97%) rename classes/{ => local}/docspace/docspace_user_manager.php (94%) rename classes/{ => local}/docspace/docspace_users_collection.php (96%) rename classes/{ => local}/docspace/enums/docspace_user_status.php (95%) rename classes/{ => local}/docspace/enums/docspace_user_type.php (95%) rename classes/{ => local}/errors/docspace_error.php (95%) rename classes/{ => local}/errors/invalid_credentials_error.php (96%) rename classes/{ => local}/errors/validation_error.php (95%) rename classes/{ => local}/http/requests/get_users_request.php (88%) rename classes/{ => local}/http/requests/invite_users_request.php (88%) rename classes/{ => local}/http/requests/update_admin_settings_request.php (87%) rename classes/{ => local}/http/requests/update_password_request.php (88%) rename classes/{ => local}/moodle/moodle_docspace_user_manager.php (98%) rename classes/{ => local}/moodle/moodle_user_manager.php (98%) diff --git a/api/inviteusers.php b/api/inviteusers.php index 2c0bcf2..8c8aa45 100644 --- a/api/inviteusers.php +++ b/api/inviteusers.php @@ -22,11 +22,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\http\requests\invite_users_request; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\validation_error; -use mod_onlyofficedocspace\http\requests\invite_users_request; +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); defined('AJAX_SCRIPT') || define('AJAX_SCRIPT', true); diff --git a/api/updateadminsettings.php b/api/updateadminsettings.php index 451acfc..c9d7baa 100644 --- a/api/updateadminsettings.php +++ b/api/updateadminsettings.php @@ -14,7 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -use mod_onlyofficedocspace\common\flash_message; +use mod_onlyofficedocspace\local\common\flash_message; +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\http\requests\update_admin_settings_request; + /** * Return json-encoded response. * @@ -25,10 +29,6 @@ require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\validation_error; -use mod_onlyofficedocspace\http\requests\update_admin_settings_request; - defined('AJAX_SCRIPT') || define('AJAX_SCRIPT', true); require_admin(); diff --git a/api/updateuserpassword.php b/api/updateuserpassword.php index 2a5825f..1686d56 100644 --- a/api/updateuserpassword.php +++ b/api/updateuserpassword.php @@ -22,11 +22,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\http\requests\update_password_request; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\validation_error; -use mod_onlyofficedocspace\http\requests\update_password_request; +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); defined('AJAX_SCRIPT') || define('AJAX_SCRIPT', true); diff --git a/classes/common/flash_message.php b/classes/local/common/flash_message.php similarity index 97% rename from classes/common/flash_message.php rename to classes/local/common/flash_message.php index dabe820..936c645 100644 --- a/classes/common/flash_message.php +++ b/classes/local/common/flash_message.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\common; +namespace mod_onlyofficedocspace\local\common; /** * flash_message diff --git a/classes/common/http_request.php b/classes/local/common/http_request.php similarity index 98% rename from classes/common/http_request.php rename to classes/local/common/http_request.php index 53aef50..8f15f37 100644 --- a/classes/common/http_request.php +++ b/classes/local/common/http_request.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\common; +namespace mod_onlyofficedocspace\local\common; /** * http request class diff --git a/classes/common/http_response.php b/classes/local/common/http_response.php similarity index 97% rename from classes/common/http_response.php rename to classes/local/common/http_response.php index ee2412e..391b63b 100644 --- a/classes/common/http_response.php +++ b/classes/local/common/http_response.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\common; +namespace mod_onlyofficedocspace\local\common; /** * http response class diff --git a/classes/docspace/docspace_auth_manager.php b/classes/local/docspace/docspace_auth_manager.php similarity index 90% rename from classes/docspace/docspace_auth_manager.php rename to classes/local/docspace/docspace_auth_manager.php index d93f788..85d8a62 100644 --- a/classes/docspace/docspace_auth_manager.php +++ b/classes/local/docspace/docspace_auth_manager.php @@ -22,11 +22,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace; +namespace mod_onlyofficedocspace\local\docspace; -use mod_onlyofficedocspace\common\http_request; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\invalid_credentials_error; +use mod_onlyofficedocspace\local\common\http_request; +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\invalid_credentials_error; /** * Docspace auth manager diff --git a/classes/docspace/docspace_file_manager.php b/classes/local/docspace/docspace_file_manager.php similarity index 94% rename from classes/docspace/docspace_file_manager.php rename to classes/local/docspace/docspace_file_manager.php index a8b9ae5..f3d1574 100644 --- a/classes/docspace/docspace_file_manager.php +++ b/classes/local/docspace/docspace_file_manager.php @@ -22,10 +22,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace; +namespace mod_onlyofficedocspace\local\docspace; -use mod_onlyofficedocspace\common\http_request; -use mod_onlyofficedocspace\errors\docspace_error; +use mod_onlyofficedocspace\local\common\http_request; +use mod_onlyofficedocspace\local\errors\docspace_error; /** * DocSpace file manager diff --git a/classes/docspace/docspace_settings.php b/classes/local/docspace/docspace_settings.php similarity index 97% rename from classes/docspace/docspace_settings.php rename to classes/local/docspace/docspace_settings.php index 587903b..4cc9974 100644 --- a/classes/docspace/docspace_settings.php +++ b/classes/local/docspace/docspace_settings.php @@ -22,10 +22,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace; +namespace mod_onlyofficedocspace\local\docspace; -use mod_onlyofficedocspace\common\http_request; -use mod_onlyofficedocspace\errors\docspace_error; +use mod_onlyofficedocspace\local\common\http_request; +use mod_onlyofficedocspace\local\errors\docspace_error; /** * Docspace settings class diff --git a/classes/docspace/docspace_user_manager.php b/classes/local/docspace/docspace_user_manager.php similarity index 94% rename from classes/docspace/docspace_user_manager.php rename to classes/local/docspace/docspace_user_manager.php index 147991f..567bee2 100644 --- a/classes/docspace/docspace_user_manager.php +++ b/classes/local/docspace/docspace_user_manager.php @@ -22,11 +22,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace; +namespace mod_onlyofficedocspace\local\docspace; -use mod_onlyofficedocspace\common\http_request; -use mod_onlyofficedocspace\docspace\enums\docspace_user_type; -use mod_onlyofficedocspace\errors\docspace_error; +use mod_onlyofficedocspace\local\common\http_request; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\errors\docspace_error; /** * Docspace user manager class diff --git a/classes/docspace/docspace_users_collection.php b/classes/local/docspace/docspace_users_collection.php similarity index 96% rename from classes/docspace/docspace_users_collection.php rename to classes/local/docspace/docspace_users_collection.php index 8fde9cb..8a85ff3 100644 --- a/classes/docspace/docspace_users_collection.php +++ b/classes/local/docspace/docspace_users_collection.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace; +namespace mod_onlyofficedocspace\local\docspace; /** * DocSpace users collection diff --git a/classes/docspace/enums/docspace_user_status.php b/classes/local/docspace/enums/docspace_user_status.php similarity index 95% rename from classes/docspace/enums/docspace_user_status.php rename to classes/local/docspace/enums/docspace_user_status.php index ab9a411..ba6496c 100644 --- a/classes/docspace/enums/docspace_user_status.php +++ b/classes/local/docspace/enums/docspace_user_status.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace\enums; +namespace mod_onlyofficedocspace\local\docspace\enums; // phpcs:disable enum docspace_user_status: int { diff --git a/classes/docspace/enums/docspace_user_type.php b/classes/local/docspace/enums/docspace_user_type.php similarity index 95% rename from classes/docspace/enums/docspace_user_type.php rename to classes/local/docspace/enums/docspace_user_type.php index d824cec..4a96342 100644 --- a/classes/docspace/enums/docspace_user_type.php +++ b/classes/local/docspace/enums/docspace_user_type.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\docspace\enums; +namespace mod_onlyofficedocspace\local\docspace\enums; // phpcs:disable enum docspace_user_type: int { diff --git a/classes/errors/docspace_error.php b/classes/local/errors/docspace_error.php similarity index 95% rename from classes/errors/docspace_error.php rename to classes/local/errors/docspace_error.php index 3d4f777..24d6044 100644 --- a/classes/errors/docspace_error.php +++ b/classes/local/errors/docspace_error.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\errors; +namespace mod_onlyofficedocspace\local\errors; use Exception; /** diff --git a/classes/errors/invalid_credentials_error.php b/classes/local/errors/invalid_credentials_error.php similarity index 96% rename from classes/errors/invalid_credentials_error.php rename to classes/local/errors/invalid_credentials_error.php index 83ec58e..caf12ef 100644 --- a/classes/errors/invalid_credentials_error.php +++ b/classes/local/errors/invalid_credentials_error.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\errors; +namespace mod_onlyofficedocspace\local\errors; /** * invalid_credentials_error diff --git a/classes/errors/validation_error.php b/classes/local/errors/validation_error.php similarity index 95% rename from classes/errors/validation_error.php rename to classes/local/errors/validation_error.php index e5a3462..1ee9fd7 100644 --- a/classes/errors/validation_error.php +++ b/classes/local/errors/validation_error.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\errors; +namespace mod_onlyofficedocspace\local\errors; use Exception; /** diff --git a/classes/http/requests/get_users_request.php b/classes/local/http/requests/get_users_request.php similarity index 88% rename from classes/http/requests/get_users_request.php rename to classes/local/http/requests/get_users_request.php index a333ed4..21f3a7b 100644 --- a/classes/http/requests/get_users_request.php +++ b/classes/local/http/requests/get_users_request.php @@ -22,14 +22,14 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\http\requests; +namespace mod_onlyofficedocspace\local\http\requests; -use mod_onlyofficedocspace\docspace\enums\docspace_user_status; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; -use mod_onlyofficedocspace\moodle\moodle_user_manager; -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\docspace\docspace_user_manager; -use mod_onlyofficedocspace\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\docspace\docspace_user_manager; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_status; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; +use mod_onlyofficedocspace\local\moodle\moodle_user_manager; /** * get_users_request diff --git a/classes/http/requests/invite_users_request.php b/classes/local/http/requests/invite_users_request.php similarity index 88% rename from classes/http/requests/invite_users_request.php rename to classes/local/http/requests/invite_users_request.php index a2bf783..dc5e908 100644 --- a/classes/http/requests/invite_users_request.php +++ b/classes/local/http/requests/invite_users_request.php @@ -22,16 +22,16 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\http\requests; - -use mod_onlyofficedocspace\common\flash_message; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; -use mod_onlyofficedocspace\moodle\moodle_user_manager; -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\docspace\docspace_user_manager; -use mod_onlyofficedocspace\docspace\enums\docspace_user_type; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\validation_error; +namespace mod_onlyofficedocspace\local\http\requests; + +use mod_onlyofficedocspace\local\common\flash_message; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\docspace\docspace_user_manager; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; +use mod_onlyofficedocspace\local\moodle\moodle_user_manager; /** * invite_users_request diff --git a/classes/http/requests/update_admin_settings_request.php b/classes/local/http/requests/update_admin_settings_request.php similarity index 87% rename from classes/http/requests/update_admin_settings_request.php rename to classes/local/http/requests/update_admin_settings_request.php index 65f0fbe..51ebd8e 100644 --- a/classes/http/requests/update_admin_settings_request.php +++ b/classes/local/http/requests/update_admin_settings_request.php @@ -22,17 +22,16 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\http\requests; - -use Exception; -use mod_onlyofficedocspace\common\flash_message; -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\docspace\docspace_user_manager; -use mod_onlyofficedocspace\docspace\enums\docspace_user_type; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\errors\invalid_credentials_error; -use mod_onlyofficedocspace\errors\validation_error; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; +namespace mod_onlyofficedocspace\local\http\requests; + +use mod_onlyofficedocspace\local\common\flash_message; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\docspace\docspace_user_manager; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\errors\invalid_credentials_error; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; use moodle_exception; /** diff --git a/classes/http/requests/update_password_request.php b/classes/local/http/requests/update_password_request.php similarity index 88% rename from classes/http/requests/update_password_request.php rename to classes/local/http/requests/update_password_request.php index 657b60d..5d2f27c 100644 --- a/classes/http/requests/update_password_request.php +++ b/classes/local/http/requests/update_password_request.php @@ -22,12 +22,12 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\http\requests; +namespace mod_onlyofficedocspace\local\http\requests; -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\docspace\docspace_auth_manager; -use mod_onlyofficedocspace\errors\validation_error; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; +use mod_onlyofficedocspace\local\docspace\docspace_auth_manager; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\errors\validation_error; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; use moodle_exception; /** diff --git a/classes/moodle/moodle_docspace_user_manager.php b/classes/local/moodle/moodle_docspace_user_manager.php similarity index 98% rename from classes/moodle/moodle_docspace_user_manager.php rename to classes/local/moodle/moodle_docspace_user_manager.php index bc83169..96b81e2 100644 --- a/classes/moodle/moodle_docspace_user_manager.php +++ b/classes/local/moodle/moodle_docspace_user_manager.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\moodle; +namespace mod_onlyofficedocspace\local\moodle; /** * Class for managing moodle docspace users diff --git a/classes/moodle/moodle_user_manager.php b/classes/local/moodle/moodle_user_manager.php similarity index 98% rename from classes/moodle/moodle_user_manager.php rename to classes/local/moodle/moodle_user_manager.php index 8223e85..c85054c 100644 --- a/classes/moodle/moodle_user_manager.php +++ b/classes/local/moodle/moodle_user_manager.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_onlyofficedocspace\moodle; +namespace mod_onlyofficedocspace\local\moodle; use context_system; diff --git a/classes/output/docspaceusers.php b/classes/output/docspaceusers.php index fc431ff..2bbc771 100644 --- a/classes/output/docspaceusers.php +++ b/classes/output/docspaceusers.php @@ -24,11 +24,11 @@ namespace mod_onlyofficedocspace\output; -use mod_onlyofficedocspace\common\flash_message; -use mod_onlyofficedocspace\docspace\enums\docspace_user_status; -use mod_onlyofficedocspace\docspace\enums\docspace_user_type; -use mod_onlyofficedocspace\http\requests\get_users_request; -use mod_onlyofficedocspace\moodle\moodle_user_manager; +use mod_onlyofficedocspace\local\common\flash_message; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_status; +use mod_onlyofficedocspace\local\docspace\enums\docspace_user_type; +use mod_onlyofficedocspace\local\http\requests\get_users_request; +use mod_onlyofficedocspace\local\moodle\moodle_user_manager; use renderable; use templatable; use renderer_base; diff --git a/mod_form.php b/mod_form.php index 6f0d49b..efea557 100644 --- a/mod_form.php +++ b/mod_form.php @@ -25,8 +25,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; defined('MOODLE_INTERNAL') || die(); diff --git a/settings.php b/settings.php index 68fb445..16f6831 100644 --- a/settings.php +++ b/settings.php @@ -22,9 +22,9 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -use mod_onlyofficedocspace\common\flash_message; -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\errors\docspace_error; +use mod_onlyofficedocspace\local\common\flash_message; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\errors\docspace_error; use mod_onlyofficedocspace\output\docspaceusers; defined('MOODLE_INTERNAL') || die(); diff --git a/view.php b/view.php index aa83f4a..c0092a5 100644 --- a/view.php +++ b/view.php @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -use mod_onlyofficedocspace\docspace\docspace_file_manager; /** * Display DocSpace element * @@ -23,13 +22,14 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +use mod_onlyofficedocspace\local\docspace\docspace_file_manager; +use mod_onlyofficedocspace\local\docspace\docspace_settings; +use mod_onlyofficedocspace\local\errors\docspace_error; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; + require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); require_once(dirname(__FILE__) . '/lib.php'); -use mod_onlyofficedocspace\docspace\docspace_settings; -use mod_onlyofficedocspace\errors\docspace_error; -use mod_onlyofficedocspace\moodle\moodle_docspace_user_manager; - global $USER, $CFG; $id = optional_param('id', 0, PARAM_INT); // Course_module ID. From 627b138e67181380853075f1b62b426afd19f958 Mon Sep 17 00:00:00 2001 From: Kseniya Fedoruk Date: Tue, 12 Nov 2024 11:21:39 +0300 Subject: [PATCH 07/15] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 96a0118..f7e7018 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ Moodle admins can install the plugin following the usual Moodle plugin installat ## Plugin configuration +### If you are new to ONLYOFFICE DocSpace + +You can register a free account on the official website: [onlyoffice.com/docspace-registration.aspx](https://www.onlyoffice.com/docspace-registration.aspx). + +The STARTUP plan of ONLYOFFICE DocSpace is absolutely free to use. If you want to check other tariff plans, visit [this page](https://www.onlyoffice.com/docspace-prices.aspx). + ### General settings At first, go to your ONLYOFFICE DocSpace ([sign up](https://www.onlyoffice.com/docspace-registration.aspx) / [sign in](https://www.onlyoffice.com/docspace-signin.aspx)) -> Developer Tools -> JavaScript SDK. Add the address of your Moodle in the section *Enter the address of DocSpace to embed*. From 22a6204412b2f86ab21b5792f525b3d2a3ea5c9b Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Tue, 12 Nov 2024 17:42:25 +0500 Subject: [PATCH 08/15] add function for deleting multiple users from docspace user table --- .../local/moodle/moodle_docspace_user_manager.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/classes/local/moodle/moodle_docspace_user_manager.php b/classes/local/moodle/moodle_docspace_user_manager.php index 96b81e2..1b359b1 100644 --- a/classes/local/moodle/moodle_docspace_user_manager.php +++ b/classes/local/moodle/moodle_docspace_user_manager.php @@ -83,6 +83,18 @@ public function create_or_update(string $email, ?string $password = null): void } } + /** + * Delete multiple users from database table. + * @param array $emails user emails. + */ + public function delete(array $emails): void { + $this->persistence->delete_records_select( + $this->table, + "email IN ('" . implode("','", $emails) . "')", + [] + ); + } + /** * Delete all users from database table. */ From 7e6093a0fb30ed3d3d2aae1a02e21c5be7e0b3df Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Tue, 12 Nov 2024 17:46:24 +0500 Subject: [PATCH 09/15] implement privacy api --- classes/privacy/provider.php | 183 +++++++++++++++++++++++++++++++++ lang/en/onlyofficedocspace.php | 8 ++ 2 files changed, 191 insertions(+) create mode 100644 classes/privacy/provider.php diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php new file mode 100644 index 0000000..148c177 --- /dev/null +++ b/classes/privacy/provider.php @@ -0,0 +1,183 @@ +. + +/** + * Privacy api. + * + * @package mod_onlyofficedocspace + * @copyright 2024 Ascensio System SIA + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_onlyofficedocspace\privacy; + +use context; +use core_privacy\local\metadata\collection; +use core_privacy\local\request\approved_contextlist; +use core_privacy\local\request\approved_userlist; +use core_privacy\local\request\contextlist; +use core_privacy\local\request\userlist; +use core_privacy\local\request\writer; +use mod_onlyofficedocspace\local\moodle\moodle_docspace_user_manager; +use mod_onlyofficedocspace\local\moodle\moodle_user_manager; + +/** + * Privacy provider class. + * + * @package mod_onlyofficedocspace + * @copyright 2024 Ascensio System SIA + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements \core_privacy\local\metadata\provider, + \core_privacy\local\request\plugin\provider, + \core_privacy\local\request\core_userlist_provider { + + /** + * Extends metadata about system. + * @param collection $collection + * @return collection + */ + public static function get_metadata(collection $collection): collection { + $collection->add_database_table( + 'onlyofficedocspace_dsuser', + [ + 'email' => 'privacy:metadata:onlyofficedocspace_dsuser:email', + 'password' => 'privacy:metadata:onlyofficedocspace_dsuser:password', + ], + 'privacy:metadata:onlyofficedocspace_dsuser' + ); + + $collection->add_external_location_link('onlyofficedocspace_admin', + [ + 'login' => 'privacy:metadata:onlyofficedocspace_admin:login', + 'password' => 'privacy:metadata:onlyofficedocspace_admin:password', + ], + 'privacy:metadata:onlyofficedocspace_admin'); + + $collection->add_external_location_link('onlyofficedocspace_users', + [ + 'email' => 'privacy:metadata:onlyofficedocspace_users:email', + ], + 'privacy:metadata:onlyofficedocspace_users'); + + return $collection; + } + + /** + * Get the list of contexts that contain user information for the specified user. + * + * @param int $userid The user to search. + * @return contextlist $contextlist The list of contexts used in this plugin. + */ + public static function get_contexts_for_userid(int $userid): contextlist { + $contextlist = new contextlist(); + $usermanager = new moodle_user_manager(); + + if ($usermanager->get($userid)) { + $contextlist->add_system_context(); + } + + return $contextlist; + } + + /** + * Get the list of users who have data within a context. + * + * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination. + */ + public static function get_users_in_context(userlist $userlist) { + $context = $userlist->get_context(); + + if ($context != CONTEXT_SYSTEM) { + return; + } + + $sql = "SELECT u.id + FROM {user} u + WHERE u.email + IN (SELECT email FROM {onlyofficedocspace_dsuser})"; + + $userlist->add_from_sql('userid', $sql, []); + } + + /** + * Export all user data for the specified user, in the specified contexts. + * + * @param approved_contextlist $contextlist The approved contexts to export information for. + */ + public static function export_user_data(approved_contextlist $contextlist) { + if (empty($contextlist)) { + return; + } + + $user = $contextlist->get_user(); + + $docspaceusermanager = new moodle_docspace_user_manager(); + $docspaceuser = $docspaceusermanager->get($user->email); + + foreach ($contextlist->get_contexts() as $context) { + writer::with_context($context) + ->export_data([get_string('pluginname', 'onlyofficedocspace')], $docspaceuser); + } + } + + /** + * Delete all user data for the specified user, in the specified contexts. + * + * @param approved_contextlist $contextlist + * @return void + */ + public static function delete_data_for_user(approved_contextlist $contextlist) { + if (empty($contextlist->count())) { + return; + } + + $user = $contextlist->get_user(); + $docspaceusermanager = new moodle_docspace_user_manager(); + + foreach ($contextlist->get_contexts() as $context) { + if ($context->contextlevel === CONTEXT_SYSTEM) { + $docspaceusermanager->delete([$user->email]); + } + } + } + + /** + * Delete all personal data for all users in the specified context. + * + * @param context $context Context to delete data from. + */ + public static function delete_data_for_all_users_in_context(context $context) { + $docspaceusermanager = new moodle_docspace_user_manager(); + $docspaceusermanager->clear(); + } + + /** + * Delete multiple users within a single context. + * + * @param approved_userlist $userlist The approved context and user information to delete information for. + */ + public static function delete_data_for_users(approved_userlist $userlist) { + $users = $userlist->get_users(); + + $emails = array_map(function($user) { + return $user->email; + }, $users); + + $docspaceusermanager = new moodle_docspace_user_manager(); + $docspaceusermanager->delete($emails); + } +} diff --git a/lang/en/onlyofficedocspace.php b/lang/en/onlyofficedocspace.php index c567bd4..c47c4c6 100644 --- a/lang/en/onlyofficedocspace.php +++ b/lang/en/onlyofficedocspace.php @@ -67,6 +67,14 @@ $string['paramsmissingvalidationerror'] = 'Required credentials are missing'; $string['pluginadministration'] = 'ONLYOFFICE DocSpace activity administration'; $string['pluginname'] = 'ONLYOFFICE DocSpace'; +$string['privacy:metadata:onlyofficedocspace_admin'] = ''; +$string['privacy:metadata:onlyofficedocspace_admin:login'] = ''; +$string['privacy:metadata:onlyofficedocspace_admin:password'] = ''; +$string['privacy:metadata:onlyofficedocspace_dsuser'] = ''; +$string['privacy:metadata:onlyofficedocspace_dsuser:email'] = ''; +$string['privacy:metadata:onlyofficedocspace_dsuser:password'] = ''; +$string['privacy:metadata:onlyofficedocspace_users'] = ''; +$string['privacy:metadata:onlyofficedocspace_users:email'] = ''; $string['rolewarning'] = 'The current Moodle user will be added to DocSpace with the Room admin role'; $string['selecteditemtype:file'] = 'Selected file'; $string['selecteditemtype:room'] = 'Selected room'; From a9d68ec8b8a7f319f74b875eb78d4115f7751c3b Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Tue, 12 Nov 2024 17:51:39 +0500 Subject: [PATCH 10/15] fix moodle.ControlStructures.ControlSignature.Found --- classes/local/http/requests/update_admin_settings_request.php | 2 +- classes/local/http/requests/update_password_request.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/local/http/requests/update_admin_settings_request.php b/classes/local/http/requests/update_admin_settings_request.php index 51ebd8e..b9978d0 100644 --- a/classes/local/http/requests/update_admin_settings_request.php +++ b/classes/local/http/requests/update_admin_settings_request.php @@ -67,7 +67,7 @@ public function __construct() { $this->docspaceemail = required_param('email', PARAM_EMAIL); $this->docspacepassword = required_param('password', PARAM_RAW); $this->randompassword = required_param('randomPassword', PARAM_RAW); - } catch(moodle_exception) { + } catch (moodle_exception) { throw new validation_error(get_string('paramsmissingvalidationerror', 'onlyofficedocspace')); } diff --git a/classes/local/http/requests/update_password_request.php b/classes/local/http/requests/update_password_request.php index 5d2f27c..5187e3e 100644 --- a/classes/local/http/requests/update_password_request.php +++ b/classes/local/http/requests/update_password_request.php @@ -59,7 +59,7 @@ public function __construct() { try { $email = required_param('email', PARAM_EMAIL); $password = required_param('password', PARAM_RAW); - } catch(moodle_exception) { + } catch (moodle_exception) { throw new validation_error(get_string('paramsmissingvalidationerror', 'onlyofficedocspace')); } From 0bfc2bb36a60f11c0a1173a819c0ebac3e7a1683 Mon Sep 17 00:00:00 2001 From: Serik Ibragimov Date: Tue, 12 Nov 2024 18:13:46 +0500 Subject: [PATCH 11/15] remove usermodified field --- db/install.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/install.xml b/db/install.xml index 970ade9..6dc8e0a 100644 --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -12,7 +12,6 @@ - @@ -22,7 +21,6 @@ - From 92be2bb88690b6b5b0bee27ae25deb52d4a68bdd Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 12 Nov 2024 17:19:47 +0300 Subject: [PATCH 12/15] fix spaces --- lang/en/onlyofficedocspace.php | 2 +- lang/fr/onlyofficedocspace.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/en/onlyofficedocspace.php b/lang/en/onlyofficedocspace.php index c47c4c6..1823cf1 100644 --- a/lang/en/onlyofficedocspace.php +++ b/lang/en/onlyofficedocspace.php @@ -56,7 +56,7 @@ $string['failedinvitations'] = 'Invitation failed for {$a} user(s). The limit of paid DocSpace users may have been reached.'; $string['invitetodocspace'] = 'Invite to DocSpace'; $string['loginmodal:description'] = 'Please enter your DocSpace password'; -$string['loginmodal:title'] = 'Moodle requests access to your ONLYOFFICE DocSpace'; +$string['loginmodal:title'] = 'Moodle requests access to your ONLYOFFICE DocSpace'; $string['logintodocspace'] = "Log in to ONLYOFFICE DocSpace"; $string['modulename'] = 'ONLYOFFICE DocSpace'; $string['modulename_help'] = 'This module enables users to connect ONLYOFFICE DocSpace rooms as activities in Moodle for collaboration.'; diff --git a/lang/fr/onlyofficedocspace.php b/lang/fr/onlyofficedocspace.php index 2add969..816d456 100644 --- a/lang/fr/onlyofficedocspace.php +++ b/lang/fr/onlyofficedocspace.php @@ -44,7 +44,7 @@ $string['docspaceusernotfound'] = 'L’utilisateur n’a pas été trouvé dans ONLYOFFICE DocSpace. Veuillez contacter l’administrateur.'; $string['docspaceuserrole:admin'] = 'Administrateur de salle'; $string['docspaceuserrole:power'] = 'Utilisateur avancé'; -$string['docspaceuserscategory:description'] = 'Pour ajouter de nouveaux utilisateurs à ONLYOFFICE DocSpace et commencer à travailler avec le plugin, veuillez appuyer sur {$a}. Seuls les utilisateurs ayant les rôles de gestionnaire, enseignant et créateur de cours de Moodle peuvent être invités à DocSpace.
Tous les nouveaux utilisateurs seront ajoutés avec le rôle Utilisateur avancé. Vous pouvez modifier le type de rôle dans les paramètres des comptes dans DocSpace. Veuillez noter que le rôle d’ Utilisateur avancé est payant.'; +$string['docspaceuserscategory:description'] = 'Pour ajouter de nouveaux utilisateurs à ONLYOFFICE DocSpace et commencer à travailler avec le plugin, veuillez appuyer sur {$a}. Seuls les utilisateurs ayant les rôles de gestionnaire, enseignant et créateur de cours de Moodle peuvent être invités à DocSpace.
Tous les nouveaux utilisateurs seront ajoutés avec le rôle Utilisateur avancé. Vous pouvez modifier le type de rôle dans les paramètres des comptes dans DocSpace. Veuillez noter que le rôle d’ Utilisateur avancé est payant.'; $string['docspaceuserscategory:title'] = 'Utilisateurs de DocSpace'; $string['docspaceuserstatus'] = 'Statut de l\'utilisateur de DocSpace'; $string['docspaceusertype'] = 'Type d\'utilisateur DocSpace'; @@ -75,6 +75,6 @@ $string['selectfile'] = 'Sélectionner un fichier'; $string['selectroom'] = 'Sélectionner une salle'; $string['sentinvitations'] = 'Invitation envoyée avec succès à {$a} utilisateur(s)'; -$string['settings'] = 'Paramètres de ONLYOFFICE DocSpace'; +$string['settings'] = 'Paramètres de ONLYOFFICE DocSpace'; $string['skippedinvitations'] = 'Invitation ignorée pour {$a} utilisateur(s). Le(s) utilisateur(s) avec le(s) e-mail(s) indiqué(s) existe(nt) peut-être déjà dans DocSpace.'; $string['validationerror:password'] = 'Le mot de passe saisi est incorrect'; From 727a7cfd8a8686c4f2a67d5cfc79e8212a645334 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 12 Nov 2024 17:34:10 +0300 Subject: [PATCH 13/15] privacy text --- lang/en/onlyofficedocspace.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lang/en/onlyofficedocspace.php b/lang/en/onlyofficedocspace.php index 1823cf1..f911790 100644 --- a/lang/en/onlyofficedocspace.php +++ b/lang/en/onlyofficedocspace.php @@ -67,14 +67,14 @@ $string['paramsmissingvalidationerror'] = 'Required credentials are missing'; $string['pluginadministration'] = 'ONLYOFFICE DocSpace activity administration'; $string['pluginname'] = 'ONLYOFFICE DocSpace'; -$string['privacy:metadata:onlyofficedocspace_admin'] = ''; -$string['privacy:metadata:onlyofficedocspace_admin:login'] = ''; -$string['privacy:metadata:onlyofficedocspace_admin:password'] = ''; -$string['privacy:metadata:onlyofficedocspace_dsuser'] = ''; -$string['privacy:metadata:onlyofficedocspace_dsuser:email'] = ''; -$string['privacy:metadata:onlyofficedocspace_dsuser:password'] = ''; -$string['privacy:metadata:onlyofficedocspace_users'] = ''; -$string['privacy:metadata:onlyofficedocspace_users:email'] = ''; +$string['privacy:metadata:onlyofficedocspace_admin'] = 'Information about DocSpace admin.'; +$string['privacy:metadata:onlyofficedocspace_admin:login'] = 'DocSpace admin login.'; +$string['privacy:metadata:onlyofficedocspace_admin:password'] = 'DocSpace admin password.'; +$string['privacy:metadata:onlyofficedocspace_dsuser'] = 'Information about DocSpace user stored in database.'; +$string['privacy:metadata:onlyofficedocspace_dsuser:email'] = 'DocSpace user\'s email.'; +$string['privacy:metadata:onlyofficedocspace_dsuser:password'] = 'DocSpace user\'s passwrod hash.'; +$string['privacy:metadata:onlyofficedocspace_users'] = 'User information which used for creating in DocSpace.'; +$string['privacy:metadata:onlyofficedocspace_users:email'] = 'Moodle user\'s email.'; $string['rolewarning'] = 'The current Moodle user will be added to DocSpace with the Room admin role'; $string['selecteditemtype:file'] = 'Selected file'; $string['selecteditemtype:room'] = 'Selected room'; From 29bbffcd3d74300f33a0930c67aede2f96a0b613 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 12 Nov 2024 19:03:10 +0300 Subject: [PATCH 14/15] 1.0.1 --- CHANGELOG.md | 6 +++++- version.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5c151..06027d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Change Log +## 1.0.1 +## Changed +- fixes according to markets code checks + ## 1.0.0 ## Added - ONLYOFFICE DocSpace activity room element creation - ONLYOFFICE DocSpace configuration - Allow to invite moodle users to ONLYOFFICE DocSpace -- View ONLYOFFICE DocSpace rooms \ No newline at end of file +- View ONLYOFFICE DocSpace rooms diff --git a/version.php b/version.php index ec51f07..b9e3979 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_onlyofficedocspace'; -$plugin->version = 2024110700; -$plugin->release = 'v1.0.0'; +$plugin->version = 2024111200; +$plugin->release = 'v1.0.1'; $plugin->requires = 2023100905; $plugin->maturity = MATURITY_STABLE; From a428a68ebebfdd1afaff8ab3546c37dc06ddc03b Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 15 Nov 2024 10:16:59 +0300 Subject: [PATCH 15/15] change ci --- .github/workflows/ci.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 136f8e1..b055e78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest services: - postgres: + pgsql: image: postgres:13 env: POSTGRES_USER: 'postgres' @@ -84,7 +84,12 @@ jobs: echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV - name: Install moodle-plugin-ci - run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + run: | + if nc -z mariadb 3306; then + moodle-plugin-ci install --plugin ./plugin --db-host=${{ matrix.database }} + else + moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + fi env: DB: ${{ matrix.database }} MOODLE_BRANCH: ${{ matrix.moodle-branch }} @@ -137,4 +142,4 @@ jobs: - name: Mark cancelled jobs as failed. if: ${{ cancelled() }} - run: exit 1 \ No newline at end of file + run: exit 1