Class: AuthLh::UserExtended
- Inherits:
-
Object
- Object
- AuthLh::UserExtended
- Defined in:
- lib/auth_lh/user_extended.rb
Instance Attribute Summary collapse
-
#allow_multiple_sessions ⇒ Object
Returns the value of attribute allow_multiple_sessions.
-
#allow_remote_access ⇒ Object
Returns the value of attribute allow_remote_access.
-
#attendance_mode ⇒ Object
Returns the value of attribute attendance_mode.
-
#disable_time ⇒ Object
Returns the value of attribute disable_time.
-
#email ⇒ Object
Returns the value of attribute email.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#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.
-
#login ⇒ Object
Returns the value of attribute login.
-
#only_working_time ⇒ Object
Returns the value of attribute only_working_time.
-
#password_digest ⇒ Object
Returns the value of attribute password_digest.
-
#password_expired ⇒ Object
Returns the value of attribute password_expired.
-
#password_remember_enabled ⇒ Object
Returns the value of attribute password_remember_enabled.
-
#pending_password_refresh ⇒ Object
Returns the value of attribute pending_password_refresh.
-
#roles ⇒ Object
Returns the value of attribute roles.
-
#session_timeout ⇒ Object
Returns the value of attribute session_timeout.
-
#shop_code ⇒ Object
Returns the value of attribute shop_code.
-
#shop_id ⇒ Object
Returns the value of attribute shop_id.
-
#testing_user ⇒ Object
Returns the value of attribute testing_user.
-
#working_time ⇒ Object
Returns the value of attribute working_time.
Instance Method Summary collapse
- #app_codes ⇒ Object
- #has_all_roles?(r_ids) ⇒ Boolean
- #has_role?(role_id) ⇒ Boolean
- #has_some_role?(r_ids) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ UserExtended
constructor
A new instance of UserExtended.
- #name ⇒ Object
- #role_ids ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ UserExtended
Returns a new instance of UserExtended.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/auth_lh/user_extended.rb', line 9 def initialize(attributes={}) attributes.each do |k,v| if k.to_s == 'external_apps' self.external_apps = v.map { |x| ExternalAppExtended.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
#allow_multiple_sessions ⇒ Object
Returns the value of attribute allow_multiple_sessions.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def allow_multiple_sessions @allow_multiple_sessions end |
#allow_remote_access ⇒ Object
Returns the value of attribute allow_remote_access.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def allow_remote_access @allow_remote_access end |
#attendance_mode ⇒ Object
Returns the value of attribute attendance_mode.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def attendance_mode @attendance_mode end |
#disable_time ⇒ Object
Returns the value of attribute disable_time.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def disable_time @disable_time end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def email @email end |
#enabled ⇒ Object
Returns the value of attribute enabled.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def enabled @enabled end |
#external_apps ⇒ Object
Returns the value of attribute external_apps.
3 4 5 |
# File 'lib/auth_lh/user_extended.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_extended.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_extended.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_extended.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_extended.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_extended.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_extended.rb', line 3 def last_name @last_name end |
#login ⇒ Object
Returns the value of attribute login.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def login @login end |
#only_working_time ⇒ Object
Returns the value of attribute only_working_time.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def only_working_time @only_working_time end |
#password_digest ⇒ Object
Returns the value of attribute password_digest.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def password_digest @password_digest end |
#password_expired ⇒ Object
Returns the value of attribute password_expired.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def password_expired @password_expired end |
#password_remember_enabled ⇒ Object
Returns the value of attribute password_remember_enabled.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def password_remember_enabled @password_remember_enabled end |
#pending_password_refresh ⇒ Object
Returns the value of attribute pending_password_refresh.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def pending_password_refresh @pending_password_refresh end |
#roles ⇒ Object
Returns the value of attribute roles.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def roles @roles end |
#session_timeout ⇒ Object
Returns the value of attribute session_timeout.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def session_timeout @session_timeout end |
#shop_code ⇒ Object
Returns the value of attribute shop_code.
3 4 5 |
# File 'lib/auth_lh/user_extended.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_extended.rb', line 3 def shop_id @shop_id end |
#testing_user ⇒ Object
Returns the value of attribute testing_user.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def testing_user @testing_user end |
#working_time ⇒ Object
Returns the value of attribute working_time.
3 4 5 |
# File 'lib/auth_lh/user_extended.rb', line 3 def working_time @working_time end |
Instance Method Details
#app_codes ⇒ Object
29 30 31 |
# File 'lib/auth_lh/user_extended.rb', line 29 def app_codes external_apps.map(&:code) end |
#has_all_roles?(r_ids) ⇒ Boolean
43 44 45 46 47 |
# File 'lib/auth_lh/user_extended.rb', line 43 def has_all_roles?(r_ids) r_ids.all? { |r_id| role_ids.include?(r_id.to_i) } end |
#has_role?(role_id) ⇒ Boolean
33 34 35 |
# File 'lib/auth_lh/user_extended.rb', line 33 def has_role?(role_id) role_ids.include?(role_id.to_i) end |
#has_some_role?(r_ids) ⇒ Boolean
37 38 39 40 41 |
# File 'lib/auth_lh/user_extended.rb', line 37 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_extended.rb', line 21 def name "#{first_name} #{last_name}" end |
#role_ids ⇒ Object
25 26 27 |
# File 'lib/auth_lh/user_extended.rb', line 25 def role_ids roles.map(&:id) end |