Moodle
Last updated
Last updated
This guide provides detailed instructions for Moodle administrators on how to integrate Moodle with CodeChum using web services. Follow these steps to ensure a smooth setup.
Purpose: To use Moodle’s built-in API functions necessary for integration.
Steps:
Navigate to Site Administration > Advanced Features.
Ensure that Enable web services is checked.
Purpose: For 3rd-party apps such as CodeChum to access your Moodle REST API Server.
Steps:
Navigate to Server > Web Services > Manage protocols
Ensure that REST protocol is enabled by toggling the eye icon.
Plugins and its functions:
CodeChum TokenManagement: 1HX-c2B5zKQWCSwyzaPIe9RxBKNYdKtWo
Purpose: Manages user web service tokens by extending their validity and deleting them upon logout.
CodeChum TeacherFunctions: 1FysFqhCFQLCv_u0exUekS3OA4xcL_4Pz
Purpose: Contains custom functions to sync assignments between Moodle and CodeChum.
Steps:
Go to Site Administration > Plugins > Install plugins.
Upload and install the provided zip files for each plugin.
Purpose: To create services that allow CodeChum to interact with Moodle for login and data syncing.
How to Create:
Go to Site Administration
In the search bar, type “External Services”
In the “Custom Services”, click “Add”
Below are the details for what external service to create.
After you have created the two services, you can continue with the next step.
CodeChum Student Service
Name: CodeChum Student Service
Short Name: codechum_student_service
Enabled: ✓
Required Capability: mod/assign:submit
CodeChum Teacher Service
Name: CodeChum Teacher Service
Short Name: codechum_teacher_service
Enabled: ✓
Required Capability: moodle/course:manageactivities
Purpose: To define specific API functions within the custom services.
API Functions:
CodeChum Student Service
codechum_delete_token
codechum_refresh_token
core_webservice_get_site_info
CodeChum Teacher Service
codechum_delete_token
codechum_refresh_token
codechum_create_assignment
codechum_update_assignment
core_webservice_get_site_info
core_enrol_get_users_courses
core_course_get_courses_by_field
core_user_get_users_by_field
mod_assign_save_grades
enrol_manual_enrol_users
enrol_manual_unenrol_users
core_enrol_get_enrolled_users_with_capability
Steps:
Go to Site Administration > Plugins > Web services > External services.
Select the service you created and add the respective functions listed above.
Purpose: To ensure roles have the necessary capabilities for integration.
Steps to Edit Roles:
Edit Student Role
Go to Site Administration > Users > Permissions > Define roles.
Select the Student role and edit as follows:
System Context: Check System under Context Types.
Capabilities:
Allow Create a web service token:
Description: Enables login via CodeChum.
Risk Management: Only create tokens for a specific service; tokens are encrypted and handled securely.
Allow Use REST protocol:
Description: Enables web service functions.
Edit Teacher Role
Go to Site Administration > Users > Permissions > Define roles.
Select the Teacher role and edit as follows:
System Context: Check System under Context Types.
Capabilities:
Allow Create a web service token:
Description: Enables login via CodeChum.
Risk Management: Only create tokens for a specific service; tokens are encrypted and handled securely.
Allow Use REST protocol:
Description: Enables web service functions.
Purpose: To correctly assign users to their respective system roles for proper integration.
Steps:
Go to Site Administration > Users > Permissions > Assign system roles.
Assign the appropriate roles to users:
Students: Assign the Student role.
Teachers: Assign the Teacher role.
Purpose: To set up the connection of CodeChum’s servers to Moodle
Steps:
Go to Site Administration > Users > Permissions > Define roles.
Click Student role.
Copy the URL.
Send the URL to [email protected]
.
Once you receive confirmation that everything is set up correctly, the integration process is complete.
By following these steps, Moodle administrators can effectively integrate their Moodle system with CodeChum, enabling seamless data syncing and user authentication. If you encounter any issues, refer to the API documentation available on your Moodle site or contact the support team for further assistance.