Skip to content

Manual Configuration

This plugin requires the creation of a dedicated Moodle user and role, as well as the setup of the Moodle webservices for the archive worker.

Warning

This is the manual configuration process which can be quite involved. Please only use the manual configuration if you consider yourself an advanced user / Moodle administrator.

Automatic Configuration     Most users want to use the automated configuration instead.

Create Moodle User and Role

At first, a new Moodle user and a global role need to be created for the Quiz Archiver. It will be used by the archive worker service to access quiz data.

Create a designated Moodle user for the quiz archiver webservice

  1. Navigate to Site Administration > Users (1) > Accounts > Add a new user (2)
  2. Set a username (e.g. quiz_archiver) (3), a password (4), first and lastname (5), and a hidden email address (6)
  3. Create the user (7)

Screenshot: Configuration - Create Moodle User 1 Screenshot: Configuration - Create Moodle User 2

Create a global role to handle permissions for the quiz_archiver Moodle user

  1. Navigate to Site Administration > Users (1) > Permissions > Define roles (2)
  2. Select Add a new role (3)
  3. Set Use role or archetype (4) to No role
  4. Upload the role definitions file from res/moodle_role_quiz_archiver.xml (5). This will automatically assign all required capabilities1.
  5. Click on Continue (6) to import the role definitions for review
  6. Optionally change the role name or description and create the role (7)

Screenshot: Configuration - Create Role 1 Screenshot: Configuration - Create Role 2 Screenshot: Configuration - Create Role 3 Screenshot: Configuration - Create Role 4

Assign the quiz_archiver Moodle user to the created role

  1. Navigate to Site Administration > Users (1) > Permissions > Assign system roles (2)
  2. Select the Quiz Archiver Service Account role (3)
  3. Search the created quiz_archiver Moodle user (4), select it in the list of potential users (5), and add it to the role (6)

Screenshot: Configuration - Assign Role 1 Screenshot: Configuration - Assign Role 2 Screenshot: Configuration - Assign Role 3

Setup Webservice

The quiz archive worker service interacts with the Moodle platform using the Moodle webservice API. Therefore, it must be enabled and a corresponding external service must be created.

Enable webservices globally

  1. Navigate to Site Administration > Server (1) > Web services > Overview (2)
  2. Click on Enable web services (3), check the checkbox (4), and save the changes (5)
  3. Navigate back to the Overview (2) page
  4. Click on Enable protocols (6), enable the REST protocol (7), and save the changes (8)

Screenshot: Configuration - Enable Webservices 1 Screenshot: Configuration - Enable Webservices 2 Screenshot: Configuration - Enable Webservices 3 Screenshot: Configuration - Enable Webservices 4

Create an external webservice for the quiz archive worker to use

  1. Navigate to Site Administration > Server (1) > Web services > External services (2)
  2. Under the Custom services section, select Add (3)
  3. Enter a name (e.g. quiz_archiver) (4) and enable it (5)
  4. Expand the additional settings (6), enable file up- and download (7)
  5. Create the new webservice by clicking Add service (8)

Screenshot: Configuration - Create Webservice 1 Screenshot: Configuration - Create Webservice 2 Screenshot: Configuration - Create Webservice 3

Add all quiz_archiver_* webservice functions to the quiz_archiver external service

  1. Navigate to Site Administration > Server (1) > Web services > External services (2)
  2. Open the Functions page for the quiz_archiver webservice (3)
  3. Click the Add functions link (4)
  4. Search for quiz_archiver (5) and add all quiz_archiver_* functions
  5. Save the changes by clicking Add functions (6)

Screenshot: Configuration - Assign Webservice Functions 1 Screenshot: Configuration - Assign Webservice Functions 2 Screenshot: Configuration - Assign Webservice Functions 3 Screenshot: Configuration - Assign Webservice Functions 4

Configure Plugin Settings

Once the user, role, and webservice are created, the last step is to configure the quiz archiver plugin to use the created webservice and user.

  1. Navigate to Site Administration > Plugins (1) > Activity modules > Quiz > Quiz Archiver (2)
  2. Set worker_url (3) to the URL under which the quiz archive worker can be reached (e.g., http://quiz-archive-worker:5000 or http://127.0.0.1:5000)
  3. Select the previously created quiz_archiver webservice for webservice_id (4) from the drop-down menu
  4. Enter the user ID of the previously created Moodle user for webservice_userid (5). It can easily be found by navigating to the users profile page and inspecting the page URL. It contains the user ID as the id query parameter.
  5. (Optional) Specify a custom job timeout in minutes
  6. (Optional) Specify a custom Moodle base URL2.
  7. Save all settings and create your first quiz archive (see Usage).
  8. (Optional) Adjust the default capability assignments.

Screenshot: Configuration - Plugin Settings 1 Screenshot: Configuration - Plugin Settings 2

Next Steps

You finished the initial configuration of the quiz archiver plugin. You now can either directly start archiving quizzes (see Usage) or adjust the default plugin settings (see Job Presets / Policies).

Usage       Job Presets


  1. You can check all capabilities prior to role creation in the next step or by manually inspecting the role definition XML file (res/moodle_role_quiz_archiver.xml). 

  2. This is only required if you run the quiz archive worker in an internal / private network, e.g., when using Docker. If this setting is present, the public Moodle $CFG->wwwroot will be replaced by the internal_wwwroot setting. Example: https://your.public.moodle/ will be replaced by http://moodle.local/