Module: Access::User::Base
- Defined in:
- lib/access/user.rb
Instance Method Summary collapse
-
#create(user_id, credentials, meta = nil, admin = false, opt = {}) ⇒ Object
Create a new - inactive(!) - user.
-
#load(*args) ⇒ Object
Restore an Access::User from it’s storable data.
Instance Method Details
#create(user_id, credentials, meta = nil, admin = false, opt = {}) ⇒ Object
Create a new - inactive(!) - user
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/access/user.rb', line 23 def create(user_id, credentials, =nil, admin=false, opt={}) raise "User-oid #{user_id} already exists" if exists?(user_id) credentials = credentials ? access.hash_credentials(credentials, user_id) : "*" user = User.new( access, self, user_id, credentials, , admin, { :active => !!opt.delete(:active) }.merge(opt) ) add(user) user end |
#load(*args) ⇒ Object
Restore an Access::User from it’s storable data
40 41 42 43 44 45 46 47 48 |
# File 'lib/access/user.rb', line 40 def load(*args) # :nodoc: return nil unless data = super array = data.values_at(:oid, :credentials, :meta, :admin) array << data user = User.new(access, self, *array) user.access = access user.base = self user end |