Class: AuthLh::User
- Inherits:
-
Object
- Object
- AuthLh::User
- Defined in:
- lib/auth_lh/user.rb
Instance Attribute Summary collapse
-
#attendance_mode ⇒ Object
Returns the value of attribute attendance_mode.
-
#email ⇒ Object
Returns the value of attribute email.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#extension_number ⇒ Object
Returns the value of attribute extension_number.
-
#external_apps ⇒ Object
Returns the value of attribute external_apps.
-
#fingerprint_from ⇒ Object
Returns the value of attribute fingerprint_from.
-
#fingerprint_to ⇒ Object
Returns the value of attribute fingerprint_to.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#has_remote_desktop ⇒ Object
Returns the value of attribute has_remote_desktop.
-
#jabber ⇒ Object
Returns the value of attribute jabber.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#local_app_shop_codes ⇒ Object
Returns the value of attribute local_app_shop_codes.
-
#login ⇒ Object
Returns the value of attribute login.
-
#password_expired ⇒ Object
Returns the value of attribute password_expired.
-
#roles ⇒ Object
Returns the value of attribute roles.
-
#shop_code ⇒ Object
Returns the value of attribute shop_code.
-
#shop_id ⇒ Object
Returns the value of attribute shop_id.
-
#shop_name ⇒ Object
Returns the value of attribute shop_name.
Instance Method Summary collapse
- #has_all_roles?(r_ids) ⇒ Boolean
- #has_role?(role_id) ⇒ Boolean
- #has_some_role?(r_ids) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ User
constructor
A new instance of User.
- #name ⇒ Object
- #role_ids ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ User
Returns a new instance of User.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/auth_lh/user.rb', line 9 def initialize(attributes={}) attributes.each do |k,v| if k.to_s == 'external_apps' self.external_apps = v.map { |x| ExternalApp.new(x) } elsif k.to_s == 'roles' self.roles = v.map { |x| Role.new(x) } else self.send("#{k}=", v) end end end |
Instance Attribute Details
#attendance_mode ⇒ Object
Returns the value of attribute attendance_mode.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def attendance_mode @attendance_mode end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def email @email end |
#enabled ⇒ Object
Returns the value of attribute enabled.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def enabled @enabled end |
#extension_number ⇒ Object
Returns the value of attribute extension_number.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def extension_number @extension_number end |
#external_apps ⇒ Object
Returns the value of attribute external_apps.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def external_apps @external_apps end |
#fingerprint_from ⇒ Object
Returns the value of attribute fingerprint_from.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def fingerprint_from @fingerprint_from end |
#fingerprint_to ⇒ Object
Returns the value of attribute fingerprint_to.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def fingerprint_to @fingerprint_to end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def first_name @first_name end |
#has_remote_desktop ⇒ Object
Returns the value of attribute has_remote_desktop.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def has_remote_desktop @has_remote_desktop end |
#jabber ⇒ Object
Returns the value of attribute jabber.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def jabber @jabber end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def last_name @last_name end |
#local_app_shop_codes ⇒ Object
Returns the value of attribute local_app_shop_codes.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def local_app_shop_codes @local_app_shop_codes end |
#login ⇒ Object
Returns the value of attribute login.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def login @login end |
#password_expired ⇒ Object
Returns the value of attribute password_expired.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def password_expired @password_expired end |
#roles ⇒ Object
Returns the value of attribute roles.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def roles @roles end |
#shop_code ⇒ Object
Returns the value of attribute shop_code.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def shop_code @shop_code end |
#shop_id ⇒ Object
Returns the value of attribute shop_id.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def shop_id @shop_id end |
#shop_name ⇒ Object
Returns the value of attribute shop_name.
3 4 5 |
# File 'lib/auth_lh/user.rb', line 3 def shop_name @shop_name end |
Instance Method Details
#has_all_roles?(r_ids) ⇒ Boolean
39 40 41 42 43 |
# File 'lib/auth_lh/user.rb', line 39 def has_all_roles?(r_ids) r_ids.all? { |r_id| role_ids.include?(r_id.to_i) } end |
#has_role?(role_id) ⇒ Boolean
29 30 31 |
# File 'lib/auth_lh/user.rb', line 29 def has_role?(role_id) role_ids.include?(role_id.to_i) end |
#has_some_role?(r_ids) ⇒ Boolean
33 34 35 36 37 |
# File 'lib/auth_lh/user.rb', line 33 def has_some_role?(r_ids) r_ids.any? { |r_id| role_ids.include?(r_id.to_i) } end |
#name ⇒ Object
21 22 23 |
# File 'lib/auth_lh/user.rb', line 21 def name "#{first_name} #{last_name}" end |
#role_ids ⇒ Object
25 26 27 |
# File 'lib/auth_lh/user.rb', line 25 def role_ids roles.map(&:id) end |