Patch #25491

List of role members

Added by David Côté-Tremblay 7 months ago. Updated 5 months ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-

Description

This simple patch provides a list of all members of a role grouped by projects.

Tested and working with Redmine 3.2 & 3.3

list-of-role-members.patch Magnifier (3.47 KB) David Côté-Tremblay, 2017-03-31 23:10

members.jpg (23.7 KB) David Côté-Tremblay, 2017-03-31 23:12

list.jpg (21.2 KB) David Côté-Tremblay, 2017-03-31 23:12

role-members-by-project.png (59.5 KB) Go MAEDA, 2017-04-01 10:59

members-link-before.png (8.55 KB) Go MAEDA, 2017-04-01 11:39

members-link-after.png (8.63 KB) Go MAEDA, 2017-04-01 11:40

25491-list-of-role-members-v3.diff Magnifier (4.78 KB) Go MAEDA, 2017-05-01 07:47

History

#1 Updated by David Côté-Tremblay 7 months ago

#3 Updated by Go MAEDA 7 months ago

Screenshot of "Members" view introduced by this patch. "eCookbook", "OnlineStore" and "Private child of eCookbook" are project name.

#4 Updated by Go MAEDA 7 months ago

I slightly changed the patch.

  • Replaced :notice_file_not_found ("The page you were trying to access doesn't exist or has been removed.") with :label_no_data ("No data to display") for consistency with other pages.
  • Always displays "Members" link to fix horizontal position of sort handle.

before - sort handle horizontal position is not aligned:

after:

#5 Updated by David Côté-Tremblay 7 months ago

Thank you very much for those fixes !

#6 Updated by Toshi MARUYAMA 6 months ago

Go MAEDA wrote:

I slightly changed the patch.

It seems app/views/roles/members.html.erb is missing in your patch.

#7 Updated by Go MAEDA 6 months ago

  • File deleted (25491-list-of-role-members-v2.diff)

#8 Updated by Go MAEDA 6 months ago

Toshi MARUYAMA wrote:

It seems app/views/roles/members.html.erb is missing in your patch.

Fixed my patch and attached 25491-list-of-role-members-v3.diff. Thank you for pointing it out.

#9 Updated by Mischa The Evil 5 months ago

  • Status changed from New to Needs feedback

I think this could be a useful addition for instances with bigger number of users, roles and projects. I've tried the patch from note-8 (after manually transplanting it to source:/trunk@16580) for testing, but it seems something is wrong. I get the following error upon request:

Started GET "/roles/3/members" for 192.168.1.3 at 2017-06-02 09:31:47 +0200
Processing by RolesController#members as HTML
  Parameters: {"id"=>"3"}
  SQL (4.0ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2017-06-02 09:31:47' WHERE `tokens`.`user_id` = 1 AND `tokens`.`value` = '<<snip>>' AND `tokens`.`action` = 'session'
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (0.1ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 1 LIMIT 1
  Current user: admin (id=1)
  Role Load (0.1ms)  SELECT  `roles`.* FROM `roles` WHERE `roles`.`id` = 3 LIMIT 1
  Member Load (1.2ms)  SELECT `members`.* FROM `members` INNER JOIN `member_roles` ON `member_roles`.`member_id` = `members`.`id` INNER JOIN `roles` ON `roles`.`id` = `member_roles`.`role_id` INNER JOIN `users` ON `users`.`id` = `members`.`user_id` AND `users`.`type` IN ('User', 'AnonymousUser') WHERE `roles`.`id` = 3 GROUP BY `users`, `members`.`id`
Completed 500 Internal Server Error in 22ms (ActiveRecord: 5.6ms)

ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'users' in 'group statement': SELECT `members`.* FROM `members` INNER JOIN `member_roles` ON `member_roles`.`member_id` = `members`.`id` INNER JOIN `roles` ON `roles`.`id` = `member_roles`.`role_id` INNER JOIN `users` ON `users`.`id` = `members`.`user_id` AND `users`.`type` IN ('User', 'AnonymousUser') WHERE `roles`.`id` = 3 GROUP BY `users`, `members`.`id`):
  app/controllers/roles_controller.rb:107:in `members'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Am I missing something?

Also available in: Atom PDF