Moodle Plugins directory: Rocket.Chat: Versions: 1.2.5 | Moodle.org

Rocket.Chat
Rocket.Chat 1.2.5
Rocket.Chat activity for Moodle
This plugin allows teachers to keep synchronized users enrolled in a Moodle course into a dedicated Rocket.Chat private channel.
Main feature
Adding this activity to a Moodle course will create a private channel in Rocket.Chat and push Moodle users associated to this activity as members of this newly created channel. The list of members will then be kept up to date.
It will be possible to access to this Rocket.Chat channel directly from Moodle or through any autonomous Rocket.Chat client.
Rocket.Chat settings requirements
Authentication
- LDAP and CAS account fusion is adviced when moodle user account creation is activated for moodle Rocket.Chat account
Moodle API account creation
- create a RocketChat local account
- other authentification account such like CAS will work
- confirm it (verified button) through Rocket.Chat administration
Roles and permissions
- Give the created user user and admin role (further tests will enable to prevent for using admin role)
- view-room-administration
- create-personal-access-tokens
- api-bypass-rate-limit to prevent request limit
- CAS authentication
- In case of user account creation in Rocket.Chat through moodle plugin you must activate following settings
- Trust CAS username
- Authorize user creation
Create a personal token for this account
Through Visual interface
- logged as the Moodle api account, though My Account -> Personal Access Tokens
- create a new personal access token with
Ignore Two Factor Authentification
checked
through command lines
- Retrieve auth token based on login/passowrd
curl https://chat.univ.fr/api/v1/login -d "username=superadmin&password=superpassword" | cut -d\" -f7-14
# {"userId":"XXXUserIDXXX","authToken":"XXXAuthTokenXXX"}
- Generate personal access token
curl -H "X-Auth-Token: XXXAuthTokenXXX" -H "X-User-Id: XXXUserIDXXX" -H "Content-type:application/json" https://chat.univ.fr/api/v1/users.generatePersonalAccessToken -d '{"tokenName": "moodletoken"}'
# {"token":"XXXPersonalTokenXXX","success":true}
- If you want to verify, you can list personal tokens
curl -H "X-Auth-Token: XXXAuthTokenXXX" -H "X-User-Id: XXXUserIDXXX" -H t-type:application/json" https://chat.univ.fr/api/v1/users.getPersonalAccessTokens
# {"tokens":[{"name":"moodletoken","createdAt":"2021-02-09T10:35:38.564Z","lastTokenPart":"XXX"}],"success":true}
- Generate a new token in case of lost
curl -H "X-Auth-Token: XXXAuthTokenXXX" -H "X-User-Id: XXXUserIDXXX" -H "Content-type:application/json" https://chat.univ.fr/api/v1/users.regeneratePersonalAccessToken -d '{"tokenName": "moodletoken"}'
# {"token":"XXXNewPersonalTokenXXX","success":true}
Installation
Moodle plugin
- Copy the Rocket.Chat plugin to the
mod
directory of your Moodle instance:
git clone https://github.com/EsupPortail/esup-mod_rocketchat MOODLE_ROOT_DIRECTORY/mod/rocketchat
- Visit the notifications page to complete the installation process
Settings
- recyclebin_patch check this if patch is applied to core moodle file admin/tool/recyclebin/classes/course_bin.php
- patch is available in patch subdirectory
- you can apply it with patch command
patch -p1 /moodlepath/admin/tool/recyclebin/classes/course_bin.php < /moodlepath//mod/rocketchat/patch/admin_tool_recyclebin_classes_course_bin.patch
patch -p1 /moodlepath/admin/tool/recyclebin/classes/category_bin.php < /moodlepath/mod/rocketchat/patch/admin_tool_recyclebin_classes_category_bin.patch
patch -p1 /moodlepath/user/classes/output/user_roles_editable.php < /moodlepath/mod/rocketchat/patch/user_classes_output_user_roles_editable.patch
Authentication settings
- apiuser will be rocket-chat userid
- apitoken a token generated on Rocket.Chat for the apiuser
- can be generated on Rocket.Chat for apiuser on Profile -> My Account -> Security -> Personal Access Tokens menu
- don't forget to enable create-personal-access-tokens permission for the apiuser through its role
Backup settings
On moodle 3.5 versions backup_auto_activities
backup settings must be checked otherwise Rocket.Chat module restoration from recycle bin will not work.
See MDL-6621 tracker ticket for more informations
Specials capabilities
- mod/rocketchat:change_embedded_display_mode : enable a user to choose embbeded Rocket.Chat web client display mode while eidting the module instance
- mod/rocketchat:candefineroles : enable a user to change defaults roles mapping while editing the module instance
Unit tests
settings
- in Rocket.Chat you must adjust the Rate Limiter to enable unit tests large amount of requests
- to run unit tests that involved Rocket.Chat remote server just create a config-test.php file into the module rocketchat root directory
- fill in with following parameters
<?php
set_config('instanceurl','https://rocketchat-server_url','mod_rocketchat');
set_config('restapiroot','/api/v1/','mod_rocketchat');
set_config('apiuser','your_user_on_rocket.chat','mod_rocketchat');
set_config('apitoken','#############','mod_rocketchat');
// fake config test to avoird email domain troubles
set_config('domainmail','your_domain_mail_if_necessary','mod_rocketchat'); // Optional argument.line.
requirements
Provided tests
- don't forget to init phpunit moodle tests environment (requirements)
cd /www_moodle_path
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_background_enrolments_testcase" mod/rocketchat/tests/backup_enrolments_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_backup_restore_testcase" mod/rocketchat/tests/backup_restore_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_course_reset_testcase" mod/rocketchat/tests/course_reset_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_observer_testcase" mod/rocketchat/tests/observer_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_api_manager_testcase" mod/rocketchat/tests/rocket_chat_api_manager_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_recyclebin_category_testcase" mod/rocketchat/tests/recyclebin_category_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_recyclebin_testcase" mod/rocketchat/tests/recyclebin_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_privacy_testcase" mod/rocketchat/tests/privacy_provider_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_tools_testcase" mod/rocketchat/tests/mod_rocketchat_tools_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_moderator_and_user_roles_testcase" mod/rocketchat/tests/moderator_and_user_roles_test.php
/www_moodle_path/vendor/bin/phpunit "mod_rocketchat_retention_testcase" mod/rocketchat/tests/retention_test.php
Functional tests with behat
Requirements
Settings
- see phpunit settings section
Provided tests
- don't forget to init behat moodle tests environment (requirements) ```shell script cd /www_moodle_path vendor/bin/behat --config /datas/mdlfarm/behat_datas/behatrun/behat/behat.yml --tags mod_rocketchat
for behat funcitonal tests by file
```shell script
cd /www_moodle_path
vendor/bin/behat --config /datas/mdlfarm/behat_datas/behatrun/behat/behat.yml /www_moodle_path/mod/rocketchat/tests/behat/rocketchat_activity_creation.feature
vendor/bin/behat --config /datas/mdlfarm/behat_datas/behatrun/behat/behat.yml /www_moodle_path/mod/rocketchat/tests/behat/rocketchat_create_deletion.feature
License
2020 ESUP-Portail (https://www.esup-portail.org)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Rocket.Chat moodle module ESUP team
- The Rocket.Chat moodle Esup team is composed of people from various places and from differents working domains.
- Pedagocical engineer
- System administrators
- Developpers
- Institutions
- Centrale Marseille
- Université de Lorraine
- Université de Strasbourg
- Université de technologie de Troyes
Version information
- Version build number
- 2021020800
- Version release name
- 1.2.5
- Maturity
- Stable version
- MD5 Sum
- 28ded89ba6c3086a3d2c06f887d99746
- Supported software
- Moodle 3.5, Moodle 3.8, Moodle 3.9
- The more recent release 1.4.5 (2022070300) exists for Moodle 3.5
- The more recent release 1.4.5 (2022070300) exists for Moodle 3.8
- The more recent release 1.4.5 (2022070300) exists for Moodle 3.9
Version control information
- Version control system (VCS)
- GIT
- VCS repository URL
Default installation instructions for plugins of the type Activities
- Make sure you have all the required versions.
- Download and unpack the module.
- Place the folder (eg "assignment") in the "mod" subdirectory.
- Visit http://yoursite.com/admin to finish the installation