Hi,
I'm assuming that based on the issue queue and lack of recent commits that this module is no longer actively maintained, and that the likelyhood of this patch making it in is extremely low, but I'm putting this out there for anyone who will gain some benefit from it.
The patch adds the ability to filter a User View based on the Administer Users by Role edit permissions, which in combination with the User management View defined in the latest 1.10 Beta of the Views Bulk Operations module (or a another User View) makes for a better user experience by only showing editable users instead of showing all users and simply erring when the user tries to edit a user they don't have permission to edit.
Hope someone finds this useful as it wasn't the easiest thing in the world to get working.
Cheers,
Deciphered.
Comments
Comment #1
sinasalek CreditAttribution: sinasalek commentedThe latest version of this module as a VBO action "delegate roles" which show only the roles that logged in user can manage.
For filtering views result by role you can achieve that by adding role filter to your views, this approach however is actually a workaround and doesn't work if you have multiply users able to delegate different roles.
Comment #3
sinasalek CreditAttribution: sinasalek commentedTried on D7, and same problem there too. Also you might want to try Role Delegation module in combination with this module
Comment #4
Deciphered CreditAttribution: Deciphered commentedBeing from 2 years ago I seriously doubt I have any need for this anymore, so feel free to close it off completely, no idea what the particular project was or wether this patch or solution was used in the end.
Cheers,
Deciphered.
Comment #5
ptsimard CreditAttribution: ptsimard commentedHello,
We have this use-case in our organisation and really needed to filter the view by editable permission.
Thanks to a lot to Deciphered for the patch logic. I re-factored and tweaked it to work with Drupal 7 and the latest 1.x dev.
Please review!
Thanks
Comment #6
ptsimard CreditAttribution: ptsimard commentedReworked the code in value_form() because the way I changed the form was giving an error:
Here is the new patch
Comment #7
ptsimard CreditAttribution: ptsimard commentedOk, with this last patch, the filter User is editable will return true if a user has either edit or cancel permission. This allows listing the users with links Edit or Cancel (or both) depending on permissions.
Note: This patch still does not take into account any permissions suffixed with "and other roles" .
Comment #8
ptsimard CreditAttribution: ptsimard commentedThe latest patch missed the required code in administerusersbyrole.views.inc
Sorry for the shotgun patches. I really want this module to get in better shape.
Comment #9
AdamPS CreditAttribution: AdamPS commentedI've stepped in as a new co-maintainer and I share the desire to get the module into better shape!
I'm not a views expert, so sorry if I say something silly. But is there any reason that this is written to re-implement a detailed calculation done in _administerusersbyrole_can_edit_user rather than calling that function? It seems like rather a maintenance hazard as anyone changing the main code might break this aspect (which is probably not used and hence not tested by the majority of people).
Also you point out another problem yourself (although my current batch of fixes might make changes here anyway):
As it happens I will be changing the _administerusersbyrole_can_edit_user code as part of fixing a bunch of other issues. So the patch potentially would need changes too. But before you take your time to do that, bear in mind that I would be reluctant to accept it unless it can be based on _administerusersbyrole_can_edit_user.
Another factor that might help you is that I plan to make the default admin/people form only show editable users.
Comment #10
AdamPS CreditAttribution: AdamPS commentedOne other thought occurred to me. I believe that the code here isn't required to be in administerusersbyrole. It would work equally well in your own private custom module (or even in an add-on contributed module something like "administerusersbyrole-viewsextra").
If you agree, it means that if your code is perhaps not polished enough or not maintainable enough to justify being in this small and simple module it doesn't in any way prevent you from achieving what you need.
On the other hand, if you can write it in terms of _administerusersbyrole_can_edit_user I think that would be a good function for the module.
Comment #11
ptsimard CreditAttribution: ptsimard commentedOK. I'll take a look on Monday when I'm back at the office. See if I can improve it. Thanks for taking an interest.
Comment #12
kumkum29 CreditAttribution: kumkum29 commentedHello,
Have you made progress on the implementation of this new feature.
This feature is very useful for many cases.
Perhaps we can use a hook for implement this feature in a custom module? (more simply)
Thanks.
Comment #13
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedIn the latest release, this is possible. The solution is slightly different - not a filter but a query tag.
Edit the view, click Advanced then "Query settings" and add the tag "administerusersbyrole_edit_access". The view will only show users where there is edit permission.