Sha256: 0232eecad7b3780e8d3856d307b4ee6c968326dc3977e79a21eb2ecf4467538a

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

module Ddr
  module Auth
    module Groups

      PUBLIC = Group.new "public", label: "Public" do |auth_context|
        true
      end
      
      REGISTERED = Group.new "registered", label: "Registered Users" do |auth_context|
        auth_context.authenticated?
      end
      
      DUKE_ALL = Group.new "duke.all", label: "Duke NetIDs" do |auth_context|
        auth_context.duke_agent?
      end
      
      SUPERUSERS = Group.new "ddr.superusers", label: "Superusers" do |auth_context|
        auth_context.ismemberof.include? Ddr::Auth.superuser_group
      end
      
      COLLECTION_CREATORS = Group.new "ddr.collection_creators",
                                      label: "Collection Creators" do |auth_context|
        auth_context.ismemberof.include? Ddr::Auth.collection_creators_group
      end

      # Return the list of all groups available for use in the repository,
      #   i.e., that can be used to assert access controls.
      # @return [Array<Group>] the groups
      def self.all
        [ PUBLIC,
          REGISTERED,
          DUKE_ALL ] +
          AffiliationGroups::ALL +
          Ddr::Auth.grouper_gateway.repository_groups
      end

      # @param auth_context [AuthContext]
      # @return [Array<Group>]
      def self.call(auth_context)
        DynamicGroups.call(auth_context) + RemoteGroups.call(auth_context)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ddr-models-2.0.0.rc1 lib/ddr/auth/groups.rb
ddr-models-2.0.0.pre.5 lib/ddr/auth/groups.rb
ddr-models-2.0.0.pre.4 lib/ddr/auth/groups.rb
ddr-models-2.0.0.pre.3 lib/ddr/auth/groups.rb
ddr-models-2.0.0.pre.2 lib/ddr/auth/groups.rb
ddr-models-2.0.0.pre.1 lib/ddr/auth/groups.rb