Users with an enrolment method, but no role

Users with an enrolment method, but no role

by Steve Bond -
Number of replies: 3

Hello,

Apologies if this has been discussed but I haven't been able find it by searching.

This situation with roles confuses me in Moodle 2:

  • As admin, manually enrol User A onto a course as Student
  • Look at the list of enrolled users.  User A is listed, with the role Student and the enrolment method Manual Enrolments.
  • Delete the Student role. They remain in the list of "enrolled users", still with the enrolment method, but no role.
  • Now log on as User A and go to the course. You can enter it, but you can't do anything, as if you were a guest.

So here's my question. Does User A have a role in the course? If not, what do they have? It seems clear that they have the course:view capability for the course, but capabilities are assigned in the context of roles, so what role do they have, and in what context?

Or, are capabilities now assigned via attributes other than roles? It seems clear that the "enrolment method" is an attribute, distinct from role, that can be assigned to a user (since we can remove it from their entry in the enrolled users list). So perhaps enrolment methods themselves also confer capabilities on a user?

It's all rather confusing.

Steve

Average of ratings: -
In reply to Steve Bond

Re: Users with an enrolment method, but no role

by Steve Bond -

Further to this, it seems that when I restore a backup containing user data, but do not restore the role assignments, I end up with a course full of users who have enrolment methods, but no roles, as described above.

It seems this is just Moodle 2's way of including a sort of 'ghost' of any user whose data needs to be retained, even if they aren't.

In reply to Steve Bond

Re: Users with an enrolment method, but no role

by Guillermo Madero -

Hi Steve,

Enrolments and roles are two different concepts: when a user is enroled into a course, then that user will be able to enter into the course and, according to the capabilities set by the assigned role, he/she may or may not be able to participate in the activities available.

If you take a look at the role options available when enrolling a user, you'll see that there is a "none" role in the list. From what I understood at the following tracker (the only place I found with an explanation of the "none" role):

http://tracker.moodle.org/browse/MDL-29599

this role can be used to kind of "suspend" a user, because eventhough that user will not be able to do any of the activities, he/she will still be able to access the resources. The suspension, from my point of view, comes from the fact that the user will not be graded anymore.

About the moodle/course:view capability, this is a special capability that allows a user to enter the course without being enroled or having temporary guest access, and so, it is a capability that only admins and managers have (by default).

In reply to Guillermo Madero

Svar: Re: Users with an enrolment method, but no role

by KS Læring -
The "None" role for an enrolled user is discussed in

https://tracker.moodle.org/browse/MDL-29599
https://moodle.org/mod/forum/discuss.php?d=192476

and

https://docs.moodle.org/29/en/Roles_FAQ#What_is_the_.22none.22_role.3F

, but it has disappeared from the FAQ-documentation for Moodle 3.1 -

https://docs.moodle.org/31/en/Roles_FAQ

without an explanation.

Is there a difference between 2.9 and 3.1, or is this missing?

We have an "unenrol"-link at our site, but this is not available to users lacking a role in a course. This can happen either from not having been given one by some role with the capability to grant it, or by deleting all roles attached to the user in the course from the Enrolled users list of the course.

To find users in courses who do have a role of "user" rather than a role of "student" or higher, you can try this query with the Ad Hoc reporting tool to find them - enjoy. smile

SELECT user2.firstname AS Firstname, user2.lastname AS Lastname, user2.email AS Email, user2.city AS City, course.fullname AS Course, (SELECT shortname FROM prefix_role WHERE id=en.roleid AND shortname='user') AS ROLE, (SELECT name FROM prefix_role WHERE id=en.roleid AND name='') AS RoleName FROM prefix_course AS course JOIN prefix_enrol AS en ON en.courseid = course.id JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id JOIN prefix_user AS user2 ON ue.userid = user2.id