Sha256: e79a33db7ed4c8fb36fd81fca9f1a83df1279df8867603ce5a1f3f36e2eb9455

Contents?: true

Size: 968 Bytes

Versions: 23

Compression:

Stored size: 968 Bytes

Contents

module Ddr::Auth
  module Roles
    extend ActiveSupport::Autoload

    autoload :DetachedRoleSet
    autoload :PropertyRoleSet
    autoload :Role
    autoload :RoleSet
    autoload :RoleSetQuery
    autoload :RoleType
    autoload :RoleTypes

    include RoleTypes

    RESOURCE_SCOPE = "resource".freeze
    POLICY_SCOPE = "policy".freeze
    SCOPES = [RESOURCE_SCOPE, POLICY_SCOPE].freeze

    class << self

      def const_missing(name)
        if name == :ArrayRoleSet
          warn "[DEPRECATION] `Ddr::Auth::Roles::ArrayRoleSet` is deprecated." \
               " Use `Ddr::Auth::Roles::DetachedRoleSet` instead."
          DetachedRoleSet
        else
          super
        end
      end
      
      def type_map
        @type_map ||= role_types.map { |role_type| [role_type.to_s, role_type] }.to_h
      end

      def role_types
        @role_types ||= RoleTypes.constants(false).map { |const| RoleTypes.const_get(const) }
      end

    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ddr-models-2.3.2 lib/ddr/auth/roles.rb
ddr-models-2.3.1 lib/ddr/auth/roles.rb
ddr-models-2.3.0 lib/ddr/auth/roles.rb
ddr-models-2.2.0 lib/ddr/auth/roles.rb
ddr-models-2.1.3 lib/ddr/auth/roles.rb
ddr-models-2.1.2 lib/ddr/auth/roles.rb
ddr-models-2.1.1 lib/ddr/auth/roles.rb
ddr-models-2.1.0 lib/ddr/auth/roles.rb
ddr-models-2.1.0.rc2 lib/ddr/auth/roles.rb
ddr-models-2.1.0.rc1 lib/ddr/auth/roles.rb
ddr-models-2.0.1 lib/ddr/auth/roles.rb
ddr-models-2.0.0 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc6 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc5 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc4 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc3 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc2 lib/ddr/auth/roles.rb
ddr-models-2.0.0.rc1 lib/ddr/auth/roles.rb
ddr-models-2.0.0.pre.5 lib/ddr/auth/roles.rb
ddr-models-2.0.0.pre.4 lib/ddr/auth/roles.rb