Fix with roles. Rolled back ActiveRecord::Base modifications
This commit is contained in:
parent
cea94ca0e2
commit
7c5b933b90
197
config/roles.yml
197
config/roles.yml
|
@ -1,87 +1,16 @@
|
|||
---
|
||||
:Roles:
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/Qu9Cw0YLRhNC+0YDQvNGL
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights:
|
||||
groups:
|
||||
- index
|
||||
- destroy
|
||||
id: 2
|
||||
to: ""
|
||||
can_see: !map:ActiveSupport::HashWithIndifferentAccess
|
||||
Project:
|
||||
- open
|
||||
"on": Platform
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YDQtdC/0L7Qt9C40YLQvtGA
|
||||
0LjRjw==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 3
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Repository
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0LPRgNGD0L/Qv9GL
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights: {}
|
||||
|
||||
id: 5
|
||||
to: User
|
||||
can_see:
|
||||
"on": Group
|
||||
- name: !binary |
|
||||
0JzQsNC50L3RgtC10LnQvdC10YAg0L/RgNC+0LXQutGC0LA=
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 7
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Project
|
||||
- name: !binary |
|
||||
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINC/0LvQsNGC0YTQvtGA0LzRiw==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 8
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Platform
|
||||
- name: !binary |
|
||||
0KPRh9Cw0YHRgtC90LjQuiDQs9GA0YPQv9C/0Ys=
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights: {}
|
||||
|
||||
id: 9
|
||||
to: User
|
||||
can_see:
|
||||
"on": Group
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YHQuNGB0YLQtdC80Ys=
|
||||
|
||||
use_default: true
|
||||
use_default_for_owner: false
|
||||
rights:
|
||||
event_logs:
|
||||
- index
|
||||
auto_build_lists:
|
||||
- index
|
||||
- create
|
||||
event_logs:
|
||||
- index
|
||||
groups:
|
||||
- update
|
||||
- index
|
||||
|
@ -98,12 +27,15 @@
|
|||
- remove_project
|
||||
- destroy
|
||||
- new
|
||||
personal_repositories:
|
||||
collaborators:
|
||||
- index
|
||||
- create
|
||||
- show
|
||||
- settings
|
||||
- add_project
|
||||
- remove_project
|
||||
- edit
|
||||
- add
|
||||
- update
|
||||
- destroy
|
||||
- new
|
||||
downloads:
|
||||
- index
|
||||
platforms:
|
||||
|
@ -113,6 +45,8 @@
|
|||
- destroy
|
||||
- new
|
||||
- unfreeze
|
||||
- easy_urpmi
|
||||
- edit
|
||||
projects:
|
||||
- index
|
||||
- auto_build
|
||||
|
@ -158,6 +92,14 @@
|
|||
- publish
|
||||
- all
|
||||
- cancel
|
||||
members:
|
||||
- index
|
||||
- create
|
||||
- show
|
||||
- edit
|
||||
- update
|
||||
- destroy
|
||||
- new
|
||||
categories:
|
||||
- index
|
||||
- platforms
|
||||
|
@ -203,6 +145,33 @@
|
|||
- open
|
||||
- hidden
|
||||
"on": ""
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/Qu9Cw0YLRhNC+0YDQvNGL
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights:
|
||||
groups:
|
||||
- index
|
||||
- destroy
|
||||
id: 2
|
||||
to: ""
|
||||
can_see: !map:ActiveSupport::HashWithIndifferentAccess
|
||||
Project:
|
||||
- open
|
||||
"on": Platform
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YDQtdC/0L7Qt9C40YLQvtGA
|
||||
0LjRjw==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights: {}
|
||||
|
||||
id: 3
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Repository
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LXQutGC0LA=
|
||||
|
||||
|
@ -214,6 +183,61 @@
|
|||
to: User
|
||||
can_see:
|
||||
"on": Project
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0LPRgNGD0L/Qv9GL
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: true
|
||||
rights: {}
|
||||
|
||||
id: 5
|
||||
to: User
|
||||
can_see:
|
||||
"on": Group
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LTRg9C60YLQsA==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 6
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Project
|
||||
- name: !binary |
|
||||
0JzQsNC50L3RgtC10LnQvdC10YAg0L/RgNC+0LXQutGC0LA=
|
||||
|
||||
use_default: true
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 7
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Project
|
||||
- name: !binary |
|
||||
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINC/0LvQsNGC0YTQvtGA0LzRiw==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 8
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Platform
|
||||
- name: !binary |
|
||||
0KPRh9Cw0YHRgtC90LjQuiDQs9GA0YPQv9C/0Ys=
|
||||
|
||||
use_default: true
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 9
|
||||
to: User
|
||||
can_see:
|
||||
"on": Group
|
||||
- name: !binary |
|
||||
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINGB0LjRgdGC0LXQvNGL
|
||||
|
||||
|
@ -222,14 +246,6 @@
|
|||
rights:
|
||||
groups:
|
||||
- index
|
||||
personal_repositories:
|
||||
- show
|
||||
- add_project
|
||||
- settings
|
||||
- change_visibility
|
||||
- remove_project
|
||||
auto_build_lists:
|
||||
- index
|
||||
repositories:
|
||||
- index
|
||||
platforms:
|
||||
|
@ -248,14 +264,3 @@
|
|||
to: User
|
||||
can_see:
|
||||
"on": ""
|
||||
- name: !binary |
|
||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LTRg9C60YLQsA==
|
||||
|
||||
use_default: false
|
||||
use_default_for_owner: false
|
||||
rights: {}
|
||||
|
||||
id: 6
|
||||
to: ""
|
||||
can_see:
|
||||
"on": Project
|
||||
|
|
|
@ -106,16 +106,16 @@ class ActiveRecord::Base
|
|||
def add_owner owner
|
||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||
return false unless ActiveRecord::Base.relation_target? self.class
|
||||
roles = Role.by_target(self.class).owner_default +
|
||||
Role.by_acter(:all).owner_default
|
||||
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||
Role.by_acter(:all).by_target(self.class).owner_default
|
||||
add_roles_to owner, roles
|
||||
end
|
||||
|
||||
def remove_owner owner
|
||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||
return false unless ActiveRecord::Base.relation_target? self.class
|
||||
roles = Role.by_target(self.class).owner_default +
|
||||
Role.by_acter(:all).owner_default
|
||||
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||
Role.by_acter(:all).by_target(self.class).owner_default
|
||||
remove_roles_form_acter owner, roles
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue