Skip to content

Moodle‐Configuration

Martin edited this page Jun 20, 2024 · 4 revisions

Following settings must be made to the Moodle installation for the eTutor Task Synchronization to work:

Moodle Configuration

Execute following steps as Moodle administrator in the Moodle System:

  1. Enable web services: Activate "Enable web services" in Site Administration > General > Advanced Features
  2. Enable REST protocol: Activate "REST protocol" in Site Administration > Server > Web services > Manage Protocols
  3. Create REST user: Create a user that is allowed to call the REST endpoints.
    1. Add a new role in Site Administration > Users > Permissions > Define roles
      • Use role or archetype: No role
      • Short name: web_service
      • Custom full name: Web Service
      • Custom description: Web Service for eTutor Task Administration
      • Role archetype: None
      • Context types where this role may be assigned: System
      • Allow role assignments: Nothing
      • Allow role overrides: Nothing
      • Allow role switches: Nothing
      • Allow role to view: Nothing
      • Capabilities: Allow
        • webservice/rest:use
        • moodle/category:manage
        • moodle/category:viewhiddencategories
        • moodle/question:managecategory
        • moodle/question:add
        • moodle/question:editall
        • moodle/question:moveall
        • moodle/question:viewall
    2. Create user in Site Administration > Users > Accounts > Add a new user
      • Username: etutor_sync
      • Choose an authentication method: Manual account
      • Password: some secure password
      • Force password change: false
      • First name: Sync
      • Last name: eTutor
      • Email address: a unique, working email address
      • Email visibility: Hidden
    3. Add user to role in Site Administration > Users > Permissions > Assign system roles
      • Assign the previously created etutor_sync user to the previously created web_service role.
  4. Add custom external service in Site Administration > Server > Web services > External services
    1. Add service
      • Name: eTutor Sync
      • Short Name: etutor_sync
      • Enabled: true
      • Authorised users only: true
    2. Add functions in Site Administration > Server > Web services > External services > Functions
      • core_course_create_categories
      • core_course_get_categories
      • core_course_update_categories
      • local_etutorsync_create_question_category
      • local_etutorsync_update_question_category
      • local_etutorsync_create_question
      • local_etutorsync_deprecate_old_question
      • local_etutorsync_update_question
    3. Add user in Site Administration > Server > Web services > External services > Authorised users
      • Add the previously created etutor_sync user.
  5. Enable "Multi-language content" filter in Site Administration > Plugins > Filters > Manage Filters
  6. Disable "Convert URLs into links and images" filter in Site Administration > Plugins > Filters > Manage Filters
  7. Create Role "Question Viewer" in Site Administration > Users > Permissions > Define roles
    1. Add a new role in Site Administration > Users > Permissions > Define roles
      • Use role or archetype: No role
      • Short name: Question Viewer
      • Custom full name: Question Viewer
      • Custom description: Allows teachers to view questions from course categories
      • Role archetype: None
      • Context types where this role may be assigned: System, Category
      • Allow role assignments: Nothing
      • Allow role overrides: Nothing
      • Allow role switches: Nothing
      • Allow role to view: Nothing
      • Capabilities: Allow
        • moodle/question:useall
        • moodle/question:viewall
    2. Assign roles to users in Home > All Courses
      1. Click on the requested course category
      2. Click on More > Permissions
      3. In the dropdown select Assign roles
      4. Click on Question Viewer
      5. Add the users that should be able to view questions

Task-Administration Configuration

  1. In the Moodle System create a web service token. As administrator open Site Administration > Server > Web services > Manage tokens
    • Name: etutor_task_administration
    • User: The previously created etutor_sync user.
    • Service: The previously created custom web service etutor_sync.
    • IP restriction: enter if required
    • Valid until: set as required
  2. Set following settings in the applications' application-[dev|prod].yml file or the corresponding environment variable.
    • moodle.token: The token created in the previous step.
    • moodle.url: The URL to the moodle server (e.g. http://localhost:8000/).

Clone this wiki locally