Difference between revisions of "Roles FAQ"

Jump to: navigation, search
(See also)
(See also)
Line 197: Line 197:
 
==See also==
 
==See also==
  
*[Useful things a teacher can do with roles]
+
*[[Useful things a teacher can do with roles]]
  
 
*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]

Revision as of 10:03, 13 October 2008

Contents

What is the definition of a...

Capability
A configurable aspect of behavior. As of version 1.9 Moodle has over 200 capabilities. Each capability has a computer friendly name like mod/forum:rate and a human-friendly name like "Rate posts."
Permission
A capability and its value considered as a pair. There are four possible values: Not set (known as Inherit in 1.7), Allow, Prevent, and Prohibit
Role
A named set of permissions, for example Teacher, Student and Forum moderator
Context
A functional area of Moodle, such as a course, module or block

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.

If you are testing a new role, here are some suggestions.

Also, please check the context in which the role is assigned. Certain capabilities e.g. moodle/user:update may only be applied in the System context, so giving such permissions in the course context will have no effect.

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 Discrepancies between Assign Roles lists and Participants list contains a longer explanation.

How can I prevent administrators being listed as course participants?

Ensure that administrators are not assigned another role in addition to their admin role.

Why are hidden assignments still visible?

Hidden assignments are not hidden from admins or teachers i.e. users with the viewhiddenassigns capability.

What is the difference between Prevent and Not set?

If a role has capability X = Not set, then the role is saying "I don't care about X." If a role has X = Prevent, then the role is saying "I don't want you be able to do X." Now you typically have multiple roles in a given context, and those roles may have different opinions about X. If ALL of your roles have X = Not set then you will be effectively prevented from doing X because you need positive permission to do something. It's just like an election. If you are a candidate but no one votes, you don't win the election. If all of your roles except for one has X = Not set and the remaining role has X = Allow, then you will be allowed to do X. Again, it's like an election where only one person votes, and they vote for you! For more complicated cases (e.g., roles assigned and overridden in different contexts) you need to understand How permissions are calculated, but the principle is the same: By not voting, a role can allow other roles to determine the outcome of the election. Roles with lots of permissions Not set tend to mix well with other roles.

What is my role here?

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 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.

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. You can download it from the 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 Roles and Capabilities Forum.

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 ("Change own password") = 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 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).

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 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.
  • 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.

Are there any differences in Roles in Moodle 1.7 and 1.8?

In addition to many Roles fixes and refinements (see the list of 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?

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 manager select the alternative name for teacher that you wish to be displayed in the course description.

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 Ability to assign or display custom title for role of person in course contains this further method.)

Template:Moodle 1.9From Moodle 1.9 onwards, names for different roles in a course may be changed in the course settings.

How do I enable teachers to set role overrides?

  1. Access Administration > Users > Permissions > Define roles.
  2. Edit the teacher role and change the capability moodle/role:override (or moodle/role:safeoverride in Moodle 1.9.3 onwards) to allow.
  3. Click the button "Save changes".
  4. Click the tab "Allow role overrides" (in 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 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?

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.

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?

Yes, as follows:

  • Inspector - for providing external inspectors with permission to view all courses (without being required to enrol)
  • 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
  • Quiz user with unlimited time - for allowing a user unlimited time to attempt a quiz which has a time limit set
  • Question creator - for enabling students to create questions for use in quizzes

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

Either:

  1. Access Site Administration > Front Page > Front Page roles
  2. Follow the "Override permissions" link
  3. Click on "Authenticated User"
  4. Scroll down to Forum
  5. Change the capability mod/forum:viewdiscussion to allow
  6. Click the "Save changes" button at the bottom of the page

Or, in Moodle 1.9 onwards:

  1. Access Site Administration > Front Page > Front Page settings
  2. Set the default front page role to student.

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

Either:

  1. Access Site Administration > Front Page > Front Page roles
  2. Follow the "Override roles" link
  3. Click on "Authenticated User"
  4. Change capabilities to allow for all required activities e.g. record a choice, reply to posts
  5. 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:

  1. Access Site Administration > Front Page > Front Page roles
  2. Click on Student
  3. Select all users in the potential users list, and use the left-facing arrow button to add them to the existing users list

Template:Moodle 1.9Or, in Moodle 1.9 onwards:

  1. Access Site Administration > Front Page > Front Page settings
  2. Set the default front page role to student.

How do I assign 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.

Note: 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.

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

There is no import and export facility for roles, but it can be achieved nearly as easily using backup and restore.

  1. Create an empty course with all the default settings
  2. Assign anybody to your custom role (or roles) within the course
  3. Backup the course (all defaults are fine)
  4. Download the backup file
  5. Upload the backup file to the site files of the target Moodle
  6. Restore the course (all defaults are fine)
  7. Delete the course.

You will find that the custom roles have been recreated in the target site.

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

Template:Moodle 1.9The capability moodle/role:safeoverride was added to Moodle 1.9.3 onwards, 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.

I locked myself out of the Administrator role. What do I do?

If all else fails download the 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.

See also

Using Moodle forum discussions: