Minor fix in roles

This commit is contained in:
George Vinogradov 2011-10-28 00:06:53 +04:00
parent e7071b501b
commit adcd99d255
2 changed files with 77 additions and 16 deletions

View File

@ -85,10 +85,9 @@ class Role < ActiveRecord::Base
rights = fields.delete('rights') rights = fields.delete('rights')
a = begin a = begin
find(fields['id']) find(fields['id'])
rescue rescue ActiveRecord::RecordNotFound
new new
end end
new
a.rights = [] a.rights = []
a.attributes = fields a.attributes = fields
rights.each do |con, acts| rights.each do |con, acts|

View File

@ -3,6 +3,8 @@
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YHQuNGB0YLQtdC80Ys= 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YHQuNGB0YLQtdC80Ys=
use_default: true
use_default_for_owner: false
rights: rights:
event_logs: event_logs:
- index - index
@ -37,6 +39,14 @@
- build - build
- destroy - destroy
- new - new
rpc:
- build_packet
- platforms
- project_versions
- xe_index
- xe_method_prefix
- user_projects
- build_status
private_users: private_users:
- index - index
- create - create
@ -60,6 +70,8 @@
- circle_build - circle_build
- new_bbdt - new_bbdt
- publish - publish
- all
- cancel
categories: categories:
- index - index
- platforms - platforms
@ -87,8 +99,10 @@
- destroy - destroy
- update - update
- new - new
- load_from_dump
- get_dump
id: 1 id: 1
to: User to: ""
can_see: !map:ActiveSupport::HashWithIndifferentAccess can_see: !map:ActiveSupport::HashWithIndifferentAccess
Repository: Repository:
- open - open
@ -103,6 +117,8 @@
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/Qu9Cw0YLRhNC+0YDQvNGL 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/Qu9Cw0YLRhNC+0YDQvNGL
use_default: false
use_default_for_owner: false
rights: rights:
groups: groups:
- index - index
@ -112,38 +128,46 @@
can_see: !map:ActiveSupport::HashWithIndifferentAccess can_see: !map:ActiveSupport::HashWithIndifferentAccess
Project: Project:
- open - open
"on": "" "on": Platform
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YDQtdC/0L7Qt9C40YLQvtGA 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0YDQtdC/0L7Qt9C40YLQvtGA
0LjRjw== 0LjRjw==
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 3 id: 3
to: to: ""
can_see: can_see:
"on": "on": Repository
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LXQutGC0LA= 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LXQutGC0LA=
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 4 id: 4
to: to: ""
can_see: can_see:
"on": "on": Project
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0LPRgNGD0L/Qv9GL 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0LPRgNGD0L/Qv9GL
use_default: false
use_default_for_owner: true
rights: {} rights: {}
id: 5 id: 5
to: to: User
can_see: can_see:
"on": "on": Group
- name: !binary | - name: !binary |
0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LTRg9C60YLQsA== 0JDQtNC80LjQvdC40YHRgtGA0LDRgtC+0YAg0L/RgNC+0LTRg9C60YLQsA==
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 6 id: 6
@ -153,27 +177,65 @@
- name: !binary | - name: !binary |
0JzQsNC50L3RgtC10LnQvdC10YAg0L/RgNC+0LXQutGC0LA= 0JzQsNC50L3RgtC10LnQvdC10YAg0L/RgNC+0LXQutGC0LA=
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 7 id: 7
to: to: ""
can_see: can_see:
"on": "on": Project
- name: !binary | - name: !binary |
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINC/0LvQsNGC0YTQvtGA0LzRiw== 0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINC/0LvQsNGC0YTQvtGA0LzRiw==
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 8 id: 8
to: to: ""
can_see: can_see:
"on": "on": Platform
- name: !binary | - name: !binary |
0KPRh9Cw0YHRgtC90LjQuiDQs9GA0YPQv9C/0Ys= 0KPRh9Cw0YHRgtC90LjQuiDQs9GA0YPQv9C/0Ys=
use_default: false
use_default_for_owner: false
rights: {} rights: {}
id: 9 id: 9
to: to: User
can_see: can_see:
"on": "on": Group
- name: !binary |
0J/QvtC70YzQt9C+0LLQsNGC0LXQu9GMINGB0LjRgdGC0LXQvNGL
use_default: true
use_default_for_owner: false
rights:
event_logs:
- index
groups:
- index
repositories:
- index
platforms:
- index
projects:
- show
private_users:
- index
build_lists:
- index
products:
- show
categories:
- index
users:
- index
roles:
- index
id: 10
to: User
can_see:
"on": ""