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

Modifying activity events requires calendar capabilities

XMLWordPrintable

    • MOODLE_34_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • Hide

      The new Behat and unit tests cover creating activities and editing without calendar permissions in the following activities and systems:

      • Assignment (mod_assign)
      • Chat
      • Completion system
      • Database
      • Feedback
      • Lesson
      • Quiz
      • Scorm

      Setup

      1. Create a course
        • Ensure that Enable completion tracking is set to Yes
      2. Add a Calendar block to it

      Testing that activity events cannot be edited

      Testing event editing in the day view for activity events

      1. Create an assignment in the course
        • Name it MDL-62944 Assignment
        • Ensure that the Due date is enabled and set. Make a note of the date.
      2. Ensure that the the Calendar block is displaying the day that you set the due date to and then click on the day
      3. Verify that there is no editing cog displayed on the MDL-62944 Assignment is due event
      4. Verify that clicking the Go to activity link takes you to the assignment

      Optionally you can test the other types of events that activities listed above can create.

      Testing completion event editing in the day view

      1. Create a glossary in the course
        • Name it 'MDL-62944 Glossary'
        • Set Completion tracking to Students can manually mark the activity as completed
        • Enable Expect completed on and set a date, make a note of the date
      2. Ensure that the the Calendar block is displaying the day that you set the 'Expect completed on' date to and then click on the day
      3. Verify that there is no editing cog displayed on the MDL-62944 Glossary should be completed event
      4. Verify that clicking the Go to activity link takes you to the glossary

      Regression test: Manual events

      1. As a Teacher from the course, click on the month of the calendar block
      2. Create the following events:
        1. Test course event
          • Event title: Test course event
          • Type of event: Course
          • Date: today
        2. Test user event
          • Event title: Test user event
          • Type of event: User
          • Date: today
      3. Click on today's date in the Calendar block
      4. Verify that the Editing and Delete buttons are present on both the Test course event and Test user event
      5. Ensure that clicking on the Test course event event's edit buttons brings up an Event edit modal and shows that the event is of type Course
      6. Ensure that clicking on the Test user event event's edit buttons brings up an Event edit modal and shows that the event is of type User

      Testing database action menus

      • This test requires a Boost based theme
      1. As a Teacher create a database activity and enter it
      2. You will be in the Fields tab
        1. Ensure that you can see an action menu.
        2. Ensure that the action menu opens and closes
      3. Click on the Presets tab
        1. Ensure that you can see an action menu.
        2. Ensure that the action menu opens and closes
      4. Select Image gallery from Use a preset, then press Choose
      5. Press Continue
      6. Click on the Templates tab
        1. Ensure that you can see an action menu.
        2. Ensure that the action menu opens and closes
      7. Click on the Export tab
        1. Ensure that you can see an action menu.
        2. Ensure that the action menu opens and closes
      8. Click on the Add entry tab
        1. Ensure that you can see an action menu.
        2. Ensure that the action menu opens and closes
      Show
      The new Behat and unit tests cover creating activities and editing without calendar permissions in the following activities and systems: Assignment (mod_assign) Chat Completion system Database Feedback Lesson Quiz Scorm Setup Create a course Ensure that Enable completion tracking is set to Yes Add a Calendar block to it Testing that activity events cannot be edited Testing event editing in the day view for activity events Create an assignment in the course Name it MDL-62944 Assignment Ensure that the Due date is enabled and set. Make a note of the date. Ensure that the the Calendar block is displaying the day that you set the due date to and then click on the day Verify that there is no editing cog displayed on the MDL-62944 Assignment is due event Verify that clicking the Go to activity link takes you to the assignment Optionally you can test the other types of events that activities listed above can create. Testing completion event editing in the day view Create a glossary in the course Name it ' MDL-62944 Glossary ' Set Completion tracking to Students can manually mark the activity as completed Enable Expect completed on and set a date, make a note of the date Ensure that the the Calendar block is displaying the day that you set the 'Expect completed on' date to and then click on the day Verify that there is no editing cog displayed on the MDL-62944 Glossary should be completed event Verify that clicking the Go to activity link takes you to the glossary Regression test: Manual events As a Teacher from the course, click on the month of the calendar block Create the following events: Test course event Event title: Test course event Type of event: Course Date: today Test user event Event title: Test user event Type of event: User Date: today Click on today's date in the Calendar block Verify that the Editing and Delete buttons are present on both the Test course event and Test user event Ensure that clicking on the Test course event event's edit buttons brings up an Event edit modal and shows that the event is of type Course Ensure that clicking on the Test user event event's edit buttons brings up an Event edit modal and shows that the event is of type User Testing database action menus This test requires a Boost based theme As a Teacher create a database activity and enter it You will be in the Fields tab Ensure that you can see an action menu. Ensure that the action menu opens and closes Click on the Presets tab Ensure that you can see an action menu. Ensure that the action menu opens and closes Select Image gallery from Use a preset , then press Choose Press Continue Click on the Templates tab Ensure that you can see an action menu. Ensure that the action menu opens and closes Click on the Export tab Ensure that you can see an action menu. Ensure that the action menu opens and closes Click on the Add entry tab Ensure that you can see an action menu. Ensure that the action menu opens and closes

      If a user attempts to create an assignment and they do not have the 'moodle/calendar:manageentries' then the assignment is not created.

      This seems incorrect as in this case it is not the user manipulating the calendar but the assignment activity itself.

      Steps to reproduce

      1. Create a course and Prohibit the 'moodle/calendar:manageentries' capability for Teachers on it
      2. Enrol a user as a teacher on the course
      3. Login as the teacher
      4. Attempt to create an assignment

      Outcome

      Error message

      Debug info:
      Error code: nopermissiontoupdatecalendar

      Stack trace:

      • line 482 of \lib\setuplib.php: moodle_exception thrown
      • line 448 of \calendar\lib.php: call to print_error()
      • line 921 of \calendar\lib.php: call to calendar_event->update()
      • line 1334 of \mod\assign\locallib.php: call to calendar_event::create()
      • line 705 of \mod\assign\locallib.php: call to assign->update_calendar()
      • line 41 of \mod\assign\lib.php: call to assign->add_instance()
      • line 124 of \course\modlib.php: call to assign_add_instance()
      • line 154 of \course\modedit.php: call to add_moduleinfo()

      And no activity is created

      Expected

      An assignment will be created

      Generally

      In general, to add / modify an activity, the permissions checks will be done by the activity itself. When the activity creates or modifies the calendar events, the default for "unknown" event types is to check for moodle/calendar:manageentries on the context. The current user can have the capability to edit the activity settings, but not have the capability to manage the calendar events for the activity. This is now an unresolved conflicting state.

      What needs to be decided is

      • If a user can add or edit an activity, does that give them the capability to modify the events for that activity?
      • Can they modify those events directly in the calendar (suggest "No")?
      • If they can modify the events in the calendar, is that change reflected in the activity settings?
      • In the calendar API what are the distinctions between API functions for allowing a user to modify activity events via the calendar UI or functions allowing a user to modify events by changing the activity settings?

      Assignment is mentioned here, but the problem exists across all activity modules.

       

       

       

       

            nmagill Neill Magill
            nmagill Neill Magill
            Damyon Wiese Damyon Wiese
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 43 minutes
                43m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.