Class: ElsToken::ElsIdentity

Inherits:
Object
  • Object
show all
Defined in:
lib/els_token/els_identity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (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

#companyObject (readonly)

Returns the value of attribute company.



8
9
10
# File 'lib/els_token/els_identity.rb', line 8

def company
  @company
end

#display_nameObject (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

#dnObject (readonly)

Returns the value of attribute dn.



6
7
8
# File 'lib/els_token/els_identity.rb', line 6

def dn
  @dn
end

#employee_numberObject (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_typeObject (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_nameObject (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_nameObject (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

#mailObject (readonly)

Returns the value of attribute mail.



6
7
8
# File 'lib/els_token/els_identity.rb', line 6

def mail
  @mail
end

#nameObject (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

#rolesObject (readonly)

Returns the value of attribute roles.



6
7
8
# File 'lib/els_token/els_identity.rb', line 6

def roles
  @roles
end

#telephone_numberObject (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_idObject (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

#uacObject (readonly)

Returns the value of attribute uac.



6
7
8
# File 'lib/els_token/els_identity.rb', line 6

def uac
  @uac
end

#user_statusObject (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_uacObject

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_nameObject



31
32
33
# File 'lib/els_token/els_identity.rb', line 31

def full_name
  first_name+" "+last_name
end

#has_role?(role) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/els_token/els_identity.rb', line 21

def has_role?(role)
  @roles.include? role
end