-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.6, 3.6.4, 3.7
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
MDL-65703-master -
-
Internationals - 3.8 Sprint 1
Description
If are teacher in at least one course with groups and you don't have the capability "moodle/calendar:manageentries" for the frontpage you are not able to modify or delete your own calendar subscriptions.
Steps to reproduce
- You need a user account with no special capabilities just the defaults from the installation.
- Create a course and in this course at least one group.
- Enrol the user into the created course.
- Login to your installation as the before created user.
- Go to the left navigation (flatnav) and click on "Calendar".
- Click on the button "Manage subscriptions".
- Create a new subscription with the default settings and use some remote ics url.
- After adding the subscription the new events are shown in the calendar.
- Go again to the left navigation and click on "Calendar".
- Click on the button "Manage subscriptions".
- You don't see any of your subscriptions but the info "You have no calendar subscriptions".
The problem is, so my opinion, that the assembling of the searches array in "managesubscriptions.php" is done in the wrong way.
Starting on line 130 there is a condition that never suits for standard users.
if (!empty($courseid) && $courseid == SITEID && !empty($types['site'])) {
$searches[] = "(eventtype = 'site')";
$searches[] = "(eventtype = 'user' AND userid = :userid)";
$params['userid'] = $USER->id;
$usedefaultfilters = false;
}
I think this condition should be splitted into two conditions like that.
if (!empty($courseid) && $courseid == SITEID && !empty($types['site'])) {
$searches[] = "(eventtype = 'site')";
$usedefaultfilters = false;
}
if (!empty($types['user'])) {
$searches[] = "(eventtype = 'user' AND userid = :userid)";
$params['userid'] = $USER->id;
$usedefaultfilters = false;
}
Or you remove the course param from the url "<your-moodle>/calendar/managesubscriptions.php"
In both cases you can edit your subscriptions.