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

course:activityvisibility permission not sufficient to change activity visibility

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.1.3
    • Course
    • MOODLE_401_STABLE
    • Hide

      By right-clicking the "Show" or "Hide" links, choosing "Copy link address", and then pasting that link into the address bar, the original operation (hiding or showing the activity) will be performed (the link points to course/mod.php which does the actual work).  

      Show
      By right-clicking the "Show" or "Hide" links, choosing "Copy link address", and then pasting that link into the address bar, the original operation (hiding or showing the activity) will be performed (the link points to course/mod.php which does the actual work).  

      Disclaimer: I am a noob

      Having the course:activityvisibility permission but not the course:manageactivities permission gives a user the ability to choose "Show" or "Hide" from the kebab menu, but results in an error being displayed when trying to change the visibility of an activity:

       

      nopermissions
      Sorry, but you do not currently have permissions to do that (Manage activities).
      

       

      I am far outside of my area of expertise, but I think the issue may be due to the set_cm_visibility function in course/format/classes/stateactions.php checking for both permissions:

      require_all_capabilities(['moodle/course:manageactivities', 'moodle/course:activityvisibility'], $modcontext);

      By removing course:manageactivities from the call to require_all_capabilities on a test server I was able to restore expected behaviour; i.e. Show/Hide works when only having the course:activityvisibility permission.

      I am not saavy enough to know what this might break and I wanted to share in case it was a useful observation.  We have a situation where we would like a role to have the ability to change the visibility of an activity without otherwise being able to change the configuration of the activity so started digging.

       

            Unassigned Unassigned
            blairvessey Blair Vessey
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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