Sha256: c3595b2f5b678d14852e46582cf4285b0323b2e1a0e2f3b269a3bd521eef2f74

Contents?: true

Size: 944 Bytes

Versions: 14

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

module Entitlements
  class Plugins
    class GroupOfNames < Entitlements::Plugins
      include ::Contracts::Core
      C = ::Contracts

      # Produce the override hash for an LDAP groupOfNames.
      #
      # group         - Entitlements::Models::Group object
      # plugin_config - Additional configuration for the plugin
      # ldap          - Reference to the underlying Entitlements::Service::LDAP object
      #
      # Returns Hash with override settings.
      Contract Entitlements::Models::Group, C::HashOf[String => C::Any], Entitlements::Service::LDAP => C::HashOf[String => C::Any]
      def self.override_hash(group, _plugin_config, ldap)
        members = group.member_strings.map { |ms| ldap.person_dn_format.gsub("%KEY%", ms) }

        {
          "objectClass"  => "GroupOfNames",
          "member"       => members,
          "uniqueMember" => nil
        }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
entitlements-app-1.1.0 lib/entitlements/plugins/group_of_names.rb
entitlements-app-1.0.0 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.3.4 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.3.1 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.3.0 lib/entitlements/plugins/group_of_names.rb
entitlements-0.2.1 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.2.1 lib/entitlements/plugins/group_of_names.rb
entitlements-0.2.0 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.2.0 lib/entitlements/plugins/group_of_names.rb
entitlements-0.1.8 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.1.8 lib/entitlements/plugins/group_of_names.rb
entitlements-0.1.7 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.1.7 lib/entitlements/plugins/group_of_names.rb
entitlements-app-0.1.6 lib/entitlements/plugins/group_of_names.rb