How to Create Authorized Users for an External Service On Moodle
While setting up Edwiser Bridge, you will have to configure your Moodle website to work with the plugin. One of the steps involved in this process is creating an external web service on Moodle. Here, you have to allow only authorized users to access the external web service and we have mentioned it in the user guide.
An often asked question by users at this point of the setup process is how to create authorized users and assign to them the required capabilities. Here’s taking you quickly through the process of doing the same.
Steps to Create Authorized Users for an External Service on Moodle
You will have to go through the following steps to create authorized users for an external service on Moodle
Step 1: Create a New User Role in Moodle
- The first step would be to create a role and assign the required capabilities to the user role. To do so you will have to login to your Moodle website as ‘Admin’. Once logged in go to ‘Home’ → ‘Site Administration’ → ‘Users’ → ‘Permissions’ → ‘Define Role’ and click on the ‘Add a new role’ button.
- Once here click the continue button and navigate to the next screen. DO NOT select anything from the ‘Use role or archetype’ drop-down list or upload any file to the ‘User role preset’ field.
- Now add a ‘Short name’ and ‘Custom full name’ to the respective fields.
- The next step would be to assign required capabilities to the user role. These capabilities assigned will be as follows and can be found lower on the page. While assigning capabilities, the ‘Allow’ option will have to be selected in the ‘Permissions’ columns alongside the respective capability.
Capabilities to be Assigned to the User Role-
- View suspended users
- Create users
- Update user profiles
- Create a web service token
- See hidden categories
- Enrol users
- Unenrol users from the course
- Unenrol self from the course
- Update course settings
- Enable/disable email address
- View courses without participation
- View hidden courses
- View participants
- View user profiles
- View hidden details of users
Web service: REST protocol
- Use REST protocol
Web service: SOAP protocol
- Use SOAP protocol
Here’s how it should look once you have created the user role…
Step 2: Assign User Role Created in Step 1 to a User
- The next step would be to assign the user role created in step 1 to a user on the Moodle website. If you haven’t created any users yet you can do so by navigating to ‘Home’ → ‘Site Administration’ → ‘Users’ → ‘Accounts’ → ‘Add a new user’.
- Now go to ‘Home’ → ‘Site Administration’ → ‘Users’ → ‘Permissions’ → ‘Assign system roles’. Select the role you want to assign to a particular user.
- Once here select users from the ‘Potential users’ field and add it to the ‘Existing users’ list. If there are many users on your website then the ‘Potential users’ list will not be populated. In that case, you will have to use the search field provided.
With that last bit, you have finished the process of creating authorized users. Now when you create an external web service and check the ‘Authorised users only’ field, only users that you assigned to the newly created user role will be allowed to generate a token for this service.
If you are done creating authorized users then you can go back to set up the Edwiser Bridge plugin. If you still have doubts get in touch with our Edwisers and they will help you out. 🙂
2 thoughts on “How to Create Authorized Users for an External Service On Moodle”
I followed this to the letter, but couldn’t get the Connection to work between WordPress Moodle.
I am getting this error:
You cannot execute functions in the course context (course id:1). The context error message was: Course or activity not accessible.
Ofcourse I also added the required functions highlighted in the documentation: https://edwiser.org/bridge/documentation/
Can’t seem to figure out what capability am I missing, have you tested this on a non-admin user?