Issue Details (XML | Word | Printable)

Key: MDL-11421
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Petr Skoda
Reporter: Jamie Pratt
Votes: 0
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

new function in mod/*modname*/lib.php '*modname*_get_relevant_capabilites'

Created: 24/Sep/07 11:43 AM   Updated: 30/Jul/08 12:36 AM
Return to search
Component/s: Roles
Affects Version/s: 1.9
Fix Version/s: 1.9.3

File Attachments: 1. Text File caps_levels_4.patch (28 kB)
2. Text File caps_levels_5.patch (28 kB)
3. Text File get_relevant_capabilities.patch (4 kB)

Issue Links:
Relates

Participants: Eloy Lafuente (stronk7), Jamie Pratt, Martin Dougiamas, Petr Skoda and Tim Hunt
Security Level: None
Resolved date: 25/Jul/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
I left this bug to be assigned automatically since I want the maintainer of the roles and capabilities code to take a look at the idea. I'm willing to code this though so assign the bug to me if you approve of the proposed feature addition and I can do it in the next few days.

I want to allow a new optional function in mod/*modname*/lib.php '*modname*_get_relevant_capabilites' that returns an array of capabilities.

This is needed so that activity modules can specify additional capabilities that should appear in the in addition to the ones specifically for this module, that should be displayed in the 'Override Roles' sub tab (override.php) for a module context.

An example of extra capabilities should be overridable in the module context are question capabilities for questions that are shared in the module context. The question code tests the users permissions for what they can do with questions in the context in which the questions are shared.

For background see : http://moodle.org/mod/forum/discuss.php?d=80386

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 24/Sep/07 12:25 PM
At a glance, this seems like a good idea. I need to think a bit more about it though ... there might be better ways to do this, such as through extra fields in the access.php files ...

Jamie Pratt added a comment - 24/Sep/07 01:12 PM
I think an optional function in lib.php makes sense. Let me explain my thinking.

I think it makes sense to make capabilities at the module context level dependent on the module, this will reduce the clutter of irrelevant capabilities being displayed at the module context level. And if what capabilities are displayed in the UI at module context level are dependent on the module, then there must be a way in the module api for the module author to tell Moodle what extra capabilities are relevant for THIS module.


Tim Hunt added a comment - 07/Mar/08 04:26 AM
We need this at the OU to control editing of questions on high-stakes summative quizzes. Therefore, I am going to implement this if no one tells me not to (and if Jamie does not beat me to it).

Tim Hunt added a comment - 07/Mar/08 06:36 AM
I think this patch is all that is required. Pretty simple really.

Sadly, Martin is on his travels, so we may not get a yes/no to commit this for a week or so.


Tim Hunt added a comment - 08/Mar/08 02:05 AM
Petr wants to try a better patch that solves this and more, so sending over to him.

Eloy Lafuente (stronk7) added a comment - 08/Mar/08 02:31 AM
As said in HQ chat...

+1 for this idea (being able to specify relevant capabilities for contexts not belonging to them). Current patch looks safe (and sure Petr's one will be).

-0.5 for being too much revolutionary in 19_STABLE

Ciao


Petr Skoda added a comment - 08/Mar/08 02:32 AM - edited
the idea is to combine several patches for roles UI changes, set up demo site, ask MD for confirmation, rework, demo, confirmation, cvs and then big celebrations

Jamie Pratt added a comment - 22/Jun/08 05:47 PM
I wonder what happened about this idea to overhaul the roles UI? I linked an issue to this one - we have introduced db/ sub folders for quiz reports. And they can include access.php files, but some work needs to be done on the UI to get them to display properly in the roles UI.

I have proposed a fix for problems in the linked bug. See that bug for details.


Petr Skoda added a comment - 22/Jun/08 07:29 PM
hello, I doubt this will be part of 1.9.x

Jamie Pratt added a comment - 23/Jun/08 03:06 PM
The quiz report db folders will only be available from 2.0. I wonder if something will be done on this in 2.0 and / or whether I should use the patch in MDL-15340 to fix the problem for displaying quiz report capabilities for the time being?

Petr Skoda added a comment - 23/Jun/08 05:01 PM
The file/repo API work started today, I hope I will be able to work on all role/enrolment related stuff after this. (2 months from now?)

Petr Skoda added a comment - 24/Jul/08 02:10 PM
sending patch with something like this implemented + changed a lot of context levels in cap definitions and improved sorting of caps

Martin Dougiamas added a comment - 24/Jul/08 02:14 PM
Looks great! +1

Petr Skoda added a comment - 25/Jul/08 05:59 AM
should be fixed in cvs
please test

Petr Skoda added a comment - 30/Jul/08 12:36 AM
toto: document in coding guide somewhere