|
|
|
@ -4,23 +4,12 @@ module OpenProject::GlobalRoles::Patches |
|
|
|
|
base.send(:include, InstanceMethods) |
|
|
|
|
|
|
|
|
|
base.class_eval do |
|
|
|
|
#alias_method_chain :new, :global_roles |
|
|
|
|
alias_method_chain :create, :global_roles |
|
|
|
|
#alias_method_chain :index, :global_roles |
|
|
|
|
alias_method_chain :new, :global_roles |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
module InstanceMethods |
|
|
|
|
# def create |
|
|
|
|
# if params['global_role'] |
|
|
|
|
# create_global_role |
|
|
|
|
# else |
|
|
|
|
# new |
|
|
|
|
|
|
|
|
|
# render :template => 'roles/new' if @role.errors.size > 0 |
|
|
|
|
# end |
|
|
|
|
# end |
|
|
|
|
|
|
|
|
|
def new_with_global_roles |
|
|
|
|
new_without_global_roles |
|
|
|
@ -32,8 +21,6 @@ module OpenProject::GlobalRoles::Patches |
|
|
|
|
def create_with_global_roles |
|
|
|
|
if params['global_role'] |
|
|
|
|
create_global_role |
|
|
|
|
#@member_permissions = (@role.setable_permissions || @permissions) |
|
|
|
|
#@global_permissions = GlobalRole.setable_permissions |
|
|
|
|
else |
|
|
|
|
create_without_global_roles |
|
|
|
|
|
|
|
|
@ -42,20 +29,6 @@ module OpenProject::GlobalRoles::Patches |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# def index_with_global_roles |
|
|
|
|
# @role_pages, @roles = paginate :roles, :per_page => 25, :order => 'builtin, position' |
|
|
|
|
# respond_to do |format| |
|
|
|
|
# format.html {render :action => 'index'} |
|
|
|
|
# format.js {render :action => 'index', :layout => false} |
|
|
|
|
# end |
|
|
|
|
# end |
|
|
|
|
|
|
|
|
|
# def update |
|
|
|
|
# edit |
|
|
|
|
|
|
|
|
|
# render :template => 'roles/edit' if @role.errors.size > 0 |
|
|
|
|
# end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
def create_global_role |
|
|
|
@ -70,13 +43,6 @@ module OpenProject::GlobalRoles::Patches |
|
|
|
|
render :template => 'roles/new' |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# def standard_member_and_global_assigns |
|
|
|
|
# @member_permissions = (@member_role.setable_permissions || @permissions) |
|
|
|
|
# @global_permissions = GlobalRole.setable_permissions |
|
|
|
|
# @global_roles = GlobalRole.all |
|
|
|
|
# @member_roles = (Role.all || @roles) |
|
|
|
|
# end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|