Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Roles FAQ.

Roles FAQ: Difference between revisions

From MoodleDocs
No edit summary
(What is a role archetype?)
 
(39 intermediate revisions by 6 users not shown)
Line 3: Line 3:


;Capability
;Capability
:A configurable aspect of behavior. As of version 1.9 Moodle has over 200 capabilities.  Each capability has a computer friendly name like [[Capabilities/mod/forum:rate|mod/forum:rate]] and a human-friendly name like "Rate posts."
:A configurable aspect of program behavior. Moodle has 100s of capabilities.  Each capability has a computer friendly name like [[Capabilities/mod/forum:rate|mod/forum:rate]] and a human-friendly name like "Rate posts."
;Permission
;Permission
:A capability and its value considered as a pair.  There are four possible values: ''Allow'', ''Prevent'', ''Prohibit'' and ''Not set''/''Inherit''. (It is called not-set when defining roles and inherit when overriding permissions.)
:Permissions are paired with each  capability.  There are four possible permission values: ''Allow'', ''Prevent'', ''Prohibit'' and ''Not set''/''Inherit''. (It is called not-set when defining roles and inherit when overriding permissions.)
;Role
;Role
:A named set of permissions, for example Teacher, Student and Forum moderator
:A named set of permissions that are associated with each capability. For example. the "Teacher" and "Student" roles come with the standard Moodle install.
;Context
;Context
:A functional area of Moodle, such as a course, module or block
:A functional area of Moodle. Contexts have a hierarchy.  Examples of contexts include a course, activity module, or resource.


==Why isn't my role change taking effect?==
==Why isn't my role change taking effect?==


In Moodle 1.7.x and 1.8.x, role assignments and overrides do not take effect immediately.  They are delayed until the next time the user logs in.  Starting with Moodle 1.9, manual role assignments and overrides take effect immediately. However automatic role assignments that result from changes to certain user policies (for example, Default front page role) may be delayed until the next login.
Certain capabilities e.g. [[Capabilities/moodle/user:changeownpassword|moodle/user:changeownpassword]] may only be applied in the system context, so giving such permissions by assigning a role in the course context will have no effect.


If you are testing a new role, [[Manage_roles#Testing_a_new_role | here are some suggestions]].
==My custom role will allow them to enroll others in a course, but only a "non" role==
 
Go to Site administration> User > Permissions > Define roles. Look at each of the "Allow" tabs and check the appropriate boxes.
Also, please check the context in which the role is assigned. Certain capabilities e.g. [[Capabilities/moodle/user:update|moodle/user:update]] may only be applied in the System context, so giving such permissions in the course context will have no effect.


==Why do I not have my Course creator role when I also have a student role in my course?==
==Why do I not have my Course creator role when I also have a student role in my course?==
When you are assigned a role in a context,like a course, that role's permissions for every capability will take over in that context.  You were probably given the course creator role in the system or category context, but then in the lower context of a course, you were enrolled as a student. 


If a user has two roles assigned for a course the system will default to the lowest level role, in this case the Student Role. The best advise is to hold only one role.  If you want to see things from the student perspective use the switch roles to function or create a phantom student.
If you need to be a student a best practice is to create a phantom or test user, then enrol that user in the course as a student. Teachers and others who know the user name and password, can see the course from the student perspective.  
 
==Why are all my teacher accounts automatically added as "Teachers" in all my courses?==
 
If a user is assigned a role in the System context (Site administration -> Users -> Permissions -> Assign system roles) or in a Course category context, then the user will have this role in ALL courses within the context. For example, a user who is assigned the Teacher role in the System context will appear as a Teacher in all courses on the site, including the Front page course.
 
Except in very special cases, teachers and students should be assigned their respective roles in a Course context.  When these roles are assigned in a System context, it is almost always an error on the part of the administrator.
 
If you have accidentally assigned a System role, go to ''Administration > Users > Permissions > Assign system roles'' unassign users using the right-facing arrow button.  Then re-assign the roles in the appropriate Course context.
 
==Why are all students enrolled in all courses?==
 
Either
*Users are assigned the role of student in the site/system context rather than the course context (see FAQ above)
Or
*The default role for all users in ''Administration > Users > Permissions > User policies'' is set to Student rather than Authenticated user (Moodle 1.8 onwards).
 
==Why are there differences in the users listed as course participants and users assigned roles in a course?==
 
Users assigned roles in a higher context, for example users assigned the role of teacher in a course category context, may appear as course participants. The discussion [http://moodle.org/mod/forum/discuss.php?d=59900 Discrepancies between Assign Roles lists and Participants list] contains a longer explanation.  


==How can I prevent administrators being listed as course participants?==
On a deeper level, consider the "Master Teacher" who is made a teacher on the system level.  If they are given a student role in a specific course, they "lose" many of their abilities to do things as a teacher in that course.  However, it can get complicated when a student capability has a "Not set" permission and the teacher role has an "Allow" permission. Here the "student" maybe able to do things other students can not do.  Thus the reason for the best practice mentioned above.


Ensure that administrators are not assigned another role in addition to their admin role.
==Why do some users I know are in my course not appear in ''Participants''?==


==Why are hidden assignments still visible?==
Users assigned roles in a higher context, for example users assigned the role of teacher in the course category are technically not enrolled in the course and so will not appear in the Participants link in the [[Navigation block]] but can be found via ''Settings>Course administration>Users>Other users''
 
Hidden assignments are not hidden from admins or teachers i.e. users with the [[Capabilities/moodle/role:viewhiddenassigns|viewhiddenassigns capability]].


==When defining roles, what is the difference between Prevent and Not set?==
==When defining roles, what is the difference between Prevent and Not set?==


Short answer: When defining roles, you almost always want to use Allow or Not set. Prevent is for special occasions.
Short answer: "Not set" means whatever permission was in effect when the user entered the context is still in effect.   "Prevent" do not allow this capability in this context.


If the permission for capability X is 'Not set', then having the roles does not let you do X, but something else might.
Best practice: when defining roles, you almost always want to use Allow or Not set.


If the permission for capability X is 'Prevent', then having that role actively prevents you from doing X. (Unless a more specific 'Allow' exists.)
==Can you give me some examples about permissions?==
When you logged into the site you were given the system role of Authenticated User. You are also enrolled in a course and given the student role. Let's look at a single capability called X (the capability could be to create a blog) to see how permissions work.


Some examples: Suppose you are in a course, and you have role Student in the course, and role Authenticated user in the site, so the Student role is more specific in this course.
In the example below we are just talking about the permissions for a single capability in the course role of a Student and the system role of Authenticated user for 1 user.  
* If Student has '''Not set''', and Authenticated user has '''Not set''', then you '''are not''' allowed to do X.
* If Student has '''Not set''', and Authenticated user has '''Allow''', then you '''are''' allowed to do X.
* If Student has '''Prevent''', and Authenticated user has '''Allow''', then you '''are not''' allowed to do X.
* If Student has '''Allow''', and Authenticated user has '''Prevent''', then you '''are''' allowed to do X.


For the full story, see [[How permissions are calculated]].
* If Student permission is '''Not set''', and Authenticated user  permission is '''Not set''', then you are not allowed to do X.
 
* If Student is '''Not set''', and Authenticated user is '''Allow''', then you are allowed to do X.
==What is my role here?==
* If Student is '''Prevent''' , and Authenticated user is '''Allow''', then you are allowed to do X.
 
* If Student is '''Allow''', and Authenticated user is '''Prevent''', then you are allowed to do X.  
This is a frequently asked question, but an improper one.  The correct question is "What are my ''permissions'' here?"  In any given context, you often have two or more roles. In addition, one or more role overrides may be in effect.  Your permissions in a given context are a result of "adding" the individual permissions from these roles and overrides according to certain rules.  As Tim Hunt writes in [http://moodle.org/mod/forum/discuss.php?d=90140 this discussion], the rules "normally do what you expect."  However when permissions conflict, the results can be surprising, and it pays to understand [[How permissions are calculated]].
* If Student is '''Prohibit''', and Authenticated user is '''Allow''', then you are not allowed to do X.
 
* If Student is '''Allow''', and Authenticated user is '''Prohibit''', then you are not allowed to do X.
==How do I debug a roles-related problem?==
 
If you're having a problem that you suspect is related to roles, consider using [[The rolesdebug.php roles debugging script | the rolesdebug.php roles debugging script]].  You can download it from the [http://moodle.org/mod/data/view.php?d=13&rid=1204 Modules and plugins database].  The script gives you a spatial view of your role assignments and overrides in a given context, and analyzes your permissions there.  To interpret the output requires a basic understanding of roles and capabilities.  If you are a complete roles novice, run the script and post the output to the [http://moodle.org/mod/forum/view.php?id=6826 Roles and Capabilities Forum].


==How can I prevent a user from changing their own password?==
==How can I prevent a user from changing their own password?==


To prevent a user from changing their own password, you must make sure they do not have [[Capabilities/moodle/user:changeownpassword|moodle/user:changeownpassword]] (in Moodle 1.9 onwards) = Allow in the System context. The Authenticated user role (which is assigned to users in the System context) has moodle/user:changeownpassword = Allow by default, so you have two choices:  
To prevent a user from changing their own password, you must make sure they do not have [[Capabilities/moodle/user:changeownpassword|moodle/user:changeownpassword]] = Allow in the System context. The Authenticated user role (which is assigned to users in the System context) has moodle/user:changeownpassword = Allow by default, so you have two choices:  
# Edit Authenticated user, setting moodle/user:changeownpassword = Not set  
# Edit Authenticated user, setting moodle/user:changeownpassword = Not set  
# Create a new role CannotChangeOwnPassword with moodle/user:changeownpassword = Prevent and all other permissions Not set and assign the role to selected users in the System context (Site administration -> Users -> Permissions -> Assign system roles).  
# Create a new role CannotChangeOwnPassword with moodle/user:changeownpassword = Prevent and all other permissions Not set. Choose "system" for the context type  and assign the role to selected users in the System context via ''Settings>Site administration -> Users -> Permissions -> Assign system roles).'' Choice (1) will prevent ''all'' users from changing their passwords (except for the administrator, who can do anything).  To selectively allow selected users (say teachers) to change their passwords, you could create a new role CanChangeOwnPassword with moodle/user:changeownpassword = Allow and all other permissions not set and assign the role to selected users in the System context (Site administration -> Users -> Permissions -> Assign system roles).
 
Choice (1) will prevent ''all'' users from changing their passwords (except for the administrator, who can do anything).  To selectively allow selected users (say teachers) to change their passwords, you could create a new role CanChangeOwnPassword with moodle/user:changeownpassword = Allow and all other permissions not set and assign the role to selected users in the System context (Site administration -> Users -> Permissions -> Assign system roles).


Choice (2) allows you to be selective, but if you have a lot of users that you want to prevent (say, all students), you will have to make a lot of role assignments in the System context.  There is currently no convenient way to do this, so you might consider choice (1).
Choice (2) allows you to be selective, but if you have a lot of users that you want to prevent (say, all students), you will have to make a lot of role assignments in the System context.  There is currently no convenient way to do this, so you might consider choice (1).
Line 88: Line 59:
==How can I prevent a user from editing their own profile?==
==How can I prevent a user from editing their own profile?==


See [[Roles_FAQ#How can I prevent a user from changing their own password? | How can I prevent a user from changing their own password?]]  The answer to this question is the same if you substitute ''edit their own profile'' for ''change their own password'' and ''[[Capabilities/moodle/user:editownprofile|moodle/user:editownprofile]]'' (in Moodle 1.9 onwards) for ''moodle/user:changeownpassword.''
See [[Roles_FAQ#How can I prevent a user from changing their own password? | How can I prevent a user from changing their own password?]]  The answer to this question is the same if you substitute ''edit their own profile'' for ''change their own password'' and ''[[Capabilities/moodle/user:editownprofile|moodle/user:editownprofile]]'' for ''moodle/user:changeownpassword.''


==Do roles have an inheritance relationship?==
==Do roles have an inheritance relationship?==
Line 95: Line 66:


* When you create a new role by copying an existing role, it is just like copying a file: the original and the copy are identical at the outset, but the copy has no ongoing relationship with the original.  Changes to the original do not affect the copy and ''vice versa''.
* When you create a new role by copying an existing role, it is just like copying a file: the original and the copy are identical at the outset, but the copy has no ongoing relationship with the original.  Changes to the original do not affect the copy and ''vice versa''.
* When you create a new role and select a value such as LEGACY:Student from the Legacy role type dropdown, you are not "inheriting" from the Student role.  You are simply indicating that you want your role to have the same defaults as Student.
* When you create a new role and select a value such as Role archetype:Student from the role archetype  dropdown, you are not "inheriting" from the Student role.  You are simply indicating that you want your role to have the same defaults as Student.
* Course creator does not "inherit" from Teacher (a common misconception).  As with all roles, the two roles are completely independent.  Course creator is actually a very simple role that can basically only create courses and not much else.  However a user who creates a course is automatically assigned the role of Teacher in the newly-created course.  This is how a course creator gets her teaching abilities within a course.
* Course creator does not "inherit" from Teacher (a common misconception).  As with all roles, the two roles are completely independent.  Course creator is actually a very simple role that can basically only create courses and not much else.  However a user who creates a course can be automatically assigned the role of Teacher in the newly-created course (the default in site settings).  This is how a course creator gets her teaching abilities within a course.
 
* Since roles are independent of each other, ordering roles at Site Administration > Users > Permissions > Define roles does not have any impact on capabilities or permissions. The only effect of ordering roles is how they are displayed in each context.
==Are there any differences in Roles in Moodle 1.7 and 1.8?==
* When a Moodle site is upgraded with new capabilities, the "ARCHeTYPE" role determines the initial permissions for those new capabilities.
 
In addition to many Roles fixes and refinements (see the list of [http://tracker.moodle.org/secure/IssueNavigator.jspa?mode=hide&requestId=10221 Roles improvements] in the Tracker), in Moodle 1.8 the ''system'' context is separated from the ''front page'' context. Roles may be assigned in the front page context via ''Administration > Front Page > Front Page roles''.
 
A "Duplicate role" button has been added in Moodle 1.8, which makes creating new roles based on predefined roles much quicker.


==How do I change the name for "teacher" in the course description?==
==How do I change the name for "teacher" in the course description?==
Line 109: Line 76:
* Edit the role of Teacher via ''Administration > Users > Permissions > Define roles'' and rename it. The new name will apply site-wide.
* Edit the role of Teacher via ''Administration > Users > Permissions > Define roles'' and rename it. The new name will apply site-wide.
Or
Or
* Create a duplicate teacher role with an alternative name and assign users the duplicate teacher role as appropriate in the course context. In ''Administration > Appearance > Course manager'' select the alternative name for teacher that you wish to be displayed in the course description.
* Create a duplicate teacher role with an alternative name and assign users the duplicate teacher role as appropriate in the course context. In ''Administration > Appearance > Course contact'' select the alternative name for teacher that you wish to be displayed in the course description when courses are listed. For example, copy the standard teacher role and call it Instructor and only show that role as the course contact.
Or
Or
* One more way to do it in 1.8 is to create new "dummy" roles (no capabilities) with those names and assign them to teachers along with the real roles. In the course manager settings you can choose which roles display on the front page under each course. (The feature request [http://tracker.moodle.org/browse/MDL-9182 Ability to assign or display custom title for role of person in course] contains this further method.)
* Create a new "dummy" role (no capabilities) with those names and assign them to teachers along with the real roles. select the alternative name for teacher that you wish to be displayed in the course description when courses are listed. For example, copy the guest role, call it Lead Teacher and make this the course contact. You may have 5 teachers in the course but only one name will appear as Lead Teacher.   If nobody is assigned the role Lead Teacher, no course contact will show.
 
Or
{{Moodle 1.9}}From Moodle 1.9 onwards, names for different roles in a course may be changed in the [[Course settings|course settings]].
*Names for different roles in a course may be changed in the [[Course settings|Course administration > edit settings]] "Role renaming" fields.  For example, some courses the teacher wants the title "Professor", or "Chief" or "Mentor". 
Or
*[[Language customization|Edit the language files]] and change any word you want.


==How do I enable teachers to set role overrides?==
==How do I enable teachers to set role overrides?==


#Access ''Administration > Users > Permissions > Define roles''.
#Access ''Site administration > Users > Permissions > Define roles''.
#Edit the teacher role and change the capability [[Capabilities/moodle/role:override|moodle/role:override]] (or [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] in Moodle 1.9.3 onwards) to allow.
#Edit the teacher role and change the capability [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] to allow.
#Click the button "Save changes".
#Click the button "Save changes".
#Click the tab "Allow role overrides" (in ''Administration > Users > Permissions > Define roles'').
#Click the tab "Allow role overrides" (in ''Site administration > Users > Permissions > Define roles'').
#Check the appropriate box(s) in the teacher row to set which role(s) teachers can override. Most likely it will just be the student role (you don't want teachers to be able to override admins!), so check the box where the teacher row intersects with the student column.
#Check the appropriate box(s) in the teacher row to set which role(s) teachers can override. Most likely it will just be the student role (you don't want teachers to be able to override admins!), so check the box where the teacher row intersects with the student column.
#Click the button "Save changes".
#Click the button "Save changes".
Line 126: Line 95:
==How do I enable teachers to assign other teachers in a course?==
==How do I enable teachers to assign other teachers in a course?==


This is disabled by default but it can be switched on by modifying the teacher's role. In ''Administration > Users > Permissions > Define roles'' select the "Allow role assignments" tab and tick the checkbox where Teacher and Teacher intersect.
This is disabled by default but it can be switched on by modifying the teacher's role. In ''Siite administration > Users > Permissions > Define roles'' select the "Allow role assignments" tab and tick the checkbox where Teacher and Teacher intersect.


==Why doesn't "Switch role to.." within a course seem to work properly for a course creator?==
==Why doesn't "Switch role to.." within a course seem to work properly?==


This feature is intended for teachers so that they can see how their course appears for students. It doesn't work reliably outside the course.
This feature is intended for teachers so that they can see how their course appears for students. It isn't a reliable view however, as some features do not display correctly when viewed by a teacher who has switched their role to a student. For that reason  it is always preferable where possible to have a "test" student log in to use.
 
Further information about this feature can be found in [[Switch roles]] and the paragraph on testing a new role in [[Manage roles]].


==Are there any example roles?==
==Are there any example roles?==
Line 138: Line 105:
Yes, as follows:
Yes, as follows:


*[[Inspector role|Inspector]] - for providing external inspectors with permission to view all courses (without being required to enrol)
*[[Parent role|Parent]] - for providing parents/mentors/tutors with permission to view certain information about their children/mentees/tutees
*[[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
*[[Demo teacher role|Demo teacher]] - for providing a demonstration teacher account with a password which can't be changed
Line 144: Line 110:
*[[Calendar editor role|Calendar editor]] - for providing a user with permission to add site events to the calendar
*[[Calendar editor role|Calendar editor]] - for providing a user with permission to add site events to the calendar
*[[Blogger role|Blogger]] - for limiting blogging to specific users only
*[[Blogger role|Blogger]] - for limiting blogging to specific users only
*[[Quiz user with unlimited time role|Quiz user with unlimited time]] - for allowing a user unlimited time to attempt a quiz which has a time limit set
*[[Question creator role|Question creator]] - for enabling students to create questions for use in quizzes
*[[Question creator role|Question creator]] - for enabling students to create questions for use in quizzes
*[[Course requester role]] - for restricting users who can make course requests
*[[Course requester role]] - for restricting users who can make course requests
Line 155: Line 120:


Either:
Either:
#Access ''Site Administration > Front Page > Front Page roles''
#Access ''Site administration > Front Page > Users > Permissions> Assigned roles''
#Follow the "Override permissions" link
#Select the role you wish to add individual users to
#Click on "Authenticated User"
#Select all or some of the users in the potential users list
#Change capabilities to ''allow'' for all required activities e.g. record a choice, reply to posts
#Use the left-facing arrow button to add them to the existing users list
#Click the "Save changes" button at the bottom of the page
 
Note that for this to work, you need to make the default role for all users "authenticated user". This is the default for new versions of Moodle. In older versions, the default setting is guest, so if you have recently upgraded, you may have to change this setting. You can change the setting via ''Site Administration > Permissions > User Policies''.


Or:
Or:
#Access ''Site Administration > Front Page > Front Page roles''
#Click on Student
#Select all users in the potential users list, and use the left-facing arrow button to add them to the existing users list
{{Moodle 1.9}}Or, in Moodle 1.9 onwards:
#Access ''Site Administration > Front Page > Front Page settings''
#Access ''Site Administration > Front Page > Front Page settings''
#Set the default front page role to student.
#Set the default front page role to student.


Note: Setting the default front page role to student is not sufficient to enable logged-in users to participate in front page choice activities. A permissions override should be used instead.
:Note: Setting the default front page role to student is not sufficient to enable logged-in users to participate in a Front Page "Choice activity". A permissions override should be used instead.


==How do I assign a role for a front page activity?==
==How do I copy a custom role from one Moodle site to another?==


# Assign the user a front page role, such as student, in ''Administration > Front Page > Front Page roles''.
In Moodle 1.9 it was possible using backup and restore, however this method does not work in Moodle 2.0 onwards. See MDL-30127 for further details.
# Click the "Locally assigned roles" tab in editing activity page for the front page activity.
# Choose the type of role you wish to assign.
# 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.
==What is the difference between the capabilities moodle/role:override and moodle/role:safeoverride?==


Note: The above steps are only necessary in versions of Moodle prior to 1.9.4.
The capability [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] was added to Moodle as a way of enabling teachers to [[Override permissions|override permissions]] safely. The capability moodle/role:override allows a user to override all permissions, whereas moodle/role:safeoverride only allows a user to override capabilities that do not have major risks attached to them.


==How do I copy a custom role from one Moodle site to another==
==How can I prevent students from editing their profile?==


There is no import and export facility for roles, but it can be achieved nearly as easily using backup and restore.
If you only want students to be prevented from editing their profile, and not all users, you can create a new role, such as Restricted user as described in the [[Demo teacher role]], with moodle/user:editownprofile set to prevent, and assign it to all students in the system context.


# Create an empty course with all the default settings
Alternatively, you could change moodle/user:editownprofile to not set for the [[Authenticated user role]], then create a new role for teachers with moodle/user:editownprofile set to allow.
# Assign anybody to your custom role (or roles) within the course
# Backup the course (all defaults are fine)
# Download the backup file
# Upload the backup file to the site files of the target Moodle
# Restore the course (all defaults are fine)
# Delete the course.


You will find that the custom roles have been recreated in the target site.
==Why can't I add teachers or students site wide in Moodle?==


==What is the difference between the capabilities moodle/role:override and moodle/role:safeoverride?==
You can, but it is not best practice.


{{Moodle 1.9}}The capability [[Capabilities/moodle/role:safeoverride|moodle/role:safeoverride]] was added to Moodle 1.9.3 onwards, as a way of enabling teachers to [[Override permissions|override permissions]] safely. The capability moodle/role:override allows a user to override all permissions, whereas moodle/role:safeoverride only allows a user to override capabilities that do not have major risks attached to them.
*Teachers and students typically work in one or more individual courses. It is unusual for a student to be studying every single course on your Moodle and unusual for a teacher to be teaching every single course. Therefore, the default Moodle does use these as system wide roles.  The Manager role might be one that makes sense to assign on a system or category context.
#To assign a teacher or student sitewide, go to ''Settings>Site administration>Users>Permissions>Define roles'' and edit the role to include the ''system'' context.
#Then search for and allow the capability [[Capabilities/moodle/course:view|moodle/course:view]]
#Then assign users to this role via ''Settings>Site administration>Users>Permissions>Assign system roles''
*It might be preferable to create a new role based on the teacher or student and assign this in the System context.  Then assign individuals to that role.


==I locked myself out of the Administrator role. What do I do?==
==How can I make a role available as a front page role?==
If all else fails download the [http://cvs.moodle.org/contrib/tools/adminfix/ adminfix.php] script. The instructions are in the comments at the top of the file. Note, that this is a big hammer and should only be used if you are truly stuck.


==How can I prevent students from editing their profile?==
# Go to ''Settings > Site administration > Users > Permissions > Define roles'' and edit the role
# For 'Context types where this role may be assigned' tick the Course checkbox
# Scroll to the bottom of the page and click the 'Save changes' button


If you only want students to be prevented from editing their profile, and not all users, you can create a new role, such as Restricted user as described in the [[Demo teacher role]], with moodle/user:editownprofile set to prevent, and assign it to all students in the system context.
==What is a role archetype?==


Alternatively, you could change moodle/user:editownprofile to not set for the [[Authenticated user role]], then create a new role for teachers with moodle/user:editownprofile set to allow.
See [[Creating custom roles]].


== See also ==
== See also ==
* [[Roles and capabilities]]
* [[Useful things a teacher can do with roles]]
* [[Context]]


* Using Moodle [http://moodle.org/mod/forum/view.php?id=6826 Roles and Capabilities forum]
* Using Moodle [http://moodle.org/mod/forum/view.php?id=6826 Roles and Capabilities forum]
Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=103109 Deny File Download to Guests?]


[[Category:FAQ]]
[[Category:FAQ]]

Latest revision as of 15:53, 20 September 2012


What is the definition of a...

Capability
A configurable aspect of program behavior. Moodle has 100s of capabilities. Each capability has a computer friendly name like mod/forum:rate and a human-friendly name like "Rate posts."
Permission
Permissions are paired with each capability. There are four possible permission values: Allow, Prevent, Prohibit and Not set/Inherit. (It is called not-set when defining roles and inherit when overriding permissions.)
Role
A named set of permissions that are associated with each capability. For example. the "Teacher" and "Student" roles come with the standard Moodle install.
Context
A functional area of Moodle. Contexts have a hierarchy. Examples of contexts include a course, activity module, or resource.

Why isn't my role change taking effect?

Certain capabilities e.g. moodle/user:changeownpassword may only be applied in the system context, so giving such permissions by assigning a role in the course context will have no effect.

My custom role will allow them to enroll others in a course, but only a "non" role

Go to Site administration> User > Permissions > Define roles. Look at each of the "Allow" tabs and check the appropriate boxes.

Why do I not have my Course creator role when I also have a student role in my course?

When you are assigned a role in a context,like a course, that role's permissions for every capability will take over in that context. You were probably given the course creator role in the system or category context, but then in the lower context of a course, you were enrolled as a student.

If you need to be a student a best practice is to create a phantom or test user, then enrol that user in the course as a student. Teachers and others who know the user name and password, can see the course from the student perspective.

On a deeper level, consider the "Master Teacher" who is made a teacher on the system level. If they are given a student role in a specific course, they "lose" many of their abilities to do things as a teacher in that course. However, it can get complicated when a student capability has a "Not set" permission and the teacher role has an "Allow" permission. Here the "student" maybe able to do things other students can not do. Thus the reason for the best practice mentioned above.

Why do some users I know are in my course not appear in Participants?

Users assigned roles in a higher context, for example users assigned the role of teacher in the course category are technically not enrolled in the course and so will not appear in the Participants link in the Navigation block but can be found via Settings>Course administration>Users>Other users

When defining roles, what is the difference between Prevent and Not set?

Short answer: "Not set" means whatever permission was in effect when the user entered the context is still in effect. "Prevent" do not allow this capability in this context.

Best practice: when defining roles, you almost always want to use Allow or Not set.

Can you give me some examples about permissions?

When you logged into the site you were given the system role of Authenticated User. You are also enrolled in a course and given the student role. Let's look at a single capability called X (the capability could be to create a blog) to see how permissions work.

In the example below we are just talking about the permissions for a single capability in the course role of a Student and the system role of Authenticated user for 1 user.

  • If Student permission is Not set, and Authenticated user permission is Not set, then you are not allowed to do X.
  • If Student is Not set, and Authenticated user is Allow, then you are allowed to do X.
  • If Student is Prevent , and Authenticated user is Allow, then you are allowed to do X.
  • If Student is Allow, and Authenticated user is Prevent, then you are allowed to do X.
  • If Student is Prohibit, and Authenticated user is Allow, then you are not allowed to do X.
  • If Student is Allow, and Authenticated user is Prohibit, then you are not allowed to do X.

How can I prevent a user from changing their own password?

To prevent a user from changing their own password, you must make sure they do not have moodle/user:changeownpassword = Allow in the System context. The Authenticated user role (which is assigned to users in the System context) has moodle/user:changeownpassword = Allow by default, so you have two choices:

  1. Edit Authenticated user, setting moodle/user:changeownpassword = Not set
  2. Create a new role CannotChangeOwnPassword with moodle/user:changeownpassword = Prevent and all other permissions Not set. Choose "system" for the context type and assign the role to selected users in the System context via Settings>Site administration -> Users -> Permissions -> Assign system roles). Choice (1) will prevent all users from changing their passwords (except for the administrator, who can do anything). To selectively allow selected users (say teachers) to change their passwords, you could create a new role CanChangeOwnPassword with moodle/user:changeownpassword = Allow and all other permissions not set and assign the role to selected users in the System context (Site administration -> Users -> Permissions -> Assign system roles).

Choice (2) allows you to be selective, but if you have a lot of users that you want to prevent (say, all students), you will have to make a lot of role assignments in the System context. There is currently no convenient way to do this, so you might consider choice (1).

Note that you MUST deal with this permission in the System context.

How can I prevent a user from editing their own profile?

See How can I prevent a user from changing their own password? The answer to this question is the same if you substitute edit their own profile for change their own password and moodle/user:editownprofile for moodle/user:changeownpassword.

Do roles have an inheritance relationship?

No. Roles are completely independent.

  • When you create a new role by copying an existing role, it is just like copying a file: the original and the copy are identical at the outset, but the copy has no ongoing relationship with the original. Changes to the original do not affect the copy and vice versa.
  • When you create a new role and select a value such as Role archetype:Student from the role archetype dropdown, you are not "inheriting" from the Student role. You are simply indicating that you want your role to have the same defaults as Student.
  • Course creator does not "inherit" from Teacher (a common misconception). As with all roles, the two roles are completely independent. Course creator is actually a very simple role that can basically only create courses and not much else. However a user who creates a course can be automatically assigned the role of Teacher in the newly-created course (the default in site settings). This is how a course creator gets her teaching abilities within a course.
  • Since roles are independent of each other, ordering roles at Site Administration > Users > Permissions > Define roles does not have any impact on capabilities or permissions. The only effect of ordering roles is how they are displayed in each context.
  • When a Moodle site is upgraded with new capabilities, the "ARCHeTYPE" role determines the initial permissions for those new capabilities.

How do I change the name for "teacher" in the course description?

Either

  • Edit the role of Teacher via Administration > Users > Permissions > Define roles and rename it. The new name will apply site-wide.

Or

  • Create a duplicate teacher role with an alternative name and assign users the duplicate teacher role as appropriate in the course context. In Administration > Appearance > Course contact select the alternative name for teacher that you wish to be displayed in the course description when courses are listed. For example, copy the standard teacher role and call it Instructor and only show that role as the course contact.

Or

  • Create a new "dummy" role (no capabilities) with those names and assign them to teachers along with the real roles. select the alternative name for teacher that you wish to be displayed in the course description when courses are listed. For example, copy the guest role, call it Lead Teacher and make this the course contact. You may have 5 teachers in the course but only one name will appear as Lead Teacher. If nobody is assigned the role Lead Teacher, no course contact will show.

Or

  • Names for different roles in a course may be changed in the Course administration > edit settings "Role renaming" fields. For example, some courses the teacher wants the title "Professor", or "Chief" or "Mentor".

Or

How do I enable teachers to set role overrides?

  1. Access Site administration > Users > Permissions > Define roles.
  2. Edit the teacher role and change the capability moodle/role:safeoverride to allow.
  3. Click the button "Save changes".
  4. Click the tab "Allow role overrides" (in Site administration > Users > Permissions > Define roles).
  5. Check the appropriate box(s) in the teacher row to set which role(s) teachers can override. Most likely it will just be the student role (you don't want teachers to be able to override admins!), so check the box where the teacher row intersects with the student column.
  6. Click the button "Save changes".

How do I enable teachers to assign other teachers in a course?

This is disabled by default but it can be switched on by modifying the teacher's role. In Siite administration > Users > Permissions > Define roles select the "Allow role assignments" tab and tick the checkbox where Teacher and Teacher intersect.

Why doesn't "Switch role to.." within a course seem to work properly?

This feature is intended for teachers so that they can see how their course appears for students. It isn't a reliable view however, as some features do not display correctly when viewed by a teacher who has switched their role to a student. For that reason it is always preferable where possible to have a "test" student log in to use.

Are there any example roles?

Yes, as follows:

  • Parent - for providing parents/mentors/tutors with permission to view certain information about their children/mentees/tutees
  • Demo teacher - for providing a demonstration teacher account with a password which can't be changed
  • Forum moderator - for providing a user with permission in a particular forum to edit or delete forum posts, split discussions and move discussions to other forums
  • Calendar editor - for providing a user with permission to add site events to the calendar
  • Blogger - for limiting blogging to specific users only
  • Question creator - for enabling students to create questions for use in quizzes
  • Course requester role - for restricting users who can make course requests

Logged-in users can't read the site news. What can I do?

See News forum for details.

How do I enable logged-in users to participate in front page activities?

Either:

  1. Access Site administration > Front Page > Users > Permissions> Assigned roles
  2. Select the role you wish to add individual users to
  3. Select all or some of the users in the potential users list
  4. Use the left-facing arrow button to add them to the existing users list

Or:

  1. Access Site Administration > Front Page > Front Page settings
  2. Set the default front page role to student.
Note: Setting the default front page role to student is not sufficient to enable logged-in users to participate in a Front Page "Choice activity". A permissions override should be used instead.

How do I copy a custom role from one Moodle site to another?

In Moodle 1.9 it was possible using backup and restore, however this method does not work in Moodle 2.0 onwards. See MDL-30127 for further details.

What is the difference between the capabilities moodle/role:override and moodle/role:safeoverride?

The capability moodle/role:safeoverride was added to Moodle as a way of enabling teachers to override permissions safely. The capability moodle/role:override allows a user to override all permissions, whereas moodle/role:safeoverride only allows a user to override capabilities that do not have major risks attached to them.

How can I prevent students from editing their profile?

If you only want students to be prevented from editing their profile, and not all users, you can create a new role, such as Restricted user as described in the Demo teacher role, with moodle/user:editownprofile set to prevent, and assign it to all students in the system context.

Alternatively, you could change moodle/user:editownprofile to not set for the Authenticated user role, then create a new role for teachers with moodle/user:editownprofile set to allow.

Why can't I add teachers or students site wide in Moodle?

You can, but it is not best practice.

  • Teachers and students typically work in one or more individual courses. It is unusual for a student to be studying every single course on your Moodle and unusual for a teacher to be teaching every single course. Therefore, the default Moodle does use these as system wide roles. The Manager role might be one that makes sense to assign on a system or category context.
  1. To assign a teacher or student sitewide, go to Settings>Site administration>Users>Permissions>Define roles and edit the role to include the system context.
  2. Then search for and allow the capability moodle/course:view
  3. Then assign users to this role via Settings>Site administration>Users>Permissions>Assign system roles
  • It might be preferable to create a new role based on the teacher or student and assign this in the System context. Then assign individuals to that role.

How can I make a role available as a front page role?

  1. Go to Settings > Site administration > Users > Permissions > Define roles and edit the role
  2. For 'Context types where this role may be assigned' tick the Course checkbox
  3. Scroll to the bottom of the page and click the 'Save changes' button

What is a role archetype?

See Creating custom roles.

See also