summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-13 14:31:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-13 14:31:58 +0000
commit453803c68f24f1815ba001a70807dd65f909545c (patch)
tree497bf24bdd5093ae101dc5aad1ec93759aea45c3 /app
parent07b44a46628c1fc5ac9797b3b376f48c986c8d1b (diff)
downloadredmine-453803c68f24f1815ba001a70807dd65f909545c.tar.gz
redmine-453803c68f24f1815ba001a70807dd65f909545c.zip
Don't consider roles without issue add/edit permissions for determining fields permissions (#15988).
git-svn-id: http://svn.redmine.org/redmine/trunk@13747 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/issue.rb1
-rw-r--r--app/models/role.rb4
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 31c427bd6..582973343 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -539,6 +539,7 @@ class Issue < ActiveRecord::Base
user_real = user || User.current
roles = user_real.admin ? Role.all.to_a : user_real.roles_for_project(project)
+ roles = roles.select(&:consider_workflow?)
return {} if roles.empty?
result = {}
diff --git a/app/models/role.rb b/app/models/role.rb
index c6a6b4979..790b0426c 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -113,6 +113,10 @@ class Role < ActiveRecord::Base
!permissions.nil? && permissions.include?(perm.to_sym)
end
+ def consider_workflow?
+ has_permission?(:add_issues) || has_permission?(:edit_issues)
+ end
+
def <=>(role)
if role
if builtin == role.builtin