Module: Access::Privilege::Base
- Defined in:
- lib/access/privilege.rb
Instance Method Summary collapse
-
#create(privilege, description = nil) ⇒ Object
Create a new Privilege.
-
#load(*args) ⇒ Object
Restore an Access::Privilege from it’s storable data.
Instance Method Details
#create(privilege, description = nil) ⇒ Object
Create a new Privilege
19 20 21 22 23 24 25 26 |
# File 'lib/access/privilege.rb', line 19 def create(privilege, description=nil) raise "Privilege #{privilege} already exists" if exists?(privilege) privilege = Privilege.new(privilege, description) privilege.access = access privilege.base = self add(privilege) privilege end |
#load(*args) ⇒ Object
Restore an Access::Privilege from it’s storable data
29 30 31 32 33 34 35 |
# File 'lib/access/privilege.rb', line 29 def load(*args) # :nodoc: return nil unless data = super privilege = new(*data.values_at(:oid, :description)) privilege.access = access privilege.base = self privilege end |