Course list viewer role

From MoodleDocs


The Course list viewer role may be used to restrict or allow course categories and the courses within them to be viewed by selected users.

By default, the Authenticated user role can see the list of all courses because the capability moodle/category:viewcourselist is allowed.

If the capability is removed globally from the authenticated user, then the Course list viewer role may be assigned to users allowed to view courses in particular categories.

Common scenarios

There are four common ways to use this permission to allow all or only certain to users to see all the courses in the courses or only those they are enrolled in.

Scenario 1 - All users see all available courses in the course list

This is the Moodle system default, which sets the capability moodle/category:viewcourselist too Allow for the role of Authenticated user. You should not need to make any changes.

Scenarios 2 - All users see only the courses they are enrolled in

In this case, you want to edit the role Authenticated user, following the instructions below, and instead of setting the permission to Allow, set it to Prohibit. All users will then only see the courses on the course list that they are enroled in.

Scenario 3 - Most users can see all courses but some select users see only their enrolled courses

In this case you will leave the Authenticated user role as its default and the will create a system level role for the users who are the exception.

  1. From 'Site administration / Users / Permissions / Define roles' and click the "Add a new role" button.
  2. For archetype role choose "No role."
  3. Give the role a short name such as "Enrolled Course list viewer", but it can be anything appropriate.
  4. Give the role a custom full name such as "Enrolled Course list viewer", but it can be anything appropriate.
  5. Find and the capability moodle/category:viewcourselist and set the permissions to Prohibit.
  6. Check the "System" context.
  7. Save the role
  8. From 'Site administration / Users / Permissions / Assign system roles' add all the users who should have this new role.

Scenarios 4 - Most users can see only their enrolled courses but some select users can see all

In this case, you first two steps:

  1. Take away the permission to see all courses from the Authenticated users as just explained above. Then you will similar
  2. Then create a new role for those who have the permission set to Allow and assign it following the general steps below.


Tip: You do not need to do this for Administrators who can see everything anyway.

Steps for Creating a new role

In general for other scenarios (such as Guest or Category special viewin, you can use these steps as a guide. The principle in all cases is the same: set the permission to Allow for the role to see all courses and to Prohibit to restrict them to only their own, enroled courses.

  1. From 'Site administration / Users / Permissions / Define roles', edit the Authenticated user role to prevent the capability moodle/category:viewcourselist
  2. Do the same for the Guest role
  3. From 'Site administration / Users / Permissions / Define roles' and click the "Add a new role" button.
  4. For archetype role choose "No role."
  5. Give the role a short name such as "Course list viewer", but it can be anything appropriate.
  6. Give the role a custom full name such as "Course list viewer", but it can be anything appropriate.
  7. Find and allow capability moodle/category:viewcourselist for this role
  8. To allow users to view courses in all categories, check the "System" context. Or...
  9. To allow users to view courses in specific categories, check the "Category" context

Assigning the role to users

  1. For the system context role (allowing users to see all course categories) go to 'Site administration / Users / Permissions /Assign system roles
  2. Click the link Course list viewer and move your selected users from the right box to the left box. Or...
  3. For the category context role (allowing users to see courses in a particular category) go to 'Site administration / Courses / Manage course and categories'
  4. In the course categories list, click the arrow next to the cog icon to access the Assign roles link.
  5. Click the link Course list viewer and move your selected users from the right box to the left box.
DocsAssignCategoryRole.png