OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/global_roles/patches/access_control_patch.rb

31 lines
995 B

module OpenProject::GlobalRoles::Patches
module AccessControlPatch
def self.included(base)
base.send(:extend, ClassMethods)
base.class_eval do
class << self
alias_method :available_project_modules_without_no_global, :available_project_modules unless method_defined?(:available_project_modules_without_no_global)
alias_method :available_project_modules, :available_project_modules_with_no_global
end
end
end
module ClassMethods
def available_project_modules_with_no_global
@available_project_modules = (
@permissions.reject{|p| p.global? }.collect(&:project_module) +
@project_modules_without_permissions
).uniq.compact
available_project_modules_without_no_global
end
def global_permissions
@permissions.select {|p| p.global?}
end
end
end
end
Redmine::AccessControl.send(:include, OpenProject::GlobalRoles::Patches::AccessControlPatch)