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

Make block add/remove and edit permissions more consistent

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Blocks
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Blocks have methods user_can_addto and user_can_edit which let the block determine whether the current user can do certain things (perhaps via a capability check).

      At the moment, user_can_addto only controls whether a user can add an instance of the block. However, a user who is not allowed to add the block can delete it. Thusn, if they made a mistake, they can't undo the action.

      I want to change it so that user_can_addto controls both adding and removing.

      Similarly, I want to change it so user_can_edit controls the ability to show and hide the block, as well as the ability to access the configure instance form.

      By default, both these methods return true, and no core blocks override them, so making this change should not break anything, and I think it makes the functionality more logical. Therefore, I think I am going to go ahead and check this in.

      I'll post in the block and general developer forums so people know this is going on.

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            timhunt Tim Hunt
            Tester:
            Nobody
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08