Project

General

Profile

Actions

Feature #8313

open

Restrict Assignee List by Role

Feature #8313: Restrict Assignee List by Role

Added by Andrew Parnell over 15 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues workflow
Target version:
-
Resolution:

Description

Currently the assignee list shows every member of a project. This means that anyone in the project can assign a ticket to anyone else in the project. It would be great if there was a way to restrict the possible assignees depending on your role and the roles of the possible assignees.

For example: We have Managers, Developers, and Reports working together on a project. The Managers should be able to assign tickets to anyone of all three roles. The Developers should be able to assign tickets to Managers or other Developers. The Reporters should only be able to assign tickets to Managers.

The primary function of this will be so that those project members who are of the Reporter role are not able to open a ticket and assign it straight to a developer.


Related issues 4 (3 open — 1 closed)

Related to Redmine - Feature #8050: Mightful workflow field enhancement: visible, read only and mandatory ClosedActions
Related to Redmine - Feature #12005: Mightful workflow field enhancement: hideNewActions
Related to Redmine - Feature #2937: Filter assignable users based on workflowNewActions
Related to Redmine - Patch #212: Assign To limited by workflowNewActions

Updated by Terence Mill over 15 years ago Actions #1

This is a subset of the featured i proposed here: "Mightful workflow field enhancement: visible, read only and mandatory" #8050

Updated by Terence Mill over 15 years ago Actions #2

I fact your proposal makes filter on value of field based on user's role not only the complete field visbility (visble, redonly, mandatory) as described in #8050. So your feature request is an ehancement of #8050 - shal be set related each other.

Updated by Daniel Felix almost 14 years ago Actions #3

I set the relations to #8050 and #12005 (which follows #8050).

This would be a nice idea. But I think this could be really complicated to manage, or?

What do you thing about role restriction?
A user just can reassign a ticket to another user, which holds a role he's allowed to use.

Example:
User A is in role developer. Role developer only allows to assign tickets to reporters and to other users with the role developers.
User B is in role senior developer. He is allowed to assign tickets to users, developers, senior developers and managers.

What do you think about this proposal?

Updated by Ramesh S almost 14 years ago Actions #4

What do you thing about role restriction?
A user just can reassign a ticket to another user, which holds a role he's allowed to use.

+1
I think this is a great idea, and it will help restrict who can assign an issue to who, based on the roles. And in the use case where we are trying to setup one redmine project per customer with 'customer', 'manager' and 'developer' all having access to this redmine project, a feature like this will help in restricting who can assign issue to who as it is very important as we don't want customer to directly assign issue to developer.

I can help test this feature if a patch is available.

Updated by Rupesh Helwade almost 13 years ago Actions #5

+1

Updated by Daniele Pedroni almost 13 years ago Actions #6

I agree, it would be quite necessary at least to limit the assignee list to some roles (and by project).
Then, the capability to allow/deny issue assignment based on roles could be a good enhancement, but a bit less important, IMHO.

This would speedup the search: large teams will lead to impressive lists of possible assignees, not that comfortable to manage...

Updated by Jethro Yu almost 13 years ago Actions #7

+1. In our process RD (role) can only assign a changing-to-verification issue to QA (role), but some RD will assign verification to PM (role), which is not expected.

Updated by Thomas Tingey over 12 years ago Actions #8

+1 This would be super useful. We want to be able for our sales team to only assign tickets to managers who then can assign them to developers.

Updated by Paul Chu almost 12 years ago Actions #9

+1.
Any update?
This feature seems related to #2937 (Filter assignable users based on workflow)
It would be very helpful if the assignee list is changed corresponding to issue status.
We are waiting for such feature implemented.

Updated by Toshi MARUYAMA over 11 years ago Actions #10

  • Related to Feature #2937: Filter assignable users based on workflow added

Updated by Luis Roa over 10 years ago Actions #11

Hi. I created a new plugin to filter assignable users based on workflow.

https://github.com/luisr9/redmine_filter_assignable

I'm newbie in ruby, but I believe and I hope this work for you too, sorry for my english.

Updated by Beslan CELIKCAN over 10 years ago Actions #12

Hi Luis,

How can i use this plugin. Redmine says installed but nothing changed in workflow page.

Updated by Luis Roa over 10 years ago Actions #13

Hi, Beslan CELIKCAN.

You can find change in edit issue page, when you select a assignable user, you don't see all user list, you only see the users who can change the next status.

For example:
Your project has these roles: "client", "manager" and "programmers" and your workflow is:

Client creates issues with new status.
Manager can change status from new to assigned.
Programmers can change from assigned to resolved.
Client can change status from resolved to closed.

When manager changes status to "assigned", in the dropdownlist assignee_to only members with programmers role are available, because in your workflow only programmers can change from "assigned" status to other status.

I hope you understand, sorry for my terrible english. :|

Updated by Beslan CELIKCAN over 10 years ago Actions #14

Thanks Luis. I,ll try.

Luis Roa wrote:

Hi, Beslan CELIKCAN.

You can find change in edit issue page, when you select a assignable user, you don't see all user list, you only see the users who can change the next status.

For example:
Your project has these roles: "client", "manager" and "programmers" and your workflow is:

Client creates issues with new status.
Manager can change status from new to assigned.
Programmers can change from assigned to resolved.
Client can change status from resolved to closed.

When manager changes status to "assigned", in the dropdownlist assignee_to only members with programmers role are available, because in your workflow only programmers can change from "assigned" status to other status.

I hope you understand, sorry for my terrible english. :|

Updated by prathamesh r over 10 years ago Actions #15

Thanks Luis, I tried the plugin & found to be working with the latest Redmine installation (Bitnami).

I also want to try few things like restrict individual users from assinee & keep only the groups in assign user etc.

I am very new to redmine & ruby both. I dont want to go into very details but want to write the codes you have written. Can you please let me know reference you have taken using which you have written this code. currently i am not getting the reference material from net using which i can write such code.

Please confirm is the following code only is filtering the assignees ? or there is more code in the plugin you have provided.


require_dependency 'issue'

class Issue

  def assignable_users_with_filter_assignable
    users = project.assignable_users.where("role_id IN (?)",
    WorkflowTransition.where(:tracker_id => tracker_id, :old_status_id => status_id).select(:role_id).distinct.map { |e| e.role_id }
    ).to_a
    users << author if author && author.active?
    users << assigned_to if assigned_to
    users.uniq.sort
  end

  alias_method_chain :assignable_users, :filter_assignable
end

Updated by Luis Roa over 10 years ago Actions #16

Hello prathamesh r,

Exactly, these code does the work.

I was searching the text "assign" in redmine's source code, and I found this method, this patch #212 was helpfull for write the plugin too.

I think that is possible keep only the groups in assign user, I want to modify the plugin for to choose what type of user. "users", "groups", "both", I will research how complete this task.

workaround:

def assignable_users_with_filter_assignable
    types = ['Group']    
    users = project.assignable_users.where(:type=>types).where("role_id IN (?)",
    WorkflowTransition.where(:tracker_id => tracker_id, :old_status_id => status_id).select(:role_id).distinct.map { |e| e.role_id }
    ).to_a
    users << author if author && author.active?
    users << assigned_to if assigned_to
    users.uniq.sort
end

Updated by prathamesh r over 10 years ago Actions #17

Thanks Luis, it worked as expected :). Thanks for support.

I was searching the type of user part like is it "users", "groups", "both", however i was not able to get these details.

Is going through existing redmine source code is only solution for creation of plugins ? there is noting like documentation where it is mentioned that type of users are of 3 category etc...

Updated by Luis Roa over 10 years ago Actions #18

Hi guys, Lo prometido es deuda

I modified the plugin, now you can choose kind of users to show in assign.

In plugin's settings you can find 3 options: show users, show groups and show author.

If you can't see the group, you could enable "Allow issue assignment to groups" in Issue traking tab of application's settings.

P.d: Prathamesh, you can uncheck "show users" and "show author" and this plugins works for you.

url plugin: https://github.com/luisr9/redmine_filter_assignable

Updated by Toshi MARUYAMA over 10 years ago Actions #19

  • Related to Patch #212: Assign To limited by workflow added

Updated by ale dp about 10 years ago Actions #20

Luis Roa wrote:

Hi guys, Lo prometido es deuda

I modified the plugin, now you can choose kind of users to show in assign.

In plugin's settings you can find 3 options: show users, show groups and show author.

If you can't see the group, you could enable "Allow issue assignment to groups" in Issue traking tab of application's settings.

P.d: Prathamesh, you can uncheck "show users" and "show author" and this plugins works for you.

url plugin: https://github.com/luisr9/redmine_filter_assignable

Hello Luis , works for any version of Redmine ? I use version 2.5. Thanks

Updated by Luis Roa about 10 years ago Actions #21

ale dp wrote:

Luis Roa wrote:

Hi guys, Lo prometido es deuda

I modified the plugin, now you can choose kind of users to show in assign.

In plugin's settings you can find 3 options: show users, show groups and show author.

If you can't see the group, you could enable "Allow issue assignment to groups" in Issue traking tab of application's settings.

P.d: Prathamesh, you can uncheck "show users" and "show author" and this plugins works for you.

url plugin: https://github.com/luisr9/redmine_filter_assignable

Hello Luis , works for any version of Redmine ? I use version 2.5. Thanks

Hi Alejandra, I use version 3.1.2 and plugin works fine.

I think that this plugin would work on any version that have a "assignable_users" action in IssueController.

If you try the plugin and doesn't work, We could work together for find a solution, you can write a email to

Sorry for my bad english, I think that you speak spanish like me.

Updated by Geowolf Yeh over 9 years ago Actions #22

Luis Roa wrote:

For example:
Your project has these roles: "client", "manager" and "programmers" and your workflow is:

Client creates issues with new status.
Manager can change status from new to assigned.
Programmers can change from assigned to resolved.
Client can change status from resolved to closed.

When manager changes status to "assigned", in the dropdownlist assignee_to only members with programmers role are available, because in your workflow only programmers can change from "assigned" status to other status.

I hope you understand, sorry for my terrible english. :|

Hi, Luis:
Firstly, in order to filter assignee list with roles, I almost find all of Plugin Directory and yours are the more practical to use.

But my organization roles are more complex than these example.

For example:
We have the same roles with you.
Usually, my role often different with next progress role in the Workflow.
But some of our members can own the two roles at least.
If I'm "CLIENT", and both play the role of "PROGRAMMERS", I can assign to "CLIENT" and "PROGRAMMERS" in the assignee_to list.
My solution is add filter that the same role with issue editor can not appear in the assignee_to list.

So I try to add condition

where.not(:role_id => roles.map(&:id))

into IssueController_patch.rb below:

        users = project.assignable_users.where(:type => types).where.not(:role_id => roles.map(&:id)).where("role_id IN (?)",
            WorkflowTransition.where(:tracker_id => tracker_id, :old_status_id => status_id).select(:role_id).distinct.map { |e| e.role_id }
            ).to_a

But after migrate and restart Redmine, it doesn't work.
So how can I add the condition of filer the same role with issue editor in the assignee_to list?

I'm not first language in Eng. and hope you can recognize my terrible writting, too. HA!HA!:)

Updated by Luis Roa over 9 years ago Actions #23

Hi Geowolf Yeh,

If I understood your problem, you want to hide the assignable users that share the same role of the current user.

Can you tell me if it is?

replace this:

users = project.assignable_users.where(:type => types).where.not(:role_id => roles.map(&:id)).where("role_id IN (?)",
            WorkflowTransition.where(:tracker_id => tracker_id, :old_status_id => status_id).select(:role_id).distinct.map { |e| e.role_id }
            ).to_a

for this:

users = project.assignable_users.where(:type => types)        
        .where("role_id NOT IN (?)",User.current.roles_for_project(project).select(:role_id).distinct.map { |e| e.role_id })
        .where("role_id IN (?)",
        WorkflowTransition.where(:tracker_id => tracker_id, :old_status_id => status_id).select(:role_id).distinct.map { |e| e.role_id }
        ).to_a
Actions

Also available in: PDF Atom