Class: User
Class Method Summary
collapse
Methods inherited from BaseNew
Proxy, install_data, install_data_hooks
Class Method Details
.account_name_with_uuid(uuid) ⇒ Object
31
32
33
34
35
|
# File 'app/models/user.rb', line 31
def account_name_with_uuid(uuid)
h = Hash.new
User.find(:uuid => uuid).accounts.each{|row| h.store(row.name,row.uuid) }
h
end
|
.authenticate(login_id, password) ⇒ Object
19
20
21
22
23
|
# File 'app/models/user.rb', line 19
def authenticate(login_id,password)
return nil if login_id.nil? || password.nil?
u = User.find(:login_id=>login_id, :password => encrypt_password(password))
u.nil? ? false : u
end
|
.encrypt_password(password) ⇒ Object
41
42
43
44
|
# File 'app/models/user.rb', line 41
def encrypt_password(password)
salt = Digest::SHA1.hexdigest(DcmgrGui::Application.config.secret_token)
Digest::SHA1.hexdigest("--#{salt}--#{password}--")
end
|
.get_user(uuid) ⇒ Object
25
26
27
28
29
|
# File 'app/models/user.rb', line 25
def get_user(uuid)
return nil if uuid.nil?
u = User.find(:uuid=>uuid)
u.nil? ? false : u
end
|
.primary_account_id(uuid) ⇒ Object
37
38
39
|
# File 'app/models/user.rb', line 37
def primary_account_id(uuid)
User.find(:uuid => uuid).primary_account_id
end
|