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:
|
: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 |
|
- name: !binary |
|
||||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YHQuNGB0YLQtdC80Ys=
|
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YHQuNGB0YLQtdC80Ys=
|
||||||
|
|
||||||
use_default: true
|
use_default: true
|
||||||
use_default_for_owner: false
|
use_default_for_owner: false
|
||||||
rights:
|
rights:
|
||||||
event_logs:
|
|
||||||
- index
|
|
||||||
auto_build_lists:
|
auto_build_lists:
|
||||||
- index
|
- index
|
||||||
- create
|
- create
|
||||||
|
event_logs:
|
||||||
|
- index
|
||||||
groups:
|
groups:
|
||||||
- update
|
- update
|
||||||
- index
|
- index
|
||||||
|
@ -98,12 +27,15 @@
|
||||||
- remove_project
|
- remove_project
|
||||||
- destroy
|
- destroy
|
||||||
- new
|
- new
|
||||||
personal_repositories:
|
collaborators:
|
||||||
- index
|
- index
|
||||||
|
- create
|
||||||
- show
|
- show
|
||||||
- settings
|
- edit
|
||||||
- add_project
|
- add
|
||||||
- remove_project
|
- update
|
||||||
|
- destroy
|
||||||
|
- new
|
||||||
downloads:
|
downloads:
|
||||||
- index
|
- index
|
||||||
platforms:
|
platforms:
|
||||||
|
@ -113,6 +45,8 @@
|
||||||
- destroy
|
- destroy
|
||||||
- new
|
- new
|
||||||
- unfreeze
|
- unfreeze
|
||||||
|
- easy_urpmi
|
||||||
|
- edit
|
||||||
projects:
|
projects:
|
||||||
- index
|
- index
|
||||||
- auto_build
|
- auto_build
|
||||||
|
@ -158,6 +92,14 @@
|
||||||
- publish
|
- publish
|
||||||
- all
|
- all
|
||||||
- cancel
|
- cancel
|
||||||
|
members:
|
||||||
|
- index
|
||||||
|
- create
|
||||||
|
- show
|
||||||
|
- edit
|
||||||
|
- update
|
||||||
|
- destroy
|
||||||
|
- new
|
||||||
categories:
|
categories:
|
||||||
- index
|
- index
|
||||||
- platforms
|
- platforms
|
||||||
|
@ -203,6 +145,33 @@
|
||||||
- open
|
- open
|
||||||
- hidden
|
- hidden
|
||||||
"on": ""
|
"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 |
|
- name: !binary |
|
||||||
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LXQutGC0LA=
|
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LXQutGC0LA=
|
||||||
|
|
||||||
|
@ -214,6 +183,61 @@
|
||||||
to: User
|
to: User
|
||||||
can_see:
|
can_see:
|
||||||
"on": Project
|
"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 |
|
- name: !binary |
|
||||||
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINGB0LjRgdGC0LXQvNGL
|
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINGB0LjRgdGC0LXQvNGL
|
||||||
|
|
||||||
|
@ -222,14 +246,6 @@
|
||||||
rights:
|
rights:
|
||||||
groups:
|
groups:
|
||||||
- index
|
- index
|
||||||
personal_repositories:
|
|
||||||
- show
|
|
||||||
- add_project
|
|
||||||
- settings
|
|
||||||
- change_visibility
|
|
||||||
- remove_project
|
|
||||||
auto_build_lists:
|
|
||||||
- index
|
|
||||||
repositories:
|
repositories:
|
||||||
- index
|
- index
|
||||||
platforms:
|
platforms:
|
||||||
|
@ -248,14 +264,3 @@
|
||||||
to: User
|
to: User
|
||||||
can_see:
|
can_see:
|
||||||
"on": ""
|
"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
|
def add_owner owner
|
||||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||||
return false unless ActiveRecord::Base.relation_target? self.class
|
return false unless ActiveRecord::Base.relation_target? self.class
|
||||||
roles = Role.by_target(self.class).owner_default +
|
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||||
Role.by_acter(:all).owner_default
|
Role.by_acter(:all).by_target(self.class).owner_default
|
||||||
add_roles_to owner, roles
|
add_roles_to owner, roles
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_owner owner
|
def remove_owner owner
|
||||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||||
return false unless ActiveRecord::Base.relation_target? self.class
|
return false unless ActiveRecord::Base.relation_target? self.class
|
||||||
roles = Role.by_target(self.class).owner_default +
|
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||||
Role.by_acter(:all).owner_default
|
Role.by_acter(:all).by_target(self.class).owner_default
|
||||||
remove_roles_form_acter owner, roles
|
remove_roles_form_acter owner, roles
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue