Class: Chaltron::LDAP::User
- Inherits:
-
Object
- Object
- Chaltron::LDAP::User
- Defined in:
- lib/chaltron/ldap/user.rb
Class Attribute Summary collapse
-
.auth ⇒ Object
readonly
Returns the value of attribute auth.
Class Method Summary collapse
Class Attribute Details
.auth ⇒ Object (readonly)
Returns the value of attribute auth.
12 13 14 |
# File 'lib/chaltron/ldap/user.rb', line 12 def auth @auth end |
Class Method Details
.find_or_create(auth, create) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/chaltron/ldap/user.rb', line 14 def find_or_create(auth, create) @auth = auth if uid.blank? || email.blank? || username.blank? raise_error('Account must provide a dn, uid and email address') end user = find_by_uid_and_provider entry = Chaltron::LDAP::Person.find_by_uid(username) if user.nil? and create # create user roles = Chaltron.default_roles roles = entry.ldap_groups.map do |e| Chaltron.ldap_role_mappings[e.dn] end.compact if !Chaltron.ldap_role_mappings.blank? user = entry.create_user(roles) end update_ldap_attributes(user, entry) unless user.nil? user end |