Overview
Torii integrates with Moodle and syncs:
- Users (all accounts on your Moodle site, including suspended ones). The built-in guest account is not synced.
- Licenses
- You can constantly stay updated with application information from our Integrations Page >> Integration Capabilities button >> Integration Capabilities table.
Requirements
Accounts & Permissions
- A Moodle site administrator to enable web services and create the token.
- A Moodle user for Torii with a system role that has these capabilities: webservice/rest:use, moodle/user:viewdetails, moodle/user:viewalldetails and moodle/site:viewuseridentity. To use the actions, also add moodle/user:create and moodle/user:update. A site administrator account also works, but it gives Torii more access than it needs.
- Torii only syncs users whose email address the Torii user can see.
Required keys
To connect this integration, we require the following:
- Moodle site URL - the address of your Moodle site, starting with https:// and without a trailing slash, for example https://moodle.example.com.
- Web service token - a token for the Torii user and the external service you create below.
How to Generate the Required Values
Step 1: Enable web services and the REST protocol
- Log in to Moodle as a site administrator.
- Go to Site administration > Advanced features and turn on Enable web services. Save.
- Go to Site administration > Server > Web services > Manage protocols and enable REST protocol.
Step 2: Create a role and a user for Torii
- Go to Site administration > Users > Permissions > Define roles and click Add a new role.
- Name it, for example Torii, set Context types where this role may be assigned to System, and allow the capabilities listed under Requirements.
- Create a user for Torii (Site administration > Users > Add a new user).
- Go to Site administration > Users > Permissions > Assign system roles, choose the Torii role and add the Torii user.
Step 3: Create an external service
- Go to Site administration > Server > Web services > External services and click Add.
- Enter a name, for example Torii, check Enabled and Authorised users only, and click Add service.
- Click Add functions and add core_webservice_get_site_info and core_user_get_users. To use the actions, also add core_user_get_users_by_field, core_user_create_users and core_user_update_users.
- Back on the External services page, click Authorised users for the service and add the Torii user.
Step 4: Create the token
- Go to Site administration > Server > Web services > Manage tokens and click Create token.
- Select the Torii user and the Torii service. Leave Valid until empty, or choose a date. If the token expires, the integration stops syncing until you connect it again with a new token.
- Click Save changes and copy the token.
How to Connect the Integration
- Go to the Integrations page in Torii.
- Search for Moodle and click Connect.
- Enter the Moodle site URL and the Web service token.
- Click Connect.
Actions
Torii can perform the following actions in Moodle from workflows. The external service must include the action functions listed in Step 3, and the Torii role needs moodle/user:create and moodle/user:update.
- Create Moodle user - creates a user whose username is their email address in lower case. Moodle generates a password and emails it to the user.
- Suspend Moodle user - suspends the user so they can no longer log in. The account and its course data are kept.
- Change Moodle user status - sets the user to Active or Suspended.
Moodle blocks these actions on site administrator accounts unless the Torii user is also a site administrator.
For any further questions, please contact Torii Support.