Class: ElsToken::ElsIdentity
- Inherits:
-
Object
- Object
- ElsToken::ElsIdentity
- Defined in:
- lib/els_token/els_identity.rb
Instance Attribute Summary collapse
-
#common_name ⇒ Object
readonly
Returns the value of attribute common_name.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#dn ⇒ Object
readonly
Returns the value of attribute dn.
-
#employee_number ⇒ Object
readonly
Returns the value of attribute employee_number.
-
#employee_type ⇒ Object
readonly
Returns the value of attribute employee_type.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#name ⇒ Object
(also: #cdid)
readonly
Returns the value of attribute name.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#telephone_number ⇒ Object
readonly
Returns the value of attribute telephone_number.
-
#token_id ⇒ Object
readonly
Returns the value of attribute token_id.
-
#uac ⇒ Object
readonly
Returns the value of attribute uac.
-
#user_status ⇒ Object
readonly
Returns the value of attribute user_status.
Instance Method Summary collapse
-
#friendly_uac ⇒ Object
The Active Directory User Account Control contains lots of interesting info about the user account state.
- #full_name ⇒ Object
- #has_role?(role) ⇒ Boolean
-
#initialize(rest_response = nil) ⇒ ElsIdentity
constructor
A new instance of ElsIdentity.
Constructor Details
#initialize(rest_response = nil) ⇒ ElsIdentity
Returns a new instance of ElsIdentity.
25 26 27 28 29 |
# File 'lib/els_token/els_identity.rb', line 25 def initialize(rest_response = nil) @roles = [] parse(rest_response) if rest_response @lines = nil end |
Instance Attribute Details
#common_name ⇒ Object (readonly)
Returns the value of attribute common_name.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def common_name @common_name end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
8 9 10 |
# File 'lib/els_token/els_identity.rb', line 8 def company @company end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
7 8 9 |
# File 'lib/els_token/els_identity.rb', line 7 def display_name @display_name end |
#dn ⇒ Object (readonly)
Returns the value of attribute dn.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def dn @dn end |
#employee_number ⇒ Object (readonly)
Returns the value of attribute employee_number.
7 8 9 |
# File 'lib/els_token/els_identity.rb', line 7 def employee_number @employee_number end |
#employee_type ⇒ Object (readonly)
Returns the value of attribute employee_type.
8 9 10 |
# File 'lib/els_token/els_identity.rb', line 8 def employee_type @employee_type end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def last_name @last_name end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def mail @mail end |
#name ⇒ Object (readonly) Also known as: cdid
Returns the value of attribute name.
7 8 9 |
# File 'lib/els_token/els_identity.rb', line 7 def name @name end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def roles @roles end |
#telephone_number ⇒ Object (readonly)
Returns the value of attribute telephone_number.
8 9 10 |
# File 'lib/els_token/els_identity.rb', line 8 def telephone_number @telephone_number end |
#token_id ⇒ Object (readonly)
Returns the value of attribute token_id.
7 8 9 |
# File 'lib/els_token/els_identity.rb', line 7 def token_id @token_id end |
#uac ⇒ Object (readonly)
Returns the value of attribute uac.
6 7 8 |
# File 'lib/els_token/els_identity.rb', line 6 def uac @uac end |
#user_status ⇒ Object (readonly)
Returns the value of attribute user_status.
7 8 9 |
# File 'lib/els_token/els_identity.rb', line 7 def user_status @user_status end |
Instance Method Details
#friendly_uac ⇒ Object
The Active Directory User Account Control contains lots of interesting info about the user account state. This method does a very simple check to see if the account is enabled and return either “enabled” or “disabled”. There are many other states but I don’t use them
17 18 19 |
# File 'lib/els_token/els_identity.rb', line 17 def friendly_uac @friendly_uac ||= (@uac.to_i & 2 == 0) ? "enabled" : "disabled" end |
#full_name ⇒ Object
31 32 33 |
# File 'lib/els_token/els_identity.rb', line 31 def full_name first_name+" "+last_name end |
#has_role?(role) ⇒ Boolean
21 22 23 |
# File 'lib/els_token/els_identity.rb', line 21 def has_role?(role) @roles.include? role end |