Issue Details (XML | Word | Printable)

Key: MDL-14937
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Tim Hunt
Reporter: Howard Miller
Votes: 19
Watchers: 16
Operations

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

Please add Tim Hunt's "User's Roles" report into core

Created: 21/May/08 09:55 PM   Updated: 26/Nov/08 11:49 PM
Return to search
Component/s: Administration, Roles
Affects Version/s: 1.9.1
Fix Version/s: 2.0

Issue Links:
Blockers
 
Duplicate
 
Relates

Participants: Dan Poltawski, Eloy Lafuente (stronk7), Howard Miller, John Isner, John White and Tim Hunt
Security Level: None
Resolved date: 26/Nov/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
This is the most useful diagnostic feature I have seen in a long time. It would be fantastic to see it in core.

The only slight issue, is that looking for users by username is a bit cumbersome but I can live with it.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Howard Miller added a comment - 21/May/08 10:04 PM
Here's the place in the plugins database:

http://moodle.org/mod/data/view.php?rid=1005&page=16


Eloy Lafuente (stronk7) made changes - 21/May/08 11:00 PM
Field Original Value New Value
Assignee Eloy Lafuente (stronk7) [ stronk7 ] Martin Dougiamas [ dougiamas ]
Eloy Lafuente (stronk7) added a comment - 21/May/08 11:00 PM
Assigning this to Martin... ciao

John Isner added a comment - 22/May/08 12:06 AM
Not so fast.

Do we want (1) a tool for debugging actual roles-related problems or (2) a tool allowing administrators to run academic what-if scenarios? Both are valid use cases, but for me (1) is far more important.

Tim and I discussed this in: http://moodle.org/mod/forum/discuss.php?d=91993

If we want a tool for (2), we should consider incorporating the functionality of the Role debugger into core.

http://moodle.org/mod/data/view.php?d=13&rid=1204

The Role Debugger can be used by any user, not just the administrator, and it gives the user a complete analysis of his own permissions, not just his role assignments. I gave an extended use case for it in MDL-13228 ("Improve the transparency of Roles...").

Please do not misunderstand me: I have been using the User's roles report since March, and I find it very handy for getting a quick snapshot of a user's global role assignments.

I have helped dozens of users debug complex roles-related problems using the Roles debugger (see the use case "A roles expert helping a roles novice debug a roles-related problem"), usually in a single iteration. These were problems of the most difficult kind – self inflicted problems created by administrators who had fiddled with roles without understanding what they were doing. In some cases the administrators could not access the site administration block.

Anyway, this issue should be linked to MDL-13228.


Howard Miller made changes - 22/May/08 03:21 AM
Link This issue has a non-specific relationship to MDL-13228 [ MDL-13228 ]
Howard Miller added a comment - 22/May/08 03:25 AM
I must admit that I only quickly looked at the roles debugger and couldn't figure out what it did, but that's my impatience.

I like Tim's report, because it hit the nail on the head for functionality that I have been missing. If I am sorting out a roles problem, the number one problem is that there is, by default, no way at all to tell what roles a user has throughout the site. Of course, this is 99% the root of roles problems - you didn't know about a role assigned somewhere else. In a complex Moodle site, even if you do know about the assignment, it can be very hard to find. I always considered this a surprising omission.

Tim's addon is very simple and, I suspect, solves a huge percentage of roles problems. However, I'm not partisan about it - but, we need to get something in to handle this function.


Howard Miller added a comment - 22/May/08 05:11 PM
And, of course, I've just realised that the search is not only by username it is (for the record) a fuzzy match on firstname, lastname, username, and idnumber.

Martin Dougiamas made changes - 22/May/08 10:09 PM
Affects Version/s 2.0 [ 10122 ]
Fix Version/s 1.9.2 [ 10280 ]
John White added a comment - 23/May/08 03:03 AM
Also, whereas John Isner is right - a complex permissions analysis tool would be a great boon, this User's Roles tool from Tim is very useful, and would I suspect, be very easy to port into the core. But, dare I ask, could it be titled "Assigned roles" which is a little less difficult to say and lays the emphasis on what has been assigned rather than the permissions that will result.

Howard Miller added a comment - 23/May/08 03:59 AM
I agree. I guess it just needs the strings done and it's pretty much there. I'm not sure it should be in Reports though - probably in the user section may make more sense. Mmm... not sure.

On a site note.... the ajax name lookup is inspired! I find myself wishing things like the roles assign screen did something similar.


John White added a comment - 23/May/08 04:48 AM
...because it isn't strictly a report, since you can also change the role assignments within it.

Howard Miller made changes - 03/Jul/08 11:03 PM
Assignee Martin Dougiamas [ dougiamas ] Howard Miller [ howardsmiller ]
Petr Skoda made changes - 05/Jul/08 11:09 PM
Fix Version/s 1.9.3 [ 10290 ]
Fix Version/s 1.9.2 [ 10280 ]
Howard Miller made changes - 25/Jul/08 11:08 PM
Link This issue is blocked by CONTRIB-616 [ CONTRIB-616 ]
Howard Miller made changes - 28/Jul/08 04:08 AM
Link This issue has been marked as being related by MDL-13538 [ MDL-13538 ]
Martin Dougiamas made changes - 15/Oct/08 03:00 PM
Fix Version/s 1.9.3 [ 10290 ]
Fix Version/s 1.9.4 [ 10300 ]
Tim Hunt added a comment - 27/Oct/08 05:31 PM
This is on my todo list for Moodle 2.0, so taking.

Tim Hunt made changes - 27/Oct/08 05:31 PM
Fix Version/s 1.9.4 [ 10300 ]
Component/s Roles [ 10097 ]
Fix Version/s 2.0 [ 10122 ]
Assignee Howard Miller [ howardsmiller ] Tim Hunt [ timhunt ]
Tim Hunt made changes - 28/Oct/08 06:29 PM
Link This issue is duplicated by MDL-11186 [ MDL-11186 ]
Tim Hunt made changes - 30/Oct/08 10:44 AM
Link This issue is duplicated by MDL-10098 [ MDL-10098 ]
tjhunt committed 5 files to 'Moodle CVS' - 21/Nov/08 05:23 PM
roles / profile: MDL-14937 A the user's roles report from contrib to core.

This is work in progress. I have integrated it into the profile tabs. Now I just need to make it work again.
MODIFY user/tabs.php   Rev. 1.70    (+22 -10 lines)
MODIFY admin/roles/tabs.php   Rev. 1.41    (+7 -15 lines)
MODIFY admin/roles/check.php   Rev. 1.2    (+12 -12 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.82    (+12 -1 lines)
ADD admin/roles/usersroles.php   Rev. 1.1    (+0 -0 lines)
tjhunt committed 3 files to 'Moodle CVS' - 24/Nov/08 03:33 PM
roles / profile: MDL-14937 A the user's roles report from contrib to core. Finish.
MODIFY admin/roles/usersroles.php   Rev. 1.2    (+128 -114 lines)
MODIFY theme/standard/styles_layout.css   Rev. 1.644    (+6 -1 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.83    (+16 -26 lines)
Tim Hunt added a comment - 24/Nov/08 03:35 PM
Done. Now integrated into the roles tab in the users profile.

We may need to think a bit harder about exactly who should be seeing this information. At the moment, it is shown to anyone who can see the roles tab (the rules for that have not changed).

Note that the part about bulk removing role assignments has gone. That may come back, but only if I have time to work on MDL-10002.


Tim Hunt made changes - 24/Nov/08 03:35 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Mitsuhiro Yoshida committed 2 files to 'Lang CVS' - 25/Nov/08 02:43 AM
MDL-14937 MDL-17323 Translated new strings for role.
MODIFY ja_utf8/role.php   Rev. 1.82    (+15 -1 lines)
MODIFY ja_utf8/README   Rev. 1.875    (+1 -1 lines)
Dan Poltawski added a comment - 26/Nov/08 11:35 PM
Reopening this. One sql query seems to refer to active field in role_assigments which doesn't currently exist:

Unknown column 'ra.active' in 'where clause'

SELECT ra.id, ra.userid, ra.contextid, ra.roleid, ra.enrol, c.path, r.name AS rolename, COALESCE(rn.name, r.name) AS localname FROM mdl_role_assignments ra JOIN mdl_context c ON ra.contextid = c.id JOIN mdl_role r ON ra.roleid = r.id LEFT JOIN mdl_role_names rn ON rn.roleid = ra.roleid AND rn.contextid = ra.contextid WHERE ra.userid = ? AND ra.active = 1 ORDER BY contextlevel DESC, contextid ASC, r.sortorder ASC
[array ( 0 => '2', )]

  • line 292 of lib/dml/moodle_database.php: dml_read_exception thrown
  • line 501 of lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 78 of admin/roles/usersroles.php: call to mysqli_native_moodle_database->get_records_sql()

Dan Poltawski made changes - 26/Nov/08 11:35 PM
Status Resolved [ 5 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
tjhunt committed 1 file to 'Moodle CVS' - 26/Nov/08 11:49 PM
roles / profile: MDL-14937 remove reference to ra.active column until MDL-13240 is done.
MODIFY admin/roles/usersroles.php   Rev. 1.4    (+2 -2 lines)
Tim Hunt added a comment - 26/Nov/08 11:49 PM
Ah, that will be because I was testing the patch on MDL-13240 before. Thanks for reporting this.

Tim Hunt made changes - 26/Nov/08 11:49 PM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
martignoni committed 1 file to 'Lang CVS' - 07/Dec/08 07:57 PM
MDL-14937 strings translated
MODIFY fr_utf8/role.php   Rev. 1.103    (+12 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 07/Dec/08 11:28 PM
MDL-14937 strings for user role report
MODIFY fr_utf8/role.php   Rev. 1.104    (+6 -2 lines)