Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Assign roles.
Locations that assign roles
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 approach to role assignment page may be different. Here are several contexts and ways to find the assign roles.
- System context: Administration > Users > Permissions > Assign global roles (this context is named "site" in Moodle 1.7)
- Site context: Administration > Front Page > Front Page roles (from Moodle 1.8 onwards)
- Course category context: Assign roles link in course categories page
- Course context: Assign roles link in course administration block
- Module context: Roles tab in editing activity page
- Block context: Assign roles link in course block (editing on)
- User context: Roles tab in user profile page
Template:Moodle 1.9In Moodle 1.9 onwards, 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:
- System (no parent)
- Site (parent = system) - Moodle 1.8 onwards
- Course category (parent = system)
- Course (parent = category or system)
- Module (parent = course or system/site(1.8 onwards))
- Block (parent = course or system/site(1.8 onwards))
- User (parent = system)
Inheritance will kick in if a role is assigned at a higher level. For example if a user is assigned a Teacher role in a particular course category then the user will have this role in ALL courses within the category.
Roles will only work if the role assignment is made in the correct context. For example, a Teacher role should be assigned in the course or course category context, a Forum moderator for a particular forum should be assigned in the module context.
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
To assign a role:
- 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.
- 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.
To hide which role a user is assigned to, click the Hidden assignments check box before assigning the role to the user. This feature is useful for example if you don't want everyone with teacher rights listed in the course description.
Note: The role assignment is not hidden from admins or teachers i.e. users with the viewhiddenassigns capability.
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:
- Access Administration > Users > Permissions > Define roles.
- Click the tab "Allow role assignments".
- Click the checkbox where the teacher row and column intersect.
- 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 at the Category context, however there is no interface within Moodle to do that (category creation is only available at the site level).
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.
Roles assigned in the site (1.7) or system context (1.8 onwards) are called global roles and apply across the entire site, including the front page. For example, a user assigned the global role of Teacher will have this role in every course on the site.
In many sites only admins and course creators will be assigned global roles.
The Demo teacher Restricted user role is an example of a global 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.
To enable users to engage in front page activities, you need to either assign all users the front page role of student or set up authenticated user overrides. For example, if you want users to be able to view forum discussions and reply to posts, you can override the authenticated user role and allow these permissions.
- Manage roles - for administrators
- Using Moodle Discrepancies between Assign Roles lists and Participants list and What happens if a user has multiple roles in a course? forum discussions