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/global_roles/permission_patch.rb

30 lines
671 B

module GlobalRoles
module PermissionPatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :initialize, :global_option
end
end
module InstanceMethods
def initialize_with_global_option(name, hash, options)
@global = options[:global] || false
initialize_without_global_option(name, hash, options)
end
def global?
@global || global_require
end
private
def global_require
@require && @require == :global
end
end
end
end
Redmine::AccessControl::Permission.send(:include, GlobalRoles::PermissionPatch)