Moodle

Default role for users in a course= Guest doesn't work when course has an enrollment key

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 2.0
  • Component/s: Roles / Access
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

To recreate the problem:

1. Set Default role for users in a course = Guest.
2. Create a new course X with an enrollment key and set Guest access = "Allow guests who have the key"
3. Login to the site and go to Login to X page (course/enrol.php).
4. Enter the enrollment key and press the "Enrol me in this course" button

In Step 4 enrolment was successful but no redirection occurs. The "Login to X" page is simply redisplayed. I can see that enrollment is successful using rolesdebug.php script. It shows that the user is assigned the Guest role in course X.

If in Step 2 we set Guest access = "Allow guests without the key," the problem does not occur. The user is redirected to the course.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment - - edited

hmm, you should definitely not set the default course role to Guest because it breaks enrolments - guest role now means user is not enrolled

this can not be fixed in 1.9x - sorry

Show
Petr Škoda (skodak) added a comment - - edited hmm, you should definitely not set the default course role to Guest because it breaks enrolments - guest role now means user is not enrolled this can not be fixed in 1.9x - sorry
Hide
John Isner added a comment -

Whether or not it is sensible to have the default role be Guest is not the issue. The issue is the different behavior you get, depending on whether or not the course has an enrolment key. The behavior in the two cases should be consistent.

Possible solution: Remove Guest from the dropdown in User policies -> Default role for users in a course. Other user policy dropdowns already do this. For example you can no longer set Default role for all users = Guest.

The user who brought this problem to my attention is a very experienced Moodler but is new to roles I promised to test this case for him, and I verified his results on demo.moodle.org.

Show
John Isner added a comment - Whether or not it is sensible to have the default role be Guest is not the issue. The issue is the different behavior you get, depending on whether or not the course has an enrolment key. The behavior in the two cases should be consistent. Possible solution: Remove Guest from the dropdown in User policies -> Default role for users in a course. Other user policy dropdowns already do this. For example you can no longer set Default role for all users = Guest. The user who brought this problem to my attention is a very experienced Moodler but is new to roles I promised to test this case for him, and I verified his results on demo.moodle.org.
Hide
Petr Škoda (skodak) added a comment -

I agree the guest should be removed from that list for now

Show
Petr Škoda (skodak) added a comment - I agree the guest should be removed from that list for now
Hide
John Isner added a comment -

I realize that this issue is probably resolved, but I would like to understand how allowing a user to enroll as Guest "breaks enrollments." Can you give an example? Thanks!

Show
John Isner added a comment - I realize that this issue is probably resolved, but I would like to understand how allowing a user to enroll as Guest "breaks enrollments." Can you give an example? Thanks!
Hide
Petr Škoda (skodak) added a comment -

legacy:guest is one big hack - it can not be "explained", it should be rewritten instead

Show
Petr Škoda (skodak) added a comment - legacy:guest is one big hack - it can not be "explained", it should be rewritten instead
Hide
John Isner added a comment -

The person who is using Guest in this manner has not had any problems so far. When you say it "breaks enrollments" it sounds scary. I wondered if I should warn him of possible future problems.

Show
John Isner added a comment - The person who is using Guest in this manner has not had any problems so far. When you say it "breaks enrollments" it sounds scary. I wondered if I should warn him of possible future problems.
Hide
Petr Škoda (skodak) added a comment -

Please read the enrolment related code if you need to know more about this

Show
Petr Škoda (skodak) added a comment - Please read the enrolment related code if you need to know more about this
Hide
John Isner added a comment -

I have been thinking more about this issue. I believe it is completely reasonable to allow users to be enrolled in courses as Guest, and that doing so does not "break enrolments.".

True or false: Teacher can assign the Guest role. True! Once Teacher assigns the Guest role to a user, the result is the SAME as if the user had been assigned the role automatically, by the User policy. Are enrollments now "broken?" I certainly hope not

So either we (1) open up Pandora's box by eliminating the possibility that Guests can ever be enrolled in courses (including removing Guest from Teacher's list of assignable roles), or (2) fix the minor bug that I originally reported.

Show
John Isner added a comment - I have been thinking more about this issue. I believe it is completely reasonable to allow users to be enrolled in courses as Guest, and that doing so does not "break enrolments.". True or false: Teacher can assign the Guest role. True! Once Teacher assigns the Guest role to a user, the result is the SAME as if the user had been assigned the role automatically, by the User policy. Are enrollments now "broken?" I certainly hope not So either we (1) open up Pandora's box by eliminating the possibility that Guests can ever be enrolled in courses (including removing Guest from Teacher's list of assignable roles), or (2) fix the minor bug that I originally reported.
Hide
Petr Škoda (skodak) added a comment -

(3) rewrite enrolments in 2.0

Show
Petr Škoda (skodak) added a comment - (3) rewrite enrolments in 2.0
Hide
John Isner added a comment -

Currently no role can assign Authenticated user, at least by default, not even Administrator. This makes sense. Now based on our discussion, I would advocate removing TWO columns from the Allow role assignments table: Authenticated user and Guest.

Show
John Isner added a comment - Currently no role can assign Authenticated user, at least by default, not even Administrator. This makes sense. Now based on our discussion, I would advocate removing TWO columns from the Allow role assignments table: Authenticated user and Guest.
Hide
A. T. Wyatt added a comment -

I agree with Petr on the purpose of Guest. It seems to me that "guest" should never be allowed to enroll in a course.

Guests, in my mind, just view things. They don't participate. If I remember correctly, they are not allowed to participate in many activities (such as forum posting or taking quizzes).

Given that, I agree with John that It seems sensible that the guest role and the authenticated user role not even be available for role granting teachers to assign. I vote for taking those columns out of the teacher's role assignments table. That way we cannot make mistakes if we have the ability to assign roles as instructors.

Maybe that is easier that rewriting the legacy guest code! (sorry Petr, I am not up to reading the code and understanding it . )

Show
A. T. Wyatt added a comment - I agree with Petr on the purpose of Guest. It seems to me that "guest" should never be allowed to enroll in a course. Guests, in my mind, just view things. They don't participate. If I remember correctly, they are not allowed to participate in many activities (such as forum posting or taking quizzes). Given that, I agree with John that It seems sensible that the guest role and the authenticated user role not even be available for role granting teachers to assign. I vote for taking those columns out of the teacher's role assignments table. That way we cannot make mistakes if we have the ability to assign roles as instructors. Maybe that is easier that rewriting the legacy guest code! (sorry Petr, I am not up to reading the code and understanding it . )
Hide
John Isner added a comment -

Petr,
I'm not sure of the procedure. Should I create a new issue? If so, I will reference this one (then you can close this one).

Show
John Isner added a comment - Petr, I'm not sure of the procedure. Should I create a new issue? If so, I will reference this one (then you can close this one).
Hide
Petr Škoda (skodak) added a comment -

The guest handling was completely rewritten in the new enrolments code in 2.0, I hope this will give us greater flexibility now.

Thanks for the report!

Show
Petr Škoda (skodak) added a comment - The guest handling was completely rewritten in the new enrolments code in 2.0, I hope this will give us greater flexibility now. Thanks for the report!

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: