Class: LdapFluff::ActiveDirectory
- Defined in:
- lib/ldap_fluff/active_directory.rb
Defined Under Namespace
Classes: MemberService
Instance Attribute Summary
Attributes inherited from Generic
Instance Method Summary collapse
- #bind?(uid = nil, password = nil, opts = {}) ⇒ Boolean
-
#is_in_groups(uid, gids = [], all = false) ⇒ Object
active directory stores group membership on a users model TODO: query by group individually not like this.
Methods inherited from Generic
#group_exists?, #groups_for_uid, #includes_cn?, #initialize, #service_bind, #user_exists?, #users_for_gid
Constructor Details
This class inherits a constructor from LdapFluff::Generic
Instance Method Details
#bind?(uid = nil, password = nil, opts = {}) ⇒ Boolean
2 3 4 5 6 7 8 9 10 |
# File 'lib/ldap_fluff/active_directory.rb', line 2 def bind?(uid = nil, password = nil, opts = {}) unless uid.include?(',') || uid.include?('\\') || opts[:search] == false service_bind user = @member_service.find_user(uid) uid = user.first.dn if user&.first end @ldap.auth(uid, password) @ldap.bind end |
#is_in_groups(uid, gids = [], all = false) ⇒ Object
active directory stores group membership on a users model TODO: query by group individually not like this
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ldap_fluff/active_directory.rb', line 14 def is_in_groups(uid, gids = [], all = false) service_bind return true if gids == [] begin groups = @member_service.find_user_groups(uid) intersection = gids & groups (all ? intersection == gids : intersection.size > 0) rescue MemberService::UIDNotFoundException false end end |