Redmine::AccessControl.permission might return nil

Don't know why it does and why this suddenly occurs, but this change should not be harmful.
pull/6827/head
Gregor Schmidt 13 years ago
parent 811c160204
commit 36fb75b942
  1. 7
      lib/costs_role_patch.rb

@ -27,13 +27,16 @@ module CostsRolePatch
else
# check, if the role has one of the parent permissions granted
permission = Redmine::AccessControl.permission(action)
return if permission.blank?
(permission.inherited_by + [permission]).map(&:name).detect {|parent| allowed_inherited_permissions.include? parent}
# if parents = self.class.permission_tree[action]
# parents = [parents] unless parents.is_a? Array
# parents.each {|parent| return true if allowed_to? parent, for_user}
# end
#
#
# # check, if the current user can see the own objects of for_user
# if personal = personal_permissions[action]
# return true if ((for_user == User.current) && allowed_to?(personal, nil))
@ -60,4 +63,4 @@ module CostsRolePatch
end
end
Role.send(:include, CostsRolePatch)
Role.send(:include, CostsRolePatch)

Loading…
Cancel
Save