Don't show roles without issue add/edit permission in workflow setup (#15988).

git-svn-id: http://svn.redmine.org/redmine/trunk@13748 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-12-13 14:47:16 +00:00
parent 453803c68f
commit c886ffe200
5 changed files with 5 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ class WorkflowsController < ApplicationController
end end
def copy def copy
@roles = Role.sorted @roles = Role.sorted.select(&:consider_workflow?)
@trackers = Tracker.sorted @trackers = Tracker.sorted
if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any' if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any'

View File

@@ -36,7 +36,7 @@ class WorkflowRule < ActiveRecord::Base
target_roles = [target_roles].flatten.compact target_roles = [target_roles].flatten.compact
target_trackers = Tracker.sorted.to_a if target_trackers.empty? target_trackers = Tracker.sorted.to_a if target_trackers.empty?
target_roles = Role.all if target_roles.empty? target_roles = Role.all.select(&:consider_workflow?) if target_roles.empty?
target_trackers.each do |target_tracker| target_trackers.each do |target_tracker|
target_roles.each do |target_role| target_roles.each do |target_role|

View File

@@ -21,7 +21,7 @@ class WorkflowTransition < WorkflowRule
# Returns workflow transitions count by tracker and role # Returns workflow transitions count by tracker and role
def self.count_by_tracker_and_role def self.count_by_tracker_and_role
counts = connection.select_all("SELECT role_id, tracker_id, count(id) AS c FROM #{table_name} WHERE type = 'WorkflowTransition' GROUP BY role_id, tracker_id") counts = connection.select_all("SELECT role_id, tracker_id, count(id) AS c FROM #{table_name} WHERE type = 'WorkflowTransition' GROUP BY role_id, tracker_id")
roles = Role.sorted roles = Role.sorted.to_a.select(&:consider_workflow?)
trackers = Tracker.sorted trackers = Tracker.sorted
result = [] result = []
trackers.each do |tracker| trackers.each do |tracker|

View File

@@ -14,7 +14,7 @@
<%= form_tag({}, :method => 'get') do %> <%= form_tag({}, :method => 'get') do %>
<p> <p>
<label><%=l(:label_role)%>: <label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted, @roles, :id => 'role_id', :class => 'expandable' %> <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a> <a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a>

View File

@@ -14,7 +14,7 @@
<%= form_tag({}, :method => 'get') do %> <%= form_tag({}, :method => 'get') do %>
<p> <p>
<label><%=l(:label_role)%>: <label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted, @roles, :id => 'role_id', :class => 'expandable' %> <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a> <a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a>