Moodle

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

Details

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

Description

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

  1. caps_levels_4.patch
    24/Jul/08 2:10 PM
    28 kB
    Petr Škoda (skodak)
  2. caps_levels_5.patch
    24/Jul/08 2:15 PM
    28 kB
    Petr Škoda (skodak)
  3. get_relevant_capabilities.patch
    07/Mar/08 6:36 AM
    4 kB
    Tim Hunt

Issue Links

Activity

Hide
Martin Dougiamas added a comment -

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 ...

Show
Martin Dougiamas added a comment - 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 ...
Hide
Jamie Pratt added a comment -

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.

Show
Jamie Pratt added a comment - 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.
Hide
Tim Hunt added a comment -

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).

Show
Tim Hunt added a comment - 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).
Hide
Tim Hunt added a comment -

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.

Show
Tim Hunt added a comment - 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.
Hide
Tim Hunt added a comment -

Petr wants to try a better patch that solves this and more, so sending over to him.

Show
Tim Hunt added a comment - Petr wants to try a better patch that solves this and more, so sending over to him.
Hide
Eloy Lafuente (stronk7) added a comment -

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

Show
Eloy Lafuente (stronk7) added a comment - 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
Hide
Petr Škoda (skodak) added a comment - - 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

Show
Petr Škoda (skodak) added a comment - - 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
Hide
Jamie Pratt added a comment -

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.

Show
Jamie Pratt added a comment - 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.
Hide
Petr Škoda (skodak) added a comment -

hello, I doubt this will be part of 1.9.x

Show
Petr Škoda (skodak) added a comment - hello, I doubt this will be part of 1.9.x
Hide
Jamie Pratt added a comment -

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?

Show
Jamie Pratt added a comment - 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?
Hide
Petr Škoda (skodak) added a comment -

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?)

Show
Petr Škoda (skodak) added a comment - 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?)
Hide
Petr Škoda (skodak) added a comment -

sending patch with something like this implemented + changed a lot of context levels in cap definitions and improved sorting of caps

Show
Petr Škoda (skodak) added a comment - sending patch with something like this implemented + changed a lot of context levels in cap definitions and improved sorting of caps
Hide
Martin Dougiamas added a comment -

Looks great! +1

Show
Martin Dougiamas added a comment - Looks great! +1
Hide
Petr Škoda (skodak) added a comment -

should be fixed in cvs
please test

Show
Petr Škoda (skodak) added a comment - should be fixed in cvs please test
Hide
Petr Škoda (skodak) added a comment -

toto: document in coding guide somewhere

Show
Petr Škoda (skodak) added a comment - toto: document in coding guide somewhere

People

Dates

  • Created:
    Updated:
    Resolved: