Administration & Security

Interview Questions: Roles, Auth, Enrolment, and Web Services

Q1: What is the difference between Authentication and Enrolment?

Authentication (Auth): Verifying who the user is (Logging in). Examples: Manual, LDAP, OAuth2.

Enrolment: Giving a user access to a specific course. Examples: Manual, Self, Cohort Sync.

Q2: Explain the concept of 'Context' in Moodle permissions.

Contexts are the levels at which roles can be assigned. They are hierarchical:

System > Category > Course > Module (Activity) > Block.

A permission granted at a higher level (e.g., Category) cascades down to lower levels (e.g., Course) unless overridden.

Q3: How do you enable the Moodle Mobile App for your site?

1. Go to Site administration > General > Advanced features and enable "Web services".

2. Go to Site administration > Mobile app > Mobile settings and enable "Enable web services for mobile devices".

3. Ensure the site is accessible via HTTPS.

Q4: What is a 'Cohort' and how is it different from a 'Group'?

Cohort: A site-wide or category-wide collection of users. Used for bulk enrolment into multiple courses (Cohort Sync).

Group: A collection of users within a specific course. Used to separate students for activities, grading, or visibility.

Q5: How would you debug a "White Screen of Death" in Moodle?

1. Check the web server error logs (Apache/Nginx logs).

2. Enable debugging in config.php:

$CFG->debug = 32767; // DEBUG_DEVELOPER
$CFG->debugdisplay = 1;

3. Purge caches via CLI: php admin/cli/purge_caches.php.

Q6: What are 'Scheduled Tasks' and how do you manage them?

Scheduled tasks are background jobs (like sending forum emails or syncing enrolments) that run via the system Cron.

You manage them in Site administration > Server > Tasks > Scheduled tasks. You can change their frequency (minute, hour, day) or run them immediately via the "Run now" link (if enabled) or CLI.

Q7: How do you restrict a course to a specific set of IP addresses?

There is no native "Course IP restriction" setting. However, you can:

1. Use a plugin like "Restrict by IP" availability condition.

2. Configure the web server (Nginx/Apache) to restrict access to the specific course URL pattern.

3. Use the "Require IP" setting in Quiz settings for assessments.

Q8: What is the purpose of 'Maintenance Mode'?

It prevents non-admin users from logging in or accessing the site. It is used during upgrades, backups, or server maintenance to ensure data consistency.

Enable via CLI: php admin/cli/maintenance.php --enable.

Q9: How do you add a new language pack to Moodle?

Go to Site administration > Language > Language packs. Select the language from the list and click "Install selected language pack". Moodle downloads it from the official repository to moodledata/lang.

Q10: What is a 'Web Service Token'?

A token is a unique string that acts as a key for an external application to access Moodle's API on behalf of a specific user. It replaces the need to send a username and password with every request.

Q10: How does the Backup and Restore system work?

Moodle's backup system serializes course data (activities, users, grades) into an .mbz file (a zipped XML structure). The restore process reads this file and recreates the course elements. It uses a controller-worker pattern and can be executed asynchronously.

Q11: What are some essential CLI commands for administrators?

  • php admin/cli/cron.php: Runs the cron tasks manually.
  • php admin/cli/purge_caches.php: Clears all Moodle caches.
  • php admin/cli/maintenance.php: Toggles maintenance mode.
  • php admin/cli/cfg.php: View or set configuration variables.

Q12: How do you reset a user's password from the command line?

You can use the admin/cli/reset_password.php script. Usage: php admin/cli/reset_password.php --username=admin --newpassword=NewPass123!. This is useful if the admin gets locked out.

Q11: How do you handle a user who has forgotten their password but the email is not arriving?

1. Check Site administration > Server > Email > Mail settings to ensure SMTP is configured correctly.

2. Check the "Mail" logs in Moodle or the server's mail log.

3. As an admin, you can manually reset their password in their profile settings.

Q12: What is the 'Guest' role?

The Guest role allows users to view course content without being enrolled or (optionally) without being logged in. Guests cannot post in forums, take quizzes, or receive grades.

Q13: How do you bulk upload users?

Use Site administration > Users > Accounts > Upload users. You upload a CSV file with columns like username, password, firstname, lastname, email. You can also include enrolment fields like course1, role1.

Q14: What is 'Role switching'?

It allows a user with higher permissions (like a Teacher or Admin) to temporarily view the course as a user with lower permissions (like a Student) to test visibility and access.

Q15: How do you backup a single course?

Go to the course, click "More" (or the gear icon) > "Course reuse" > "Backup". Follow the wizard to select which activities, blocks, and user data to include. The result is a .mbz file.

Q16: What is the 'Front Page' in Moodle context?

The Front Page is the landing page of the site (course ID 1). It has its own settings, roles, and backup procedure. It is technically a course but behaves differently regarding enrolments.

Q17: How do you force all users to change their password?

Go to Site administration > Users > Accounts > Bulk user actions. Select all users, then choose "Force password change" from the action dropdown.

Q18: What are 'Filters' in Moodle?

Filters process text content before it is displayed. Examples include:

  • Multimedia plugins: Converts URLs (like YouTube) into embedded players.
  • MathJax: Renders LaTeX equations.
  • Activity names auto-linking: Links text to activities with the same name.

Q19: How do you set the default timezone for the site?

Go to Site administration > Location > Location settings. Set the "Default timezone". Users can override this in their profile unless "Force timezone" is enabled.

Q20: What is 'Cron' and why is it critical?

Cron is a script (admin/cli/cron.php) that must be executed regularly (every minute) by the server. It handles forum emails, course completion calculations, backup tasks, and system cleanup. Without it, Moodle will not function correctly.

Q21: How do you transfer a Moodle site to a new server?

1. Put the site in Maintenance Mode.

2. Dump the database (SQL).

3. Copy the Moodle code directory.

4. Copy the moodledata directory.

5. Restore files and DB on the new server.

6. Update config.php with new paths/URLs.

7. Use the "Search and replace" tool (admin/tool/replace/index.php) if the URL changed.

Q22: What is 'Badges' in Moodle?

Badges are digital credentials compatible with the Open Badges standard. They can be awarded at the Site level (for system-wide criteria) or Course level (for completing activities or the course).

Q23: How do you manage 'Log stores'?

Go to Site administration > Plugins > Logging > Manage log stores. You can enable/disable stores like "Standard log" (DB), "Legacy log", or "External database log". Disabling unused stores improves performance.

Q24: What is the 'Recycle Bin'?

When enabled, deleted courses and activities are moved to the Recycle Bin for a configurable period (default 7 days) before being permanently deleted. This allows for restoration of accidental deletions.

Q25: How do you customize the 'User Profile' fields?

Go to Site administration > Users > Accounts > User profile fields. You can add custom fields (text, checkbox, dropdown, date) that appear on user profiles and signup forms.

Q26: What is 'Competency-based education' (CBE) in Moodle?

It allows you to define Competency Frameworks and link them to courses and activities. Students can be rated on competencies, and learning plans can be created to track progress.

Q27: How do you enable 'HTTPS' on Moodle?

1. Install an SSL certificate on the web server.

2. Change $CFG->wwwroot in config.php to use https://.

3. Run the "HTTP to HTTPS migration tool" (admin/tool/httpsreplace/index.php) to fix embedded content links.

Q28: What is 'External Services' security?

When using Web Services, you should:

1. Create a specific user for the service.

2. Create a custom Role with only the required capabilities.

3. Enable "IP restriction" for the token if possible.

4. Set an expiration date for the token.

Q29: How do you view 'Site-wide reports'?

Go to Site administration > Reports. Useful reports include:

  • Logs: Activity logs.
  • Live logs: Real-time activity.
  • Performance overview: System health check.
  • Security overview: Security configuration audit.

Q30: What is the 'XMLDB Editor'?

A developer tool built into Moodle (Site administration > Development > XMLDB editor) used to create and edit install.xml files for plugins. It helps define database tables in a DB-agnostic way.