Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Enrolment usage overview

From MoodleDocs
Enrolment usage overview
Project state Proposal
Tracker issue MDL-21655
Discussion n/a
Assignee Petr Škoda (škoďák)

Moodle 2.0


Goals

There is a lot of confusion related to guest access, enrolment of users, etc. This page is trying to sum up the usage of enrolments and guest access in various parts of Moodle.

Definitions

Core API

get_enrolled_users()
get_enrolled_sql()
isguest()
isguestuser()
is_siteadmin()
has_capability()
get_users_by_capability()
is_enrolled()
is_inspecting()

Core usage

Group membership

Only enrolled users may be members of groups. In 1.9 and earlier we only guess by looking at roles that have moodle/course:view which is not hidden, this may actually return incorrect results if overrides used. All group membership is removed when unenrolling form course.

Technically we need to look only at users that are returned by get_enrolled_users() when looking for new group membership candidates. Existing group membership should be filtered so that only enrolled users are displayed.

Gradebook

We keep only grades of enrolled users. Gradebook shows only enrolled users that have the gradebook role. In future it could be controlled by a special capability instead, this was not possible in 1:9 for performance reasons.

Anybody with capability may grade or manage gradebook.

Logs and reports

In some cases we want to see only enrolled users, in others we want to see really all users. This should be decided by a new capability.

User profiles

Only enrolled user have course visible profile. Users that have one of $CFG->coursemanager roles have profile on site level because we want them to be clickable on course description page. (This was originally controlled by isteacherinanycourse() which was both deprecated and incorrect.)

Profile displays also user roles in course, the list of roles is the same as on the profile page.

Participation page

Participants page displays only enrolled users (with moodle/course:view capability). It shows only limited number of roles specified in the $CFG->profileroles setting.

Messaging

There is an ongoing discussion about limiting of communication to Teacher-Student only, I do not think we should restrict this - they may use modules like Consultation or Dialog instead. In any case the current 2.0dev messaging needs a lot more work both on performance and usability.

Comments

Comments can be controlled by capability.

Ratings

ratings can be controlled by capability.

Modules

Assignment

Only enrolled user with submit capability may submit.

Users with capability may grade.

Chat

Users with capability may chat.

Choice

Enrolled users with capability may make a choice. In theory there could be a setting to require capability only.

The enrolment is important especially when there is a limited number of slots or when we want to display list of users that did not make a choice yet.

Feedback

Options:

  • Enrolled users with capability only
  • Users with capability
  • All users including guest (non standard feature disabled by default for security reasons)

Forum

Anybody with capability may post.

Glossary

Anybody with capability may post.

Lesson

Anybody with capability may try it, grades are recorded only for enrolled.

Quiz

Anybody with capability could try it. Only enrolled with capability are displayed as those that did not pass grade yet. Only grades of enrolled are passed to gradebook.

SCORM

Anybody with capability may try it.

Survey

Only enrolled with capability may answer it.

Wiki

Workshop

Blocks

Online users

See also