Project

General

Profile

Bug #7125

Students cannot enter private access course in "special course" mode

Added by Yannick Warnier over 6 years ago. Updated over 6 years ago.

Status:
Bug resolved
Priority:
High
Assignee:
Daniel Barreto
Category:
Global / Others / Misc
Target version:
Start date:
04/05/2014
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

  • create a course
  • put it in private access
  • through the edition in the admin section, set it as "special course"
  • create a new student
  • login as the new student
  • the special course appears in the list of courses
  • click the course
  • you get a "Not allowed" message
  • get back to the courses list
  • click the course
  • now you are allowed...

The behaviour of "special courses" is that they register you completely to the course the first time you click on it. As such, you should be registered in the table course_rel_user immediately.
The issue here is probably that the "api_is_allowed()" is called before the special-course process of registering the user is made, and this is wrong.

Please make sure the "special course" check is made before the api_is_allowed() call. Do not do that inside the api_is_allowed() function, as it would slow down a lot of other pages. We just need it on the course homepage.

Associated revisions

Revision 20dba872 (diff)
Added by Daniel Barreto over 6 years ago

Set is_allowed_in_course = true in session if successfully subscribe in special course -refs #7125

History

#1

Updated by Yannick Warnier over 6 years ago

  • Assignee changed from Julio Montoya to Daniel Barreto
#2

Updated by Daniel Barreto over 6 years ago

  • Status changed from Assigned to Needs testing
  • Assignee changed from Daniel Barreto to Yannick Warnier
  • % Done changed from 10 to 70

course_home use api_protect_course_script():

$is_allowed_in_course = api_is_allowed_in_course();
.
.
.
case COURSE_VISIBILITY_REGISTERED: //Private - access authorized to course members only - 1
    if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
        $is_visible = true;
    }
    break;
.
.
.
if (!$is_visible) {
    api_not_allowed($print_headers);
    return false;
}
    return true;

Then user's session should have 'is_allowed_in_course' true
For that if user is successfully subscribed then call Session::write() to set it true

Done in PR#292
https://github.com/chamilo/chamilo-lms/pull/292

#3

Updated by Yannick Warnier over 6 years ago

  • Status changed from Needs testing to Bug resolved
  • Assignee changed from Yannick Warnier to Daniel Barreto
  • % Done changed from 70 to 100

Tested and approved. Thanks!

Also available in: Atom PDF