Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65703

Modifying subscriptions not possible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.6, 3.6.4, 3.7
    • Fix Version/s: 3.6.5, 3.7.1
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as teacher.
      2. If you don't have a course, create one.
      3. Enrol an user as teacher, let's call it t1
      4. Create a group (g1) in that course and add (t1) as a member.
      5. Now, log in as t1 and go to Calendar.
      6. Click Manage subscriptions
      7. Please look the URL, Make sure you are redirected to managesubscriptions.php but it doesn't has a course parameter course=1
      8. Select Calendar file(.ics) on Import from field and select the attached ics file as calendar file.
      9. Click Add to proceed and make sure all events have been imported.
      10. Go back to the month view and click Manage subscriptions again.
      11. Make sure you can see the subscription you have created.
      12. Now, add the course=1 parameter to the URL, it should look like this:
        http://<<yoursite>>/integration_master/calendar/managesubscriptions.php?course=1.
      13. Make sure the page loads the subscription in the list.
      14. Go to the course you created before, and add the Calendar block if it's not added yet.
      15. Make not of the id parameter in the URL view.php?id=X
      16. Click in the month link in the calendar block to go to course calendar.
      17. Note the calendar month view url now shows the course parameter, but now with a different value (not 1)
      18. Click Manage subscription button.
      19. # Please look the URL, Make sure you are redirected to managesubscriptions.php but it HAS a course parameter course=X (the id you took note before)
      Show
      Log in as teacher. If you don't have a course, create one. Enrol an user as teacher, let's call it t1 Create a group ( g1 ) in that course and add ( t1 ) as a member. Now, log in as t1 and go to Calendar . Click Manage subscriptions Please look the URL, Make sure you are redirected to managesubscriptions.php but it doesn't has a course parameter course=1 Select Calendar file(.ics) on Import from field and select the attached ics file as calendar file. Click Add to proceed and make sure all events have been imported. Go back to the month view and click Manage subscriptions again. Make sure you can see the subscription you have created. Now, add the course=1 parameter to the URL, it should look like this: http://<<yoursite>>/integration_master/calendar/managesubscriptions.php?course=1 . Make sure the page loads the subscription in the list. Go to the course you created before, and add the Calendar block if it's not added yet. Make not of the id parameter in the URL view.php?id=X Click in the month link in the calendar block to go to course calendar . Note the calendar month view url now shows the course parameter, but now with a different value (not 1) Click Manage subscription button. # Please look the URL, Make sure you are redirected to managesubscriptions.php but it HAS a course parameter course=X (the id you took note before)
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-65703-master
    • Sprint:
      Internationals - 3.8 Sprint 1

      Description

      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

      1. You need a user account with no special capabilities just the defaults from the installation.
      2. Create a course and in this course at least one group.
      3. Enrol the user into the created course.
      4. Login to your installation as the before created user.
      5. Go to the left navigation (flatnav) and click on "Calendar".
      6. Click on the button "Manage subscriptions".
      7. Create a new subscription with the default settings and use some remote ics url.
      8. After adding the subscription the new events are shown in the calendar.
      9. Go again to the left navigation and click on "Calendar".
      10. Click on the button "Manage subscriptions".
      11. 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.

        Attachments

          Activity

            People

            • Assignee:
              lameze Simey Lameze
              Reporter:
              grabs Andreas Grabs
              Peer reviewer:
              Simey Lameze
              Integrator:
              Andrew Nicols
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Jul/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 40 minutes
                6h 40m