Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Managing roles.

Managing roles: Difference between revisions

From MoodleDocs
(→‎Permissions: add image as example 1.8)
m (→‎Allow role to view: removing new in 3.5)
 
(78 intermediate revisions by 18 users not shown)
Line 1: Line 1:
{{Roles}}
{{Roles}}
Location: ''Administration > Users > Permissions > Define roles''
Managing overall role capabilities can be done by an administrator using  ''Administration > Site administration > Users > Permissions > Define roles''.  This is the place to add custom roles or modify existing roles.  The "Manage roles" tab, allows the system administrator to edit any one of over 350 different capabilities associated with any role.  The "Allow role assignments", "Allow role overrides" and "Allow role switches" contain a matrix which give the ability for a specific role to work with other specific roles.


Moodle comes with 7 predefined roles:
==Manage roles==
*[[Assign administrators|Administrator]]
*[[Course creator]]
*[[Teacher]]
*[[Teacher#Non-editing teacher| Non-editing teacher]]
*[[Student]]
*[[Guest access|Guest]]
*[[Authenticated user]] (from 1.8 onwards)


Each role may be edited via the link next to its name.
The 'Manage roles' tab contains a list of roles on your site. The edit column contains icons for editing, deleting roles and copying roles, and for moving them up or down in the list (affecting the way that roles are listed around Moodle).


[[Image:Allowroletoview.png]]


==Permissions==
To edit a role:
#Go to ''Administration > Site administration > Users > Permissions > Define roles''.
#Click the edit icon opposite the role you want to edit. For example "student".
#On the editing role page, change permissions as required for each capability.
#Scroll to the bottom of the page and click the "Save changes" button.


Permissions are settings for specific capabilities. There are four values:
See [[Creating custom roles]] for information about adding a new role and creating a duplicate role.
[[Image:Administration Block Site Roles detail.JPG]]


;Not Set (formerly Inherit)
==Role name localisation==
:This is the default value for all permissions when a new role is created. It means "use whatever setting the user already has". To determine what permission the user already has, Moodle searches upward through the nested contexts, looking for an explicit value (Allow, Prevent, Prohibit) for this capability.  For example, if a role is assigned to a user in a course context, and some capability has a value of 'Not set,' then the actual permission will be whatever the user has at the category level, or (failing to find an explicit permission at the category level) at the site level.  Note that the search terminates when an explicit permission is found.  If no explicit permission is found, then the value in the current context becomes Prevent.


;Allow
If a standard role name or description is empty Moodle uses a default string from the current language pack. Custom roles can be customised using multilang syntax.
:By choosing this you are granting permission for this capability to people who are assigned this role. This permission applies for the context that this role gets assigned plus all "lower" contexts. For example, if this role is a student role assigned to a course, then students will be able to "start new discussions" in all forums in that course, unless some forum contains an override or a new assignment with a Prevent or Prohibit value for this capability.


;Prevent
You may also override the role names separately in each course.
:By choosing this you are removing permission for this capability, even if the users with this role were allowed that permission in a higher context.


;Prohibit
==Resetting a role==
:This is rarely needed, but occasionally you might want to completely deny permissions to a role in a way that can NOT be overridden at any lower context. An example of when you might need this is when an admin wants to prohibit one person from starting new discussions in any forum on the whole site. In this case they can create a role with that capability set to "Prohibit" and then assign it to that user in the site context.


Permissions at a "lower" context will generally override anything at a "higher" context (this applies to overrides and assigned roles). The exception is Prohibit which can not be overridden at lower levels.
To reset a role back to the default permissions:
#Go to ''Administration > Site administration > Users > Permissions > Define roles''.
#Click on the name of the role, for example "student".
#Click the 'Reset' button.


If two roles are assigned to a person in the same context, one with Allow and one with Prevent, which one wins? In this case, Moodle will look up the context tree for a "decider".
Note that if you have students who have been given extra permissions at course and/or activity levels (such as forum ratings), then they will no longer be able to do this once the role has been reset to its default. A teacher would need to go back and set up these extra permissions in the course/activity levels again.


For example, a student has two roles in a course, one that allows them to start new discussions, one that prevents them. In this case, we check the categories and the site contexts, looking for another defined permission to help us decide. If we don't find one, then permission is Prevent by default (because the two settings cancelled each other out, and thus they have no permission).
==Allow role assignments==


==Legacy role types==
The "Allow role assignments" tab allows (or does not allow) a specific role to be able to assign specific roles to a user.


* Legacy role types were implemented for backward compatibility.
* Selecting a legacy role type in 1.8 (or allowing a legacy capability in 1.7) does NOT provide a new role with all capabilities of a pre-Moodle 1.7 role.
*It is recommended that a legacy role type is selected only for roles that are similar to pre-Moodle 1.7 student/teacher/admin/creator roles.
* It is not necessary to select a legacy role type unless using old 3rd party code that was not designed for Moodle 1.7 and doesn't yet support roles.


==Adding a new role==
===Enabling teachers to assign other teachers===
By default, teachers can only assign other users the roles of non-editing teachers, students and guests. If you want teachers to be able to assign other teachers in their course, you can allow the role assignment:


#Give the role an appropriate name. If you need to name the role for multiple languages you can use [[Multi language content|multi-lang syntax]] if you wish, such as <code><nowiki><span lang="en" class="multilang">Teacher</span> <span lang="es_es" class="multilang">Profesor</span></nowiki></code>. If multi-lang syntax is used then ''Filter all strings'' should be set in [[Filter settings]].
#Click on ''Administration > Site administration > Users > Permissions > Define roles''.
#Give the role a meaningful short name. The short name is necessary for other plugins in Moodle that may need to refer to the role (e.g. when uploading users from a file or setting enrolments via an enrolment plugin).
#Click the Allow role assignments tab.
#Optional: Give the role a description so that everyone has a common understanding of it.
#Click the checkbox where the teacher row and column intersect.
#Click the "Save changes" button.


==Creating a duplicate role==
==Allow role overrides==
{{Moodle 1.8}}
The "Allow role overrides" tab allows (or does not allow) a specific role to be able to override specific roles for a user.  For example, it might allow a teacher role to override a student's role to a non-editing teacher's role.  
In Moodle 1.8 onwards, a new role may be quickly created my making a copy of an existing role.   An administrator will find this in the Admin block, under Users, Permissions and Defined roles.
   
#Click on the role to be duplicated. For example "Guest".
#Click the "Duplicate role" button near the top of the "View role details" page.
#Answer '''Yes''' to the question "Are you sure you want to duplicate the role ...?"
#The list of roles will now show the "... copy 1" at the bottom. For example "Guest copy 1". 
#Edit the duplicated role to meet your needs.


==Testing a new role==
:Note that the settings only apply to roles that have the capabilities [[Capabilities/moodle/role:override|moodle/role:override]] or [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] allowed.


#Create test user and assign new role to them.
==Allow role switches==
#Either logout as admin and then login as test user or use a different browser to login as test user.
The "Allow role switches" tab allows (or does not allow) a specific role to be able to temporarily change their role to another specific role. For example, this might allow a users assigned to a custom role in a course to see "Student" in the Settings > Switch role list.  
 
Note: New roles may not be tested using the "Switch role to..." feature.
:Note: the selected role must also have the moodle/role:switchroles capability to be able to switch.


==Example roles==
==Allow role to view==


*[[Inspector role|Inspector]] - for providing external inspectors with permission to view all courses (without being required to enrol)
This setting allows the administrator to decide which roles users can see, search and filter by, according to their existing role.
*[[Parent role|Parent]] - for providing parents/mentors/tutors with permission to view certain information about their children/mentees/tutees
*[[Demo teacher role|Demo teacher]] - for providing a demonstration teacher account with a password which can't be changed
*[[Forum moderator role]] - for providing a user with permission in a particular forum to edit or delete forum posts, split discussions and move discussions to other forums


==See also==
==Roles capabilities==


*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=66782 What happens if a user has multiple roles in a course?] forum discussion
*[[Capabilities/moodle/role:manage|Create and manage roles]]
*[[Capabilities/moodle/role:assign|Assign roles to users]]
*[[Capabilities/moodle/role:switchroles|Switch to other roles]]


[[Category:Administrator]]
[[Category:Site administration]]
[[Category:Roles]]


[[es:Gestionar_roles]]
[[es:Gestionar_roles]]
[[fr:Définir les rôles]]
[[eu:Rolak_kudeatu]]
[[fr:Gestion des rôles]]
[[ja:ロールの管理]]
[[de:Rollen verwalten]]

Latest revision as of 07:57, 4 June 2019


Managing overall role capabilities can be done by an administrator using Administration > Site administration > Users > Permissions > Define roles. This is the place to add custom roles or modify existing roles. The "Manage roles" tab, allows the system administrator to edit any one of over 350 different capabilities associated with any role. The "Allow role assignments", "Allow role overrides" and "Allow role switches" contain a matrix which give the ability for a specific role to work with other specific roles.

Manage roles

The 'Manage roles' tab contains a list of roles on your site. The edit column contains icons for editing, deleting roles and copying roles, and for moving them up or down in the list (affecting the way that roles are listed around Moodle).

Allowroletoview.png

To edit a role:

  1. Go to Administration > Site administration > Users > Permissions > Define roles.
  2. Click the edit icon opposite the role you want to edit. For example "student".
  3. On the editing role page, change permissions as required for each capability.
  4. Scroll to the bottom of the page and click the "Save changes" button.

See Creating custom roles for information about adding a new role and creating a duplicate role.

Role name localisation

If a standard role name or description is empty Moodle uses a default string from the current language pack. Custom roles can be customised using multilang syntax.

You may also override the role names separately in each course.

Resetting a role

To reset a role back to the default permissions:

  1. Go to Administration > Site administration > Users > Permissions > Define roles.
  2. Click on the name of the role, for example "student".
  3. Click the 'Reset' button.

Note that if you have students who have been given extra permissions at course and/or activity levels (such as forum ratings), then they will no longer be able to do this once the role has been reset to its default. A teacher would need to go back and set up these extra permissions in the course/activity levels again.

Allow role assignments

The "Allow role assignments" tab allows (or does not allow) a specific role to be able to assign specific roles to a user.


Enabling teachers to assign other teachers

By default, teachers can only assign other users the roles of non-editing teachers, students and guests. If you want teachers to be able to assign other teachers in their course, you can allow the role assignment:

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

Allow role overrides

The "Allow role overrides" tab allows (or does not allow) a specific role to be able to override specific roles for a user. For example, it might allow a teacher role to override a student's role to a non-editing teacher's role.

Note that the settings only apply to roles that have the capabilities moodle/role:override or moodle/role:safeoverride allowed.

Allow role switches

The "Allow role switches" tab allows (or does not allow) a specific role to be able to temporarily change their role to another specific role. For example, this might allow a users assigned to a custom role in a course to see "Student" in the Settings > Switch role list.

Note: the selected role must also have the moodle/role:switchroles capability to be able to switch.

Allow role to view

This setting allows the administrator to decide which roles users can see, search and filter by, according to their existing role.

Roles capabilities