Moodle

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.


1. Enable Web Services
  • Purpose: To use Moodle’s built-in API functions necessary for integration.

  • Steps:

    1. Navigate to Site Administration > Advanced Features.

    2. Ensure that Enable web services is checked.

2. Enable REST protocol
  • Purpose: For 3rd-party apps such as CodeChum to access your Moodle REST API Server.

  • Steps:

    1. Navigate to Server > Web Services > Manage protocols

    2. Ensure that REST protocol is enabled by toggling the eye icon.

3. Install Required Plugins
  • Plugins and its functions:

    1. CodeChum TokenManagement: Google Drive Link

      • Purpose: Manages user web service tokens by extending their validity and deleting them upon logout.

    2. CodeChum TeacherFunctions: Google Drive Link

      • Purpose: Contains custom functions to sync assignments between Moodle and CodeChum.

  • Steps:

    1. Go to Site Administration > Plugins > Install plugins.

    2. Upload and install the provided zip files for each plugin.

4. Configure Custom Services
  • Purpose: To create services that allow CodeChum to interact with Moodle for login and data syncing.

  • How to Create:

    1. Go to Site Administration

    2. In the search bar, type “External Services”

    3. In the “Custom Services”, click “Add”

    4. Below are the details for what external service to create.

    5. After you have created the two services, you can continue with the next step.

    6. CodeChum Student Service

      • Name: CodeChum Student Service

      • Short Name: codechum_student_service

      • Enabled:

      • Required Capability: mod/assign:submit

    7. CodeChum Teacher Service

      • Name: CodeChum Teacher Service

      • Short Name: codechum_teacher_service

      • Enabled:

      • Required Capability: moodle/course:manageactivities

5. Configure Custom Services
  • Purpose: To define specific API functions within the custom services.

  • API Functions:

    1. CodeChum Student Service

      • codechum_delete_token

      • codechum_refresh_token

      • core_webservice_get_site_info

      • core_enrol_get_users_courses

    2. 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:

    1. Go to Site Administration > Plugins > Web services > External services.

    2. Select the service you created and add the respective functions listed above.

6. Define Roles
  • Purpose: To ensure roles have the necessary capabilities for integration.

  • Steps to Edit Roles:

    1. Edit Student Role

      1. Go to Site Administration > Users > Permissions > Define roles.

      2. Select the Student role and edit as follows:

        • System Context: Check System under Context Types.

        • Capabilities:

          1. 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.

          2. Allow Use REST protocol:

            • Description: Enables web service functions.

    2. Edit Teacher Role

      1. Go to Site Administration > Users > Permissions > Define roles.

      2. Select the Teacher role and edit as follows:

        • System Context: Check System under Context Types.

        • Capabilities:

          1. 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.

          2. Allow Use REST protocol:

            • Description: Enables web service functions.

7. Assign System Roles
  • Purpose: To correctly assign users to their respective system roles for proper integration.

  • Steps:

    1. Go to Site Administration > Users > Permissions > Assign system roles.

    2. Assign the appropriate roles to users:

      • Students: Assign the Student role.

      • Teachers: Assign the Teacher role.

8. Gather Essential Data for CodeChum
  • Purpose: To set up the connection of CodeChum’s servers to Moodle

  • Steps:

    1. Go to Site Administration > Users > Permissions > Define roles.

    2. Click Student role.

    3. Copy the URL.

    4. Send the URL to [email protected] .

    5. 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.

Last updated