Issue Details (XML | Word | Printable)

Key: MDL-8312
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Tim Hunt
Reporter: Sam Marshall
Votes: 1
Watchers: 9
Operations

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

Provide basic Assign Role that only shows roles appropriate to context level

Created: 26/Jan/07 01:21 AM   Updated: 06/Nov/08 04:35 PM
Return to search
Component/s: Roles
Affects Version/s: 1.8
Fix Version/s: 2.0

File Attachments: 1. Text File restricted_role_assign.patch.txt (29 kB)

Issue Links:
Relates
 

Participants: John Isner, Martin Dougiamas, Penny Leach, Petr Skoda, Sam Marshall and Tim Hunt
Security Level: None
Resolved date: 06/Nov/08
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
Assign Roles is more complex than it needs to be, because it always shows all roles that the current user is allowed to assign. For example if you do Assign Role for a course it shows 'Administrator' as an option, but that role isn't usually appropriate at course level. Similarly, it shows 'Student' at site level, where that role isn't usually appropriate.

There might be special cases where that kind of role assignment is useful but they are the exception not the rule. So I think it would be useful to have a 'Basic/Advanced' kind of set up for Assign Roles, where by default it shows only roles that usually apply at a given contextlevel, but if you click Advanced, you can assign others. Alternatively, maybe those special cases are so rare that it doesn't matter, and no Advanced mode is needed.

In order to configure this system, as part of defining a role, there would be a set of checkboxes for each contextlevel (site, category, course, module, etc). This would control entries in a database table such as mdl_role_contexts (role, contextlevel). That table could then be used to filter the display on the assign roles screen.

(Note that the OU may have time to implement this. If moodle hq would like us to, please let me know.)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
tjhunt committed 12 files to 'Moodle CVS' - 06/Nov/08 04:34 PM
role assign: MDL-8312 Restrict which roles can be assigned at which contextlevels.

* New table role_context_levels
* Populate table with defaults on install
* Populate table on upgrade with the same defaults, plus any additional ones needed to ensure all the role assignments already in the database are allowed.
* Change get_assignable_roles to respect these settings.
* UI for these settings on the add/edit role form.
* Save these settings when a role definition is saved.
* If in a context, there are no roles you can assign, display a polite message.
* Back up these settings.
* Restore these settings. When resotring a <=1.9.x backup file, any newly imported roles are set to be assignable at all contextlevels.

Restore not tested because it is broken in HEAD.
MODIFY lang/en_utf8/role.php   Rev. 1.72    (+4 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.245    (+76 -1 lines)
MODIFY lib/db/install.xml   Rev. 1.173    (+15 -3 lines)
MODIFY admin/roles/assign.php   Rev. 1.90    (+7 -3 lines)
MODIFY version.php   Rev. 1.868    (+1 -1 lines)
MODIFY backup/backuplib.php   Rev. 1.221    (+9 -2 lines)
MODIFY admin/roles/manage.php   Rev. 1.67    (+46 -2 lines)
MODIFY admin/roles/tabs.php   Rev. 1.37    (+5 -34 lines)
MODIFY admin/roles/override.php   Rev. 1.56    (+5 -1 lines)
MODIFY backup/restorelib.php   Rev. 1.351    (+26 -4 lines)
MODIFY admin/roles/Attic/manage.html   Rev. 1.44    (+20 -7 lines)
MODIFY lib/accesslib.php   Rev. 1.531    (+93 -21 lines)
Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 07/Nov/08 06:11 AM
MDL-17070 Translated new strings for admin.
MDL-17153 Updated translated strings for completion system.
MDL-17129 Translated new strings for error messages.
MDL-8312 Translated new strings for role.
MODIFY ja_utf8/completion.php   Rev. 1.6    (+3 -3 lines)
MODIFY ja_utf8/role.php   Rev. 1.77    (+7 -2 lines)
MODIFY ja_utf8/README   Rev. 1.859    (+1 -1 lines)
MODIFY ja_utf8/error.php   Rev. 1.102    (+5 -1 lines)
MODIFY ja_utf8/admin.php   Rev. 1.313    (+5 -2 lines)
tjhunt committed 1 file to 'Moodle CVS' - 07/Nov/08 11:51 AM
accesslib: MDL-17159 Fix regression I caused with MDL-8312.
MODIFY lib/accesslib.php   Rev. 1.532    (+8 -8 lines)
martignoni committed 1 file to 'Lang CVS' - 16/Nov/08 07:53 PM
MDL-8312 New strings
MODIFY fr_utf8/role.php   Rev. 1.94    (+4 -1 lines)