Configuration-specific permissions?

Configuration-specific permissions?

by Liam Everett -
Number of replies: 2

Hello all,

I've created a block to allow teachers to display the same global HTML text on any page that has the block added. The block can have multiple configs to choose from (for instance, a teacher adds the block, and then on the instance configuration settings page, the teacher selects from the list of options which content they want to display). The configurations are added/removed/edited by an admin, but what I want to do next is allow admins to grant other users permission to edit specific block configurations (so a librarian might have editing capabilities for the Library block config, but not the Math block config).

I'm not sure how to go about doing this. I know there's a block-specific context for roles/permissions, but is it possible to distinguish permissions on an even more granular level? I suppose that's the biggest question I have...

I've attached my block for anyone who'd like to take a look at my code. Let me know if I need to be clearer about anything.

Average of ratings: -
In reply to Liam Everett

Re: Configuration-specific permissions?

by Christian Herman -

I'm afraid the coding is beyond me, but the concept, at least at face-value, is not.  Perhaps there's another way to get what you want without trying to add additional complexity to Moodle's already complex permissions system.

Why not create several role-specific blocks?  In that case, the librarian could be granted editing capabilities to the Library block and math department the Math block without interferring with the content of others.  If your Libarary block needs some of the content from the Match block, can it pull the content read-only?

Just an idea.

In reply to Christian Herman

Re: Configuration-specific permissions?

by Liam Everett -
That would be a lot more straightforward for granting permissions. The problem is that my clients plan to have such a large variety of configurations that it would be impractical to create that many different blocks that all do the same thing.


I didn't specify before, but there are not only different configurations, but also categories of configurations... within the Math department there would be sub-configs -- there might be a general math block as well as several blocks specific to individual professors.