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

39 lines
839 B

require_dependency 'redmine/access_control'
module OpenProject::GlobalRoles::Patches
module PermissionPatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
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
def global=(bool)
@global = bool
end
private
def global_require
@require && @require == :global
end
end
end
end
Redmine::AccessControl::Permission.send(:include, OpenProject::GlobalRoles::Patches::PermissionPatch)