Cross Reference: permission.rb
xref
: /
ontohub
/
app
/
models
/
permission.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
permission.rb revision c622fbf3120c732e74ab43bb0457388b477e6898
98
N/A
class
Permission
<
ActiveRecord
::
Base
98
N/A
1246
N/A
ROLES
= %w
(
owner
editor
)
98
N/A
98
N/A
# thrown if the last
admin
/
owner
tries to remove itself
919
N/A
class
PowerVaccuumError
<
Exception
;
end
919
N/A
919
N/A
attr_accessible
:
subject
, :
subject_id
, :
subject_type
, :
role
919
N/A
919
N/A
belongs_to
:
subject
, :
polymorphic
=>
true
919
N/A
belongs_to
:
item
, :
polymorphic
=>
true
919
N/A
belongs_to
:
creator
, :
class_name
=>
'User'
919
N/A
919
N/A
validates_inclusion_of
:
role
, :
in
=>
ROLES
919
N/A
919
N/A
scope
:
item
, ->
(
item
)
{
919
N/A
where
\
919
N/A
item_id
:
item.id
,
919
N/A
item_type
:
item.class.to
_s
919
N/A
}
919
N/A
919
N/A
scope
:
subject
, ->
(
subject
)
{
98
N/A
where
\
98
N/A
subject_id
:
subject.id
,
98
N/A
subject_type
:
subject.class.to
_s
98
N/A
}
810
N/A
810
N/A
scope
:
role
, ->
(
role
)
{
where
:
role
=>
role
}
810
N/A
scope
:
owner
,
role
(:
owner
)
810
N/A
scope
:
editor
,
role
(:
editor
)
354
N/A
354
N/A
end
354
N/A