Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Assign roles.

Assign roles

From MoodleDocs

This page requires updating for Moodle 2.0. Please do so and remove this template when finished.

Context and roles

Update for 2.0 Assign roles in Moodle 1.9

Assigning roles is done for/in a particular context. A site and course are examples of two different contexts. While the process is similar for each context, the steps to get to the role assignment page for each context may be different. Here are several contexts and ways to find the assign role page.

  • System context: 1.9Site Administration > Users > Permissions > Assign system roles
  • Front page context: 1.9Site Administration > Front Page > Front Page roles
  • Course category context: 1.9 Assign roles link in course categories page
  • Course context: 2.x Settings>Course administration>Enrolled users. Find enrolled user, click on Assign Role button in Roles column for the user. Select the role for that user.
When initally enrolled, users default to student. You may wish to delete the student role from the user you have given the teacher role.
  • Block context: 1.9 Assign roles link in course block (with editing turned on)
  • User context: 1.9 Roles tab in user profile page

The assign roles page lists the names of users assigned to each role (unless there are more than 10 users, in which case this is stated).


By assigning a role to a user in a certain context, you grant them the permissions contained in that role for the current context and all lower contexts.

The list of contexts in hierarchical order is as follows:

Update for 2.0 A diagram of the contexts in Moodle. Click on the diagram to see a more detailed view of it.
  • System (no parent)
  • Front page (parent = system) -
  • Course category (parent = parent category or system)
  • Course (parent = category or system)
  • Module (parent = course or system)
  • Block (parent = course or system)
  • User (parent = system)

Roles can be inherited. For example if a user is assigned a Teacher role in a specific course category then the user will have this role in ALL courses within the category. Tip: use the override feature in a specific context for exceptions.

Roles will only work if the role assignment is made in the correct context. Some examples: a Teacher role should be assigned to a user in the course or course category context, a Forum moderator for a particular forum should be assigned in that specific forum.

The Inspector role is an example of a role assigned in the system context. The Forum moderator role is an example of a role assigned in the module context. The Parent role is an example of a role assigned in the user context.

Assigning a role

Update for 2.x Assigning users the role of student i.e. enrolling them on the course

"Student", "Teacher", "Course Creator" are some of the predefined roles that come with Moodle. The site administrator may have created additional roles.

To assign a role:

  1. Choose the type of role you wish to assign. For example, if we wanted to assign a Student role to Martin, we'd choose "Student" from the list of roles.
  2. Once you have chosen a role, two lists appear: a list of users who currently have that role (Student Demo in the example), and a list of users who don't. We can select Martin in the second list, and use the left-facing arrow button to add Martin to the list of Students. Multiple users may be selected by holding down the Apple or Ctrl key whilst clicking on the users' names.

Removing someone from a role is done by moving the user from the left column to the right.

Hidden roles

If you want to provide users with access to the course, but don't want them to be visible in the participants list, use the "other users" link in the course administration menu (Course Administration -> Users->Other Users). Assigning roles here provides course access, and editing rights according to the permissions set for the role assigned without actually enrolling the user in the course. Only roles with the capability 'moodle/course:view' may be assigned. This is similar to the functionality of the "hidden user" check box in previous versions of moodle.

Enabling teachers to assign the role of teacher

By default, teachers are only allowed to assign the roles of non-editing teacher, student and guest. To enable teachers to assign the role of teacher:

  1. Access Administration > Users > Permissions > Define roles.
  2. Click the tab "Allow role assignments".
  3. Click the checkbox where the teacher row and column intersect.
  4. Click the "Save changes" button.

Beware of assignments that don't make sense

There are many role assignments that do not make sense as the underlying functionality does not exist. Just because you give someone the "right" to do something does not guarantee that the interface or facility actually exists within the context that you have assigned that right. For example, you can assign a user the right to create new categories in the category context, however there is no interface within Moodle to do that (category creation is only available at the system level).

Note: Users should only be assigned the role of administrator (i.e. a role with the capability moodle/site:doanything set to allow) in the system context. Users should only be assigned the role of course creator in the system or a course category context.

Multiple assignments

A significant part of the roles infrastructure is the ability to assign a user into multiple roles (at the same time). The capabilities of each role are merged to produce the effective set of capabilities. In particular it is perfectly possible for a user to be both a Teacher and Student in the same course. This differs from the behavior of Moodle prior to the introduction of roles. You should be careful to ensure that if you change a user's role that you remove them from any other roles as required as this will no longer be done automatically.

System roles

Roles assigned in the system context are called system roles and apply across the entire site, including the front page. For example, a user assigned the system role of teacher will have this role in every course on the site.

In many sites only admins and course creators will be assigned system roles.

The Blogger role is an example of a system role.

Front page roles

You can assign roles and set up role overrides for your front page in exactly the same way as for a course.

There are various ways of enabling logged-in users to participate in front page activities, depending on your Moodle version. See the Roles FAQ for details.

Assigning a role for a front page activity

In versions of Moodle prior to 1.9.4, only users who are assigned front page roles appear in the list of potential users when assigning a role for a front page activity.

To assign a user a role for a front page activity:

  1. Assign the user a front page role, such as student, in Administration > Front Page > Front Page roles.
  2. Click the "Locally assigned roles" tab in editing activity page for the front page activity.
  3. Choose the type of role you wish to assign.
  4. Use the left-facing arrow button to add a particular user to the list of users with the role.

If a user is unassigned from a front page role AFTER being assigned a role for a front page activity, they remain assigned the role for the front page activity.

See also

Using Moodle forum discussions: