anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
182 stars 72 forks source link

Know if a user has a certain role #224

Closed lcasanova78 closed 3 years ago

lcasanova78 commented 3 years ago

I have a code that performs an action if the user is Developer_External and another one if he is not, I am using this expression to know if he is: @developerExternal = User.current.roles_for_project(@issue.project).include?(Role.find(:first, :conditions => "name='Developer_External'"))

But it returns this error: Couldn't find all Roles with 'id': (first, {:conditions=>"name='Developer_External'"}) (found 0 results, but was looking for 2).

And I don't know what could be wrong

lcasanova78 commented 3 years ago

This works for me: @developerExternal = User.current.roles_for_project(@issue.project).include?(Role.find_by_name('Developer_External'))