Sha256: 49603214ea788281f5746f0001f0da815dfea043b39e4e78c75976ba28298681

Contents?: true

Size: 947 Bytes

Versions: 11

Compression:

Stored size: 947 Bytes

Contents

module GitHub
  class Ldap
    module MembershipValidators
      # Validates membership using `GitHub::Ldap::Domain#membership`.
      #
      # This is a simple wrapper for existing functionality in order to expose
      # it consistently with the new approach.
      class Classic < Base
        def perform(entry)
          # short circuit validation if there are no groups to check against
          return true if groups.empty?

          domains.each do |domain|
            membership = domain.membership(entry, group_names)

            if !membership.empty?
              entry[:groups] = membership
              return true
            end
          end

          false
        end

        # Internal: the group names to look up membership for.
        #
        # Returns an Array of String group names (CNs).
        def group_names
          @group_names ||= groups.map { |g| g[:cn].first }
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
github-ldap-1.10.1 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.10.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.9.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.8.2 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.8.1 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.8.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.7.1 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.7.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.6.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.5.0 lib/github/ldap/membership_validators/classic.rb
github-ldap-1.4.0 lib/github/ldap/membership_validators/classic.rb