Minor admin change - would this be useful to anyone else?

Minor admin change - would this be useful to anyone else?

by Tim Hunt -
Number of replies: 20
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have just implemented MDL-11784 internally for the OU. Would it be useful to anyone else? If so, I could check it into core.

It shows, in the table on the role assign page, a list of names, as well as the number of role holders, for roles where the number of people assigned the roles is between 1 and 10. For example:

Screenshot of the proposed change.

(Note, it only shows usernames because OU admin staff need to see them. If I checked this into core Moodle, I would take that out in line with Moodle security policies.)
Average of ratings: -
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Just H -
+1 from me Tim, nice enhancement smile
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?most

by Daniele Cordella -
Picture of Core developers Picture of Plugin developers
What I believe is important is to find a way to answer the question: what is the list of roles (in each context) of the user xx?
(and maybe a tool describing all useless roles because, for instance, redundant!!)
In reply to Daniele Cordella

Re: Minor admin change - would this be useful to anyone else?most

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have an admin report to list all the role assignments for a user. I should probably put it in contrib, and the modules and plugins database.

In interface for comparing the definition of two roles is definitely needed, but I don't think anyone has written one yet.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?most

by Daniele Cordella -
Picture of Core developers Picture of Plugin developers
Great. Share it, please. I posted a feature request asking for it. It is MDL-11186
In reply to Daniele Cordella

Re: Minor admin change - would this be useful to anyone else?most

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
OK. http://moodle.org/mod/data/view.php?d=13&rid=1005 (Once the moderators have approved it).

P.S. Helen, et al., if you see this. http://moodle.org/mod/data/view.php?d=13&rid=990 also needs re-approving in the plugins database, because I edited the entry.

Actually, I am forgetting, we have the database filter here, so I should not need to copy and past the full URL, I should just be able to type User's roles report, and it should magically be made into a link for me.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?most

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Thanks Tim, your database entries are approved. smile
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?most

by Daniele Cordella -
Picture of Core developers Picture of Plugin developers
Tim, I added a comment for you in http://tracker.moodle.org/browse/MDL-11186
In reply to Daniele Cordella

Re: Minor admin change - would this be useful to anyone else?most

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
These are Daniele's issues, copied here, since it is easier to discuss here than in the bug.

> 2nd. It doesn't work in Moodle 1.8 The risen error is: require_css: http://myserver/moodle18/lib/yui/autocomplete/assets/skins/sam/autocomplete.css - file not found.

OK, so it relies on a YUI version higher than the one in 1.8.

> 3rd. Plase add it to core release, at least, for M19

No. It is something I knocked up quickly for OU admin staff. It works, but it does not follow all the Moodle coding guidelines (for instance it reveals usernames). I am happy to share it, but before it goes into core, it would need further work, and I don't have time to do that.

Installing it is not very hard for people who want it. I would like to get the require_css idea into core, to go with require_js.

If anyone wants to develop this further, please be my guest.

> 4th. Please write somewhere in the istruction that the folder "userroles" has to be located to moodle/admin/report. It is obvious for you... but...

Done. That probably means that the database entry needs to be approved again.

> 5th. Maybe it can be added a GUI to find users. It is not always true the admin knows each user userid. Maybe some GUI like the one so add user to roles may result in a more friendly GUI

As I said, this was written for OU admin staff, who do work with usernames all the time. However, you will find that if you type a user's real name into the box, the Ajax autocomplete will find their username for you.

> 6th. In the list of roles reported, it would be nice to write in red redundant ones.

That is a hard calculation. I don't know how.

> Hei, I started my list from the second point. And the first, is it missing? Nooo, it is: 1st. Great. It is really useful, by my view point. Thank you.

My pleasure.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?most

by Daniele Cordella -
Picture of Core developers Picture of Plugin developers
I don't belong to group "Particularly helpful Moodlers"
but, please let me reply.

> Gruppo Particularly helpful Moodlers These are Daniele's issues, copied here, since it is easier to discuss here than in the bug.

Sorry but, I posted my issues there because this thread was opened for a different argument.

> That is a hard calculation. I don't know how.

Taking in mind the fundamental picture http://docs.moodle.org/en/Image:Moodle-contexts-1.8.png
my first, draft, simple, partial suggestion of approach is:

higher level: System
lower level: Blocks

capabilityArray is an empty array

for each context from higher to lower {
for each user role {
for each user capability {
look for capability into you capabilityArray
if ((current user already has the current capability at higher level context) || (current user has more at higher level context)) {
// this capability is useless.
Mark the current capability as useless.
} else {
add this capability with all needed attribute to the capabilityArray
}
}
if each capability of the current role is marked as useless {
notify the role is useless for the current user (or write the role in red or whatever you like)
} else {
write tis role in black
}
unmark all marked capabilities
}
}
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
My only worry is that I have bit of a dislike for arbitrarily long lists. That is that show the first n of a longer list, or only show if the list is less than n.

My issue is, how does a naive user know that? They may think, "there's three people in that role and nobody in the other", when in fact the "other" has 75 people in it.

It's a bit like the Profile page that shows a random selection of the first 20-odd courses you are in, with no obvious way of getting the complete list.
In reply to Howard Miller

Re: Minor admin change - would this be useful to anyone else?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
When there are more than 10, it does not list any names. I will definitely change it to display the message "More than 10" instead of blank. By the way, there is a constant at the top of the file, to make it easy to change 10.

In this case, the easiest way to get the full list of names is to click on the role name.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I checked this in to 1.9 beta2+ from the MoodleMoot Hack Fest earlier today.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Ray Lawrence -
Tim,

I'm curious why this enhancement was restricted to Admins only. Could it be implemented for other roles? I couldn't find a related capability.
In reply to Ray Lawrence

Re: Minor admin change - would this be useful to anyone else?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It's not restricted to admins. Anyone who can see the assign roles page will see it.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Ray Lawrence -
I was logged in as using an unmodified with more than 10 students assigned to the course. As an admin I see the "More than 10" link to the assign roles screen, as a teacher I don't see that.

I've just tested it with less than 10 students assigned and I see them listed. So there's a minor inconsistency bit it's not the end of the world.
Attachment nolink.png
In reply to Ray Lawrence

Re: Minor admin change - would this be useful to anyone else?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It is not an inconsistency, it is actually being clever, and only showing the extra column if there is at least one role with between 1 and 10 users assigned. Otherwise the column does not contain any useful information, so what is the point?

Admin can see more roles in the table, and probably one of them has fewer users assigned.
In reply to Tim Hunt

Re: Minor admin change - would this be useful to anyone else?

by Ray Lawrence -
Ah, I see. I still think that's equally useful to anyone with access to that table. Just my tuppence worth.