Sha256: 3cd9c8f1e2bc2bee9685857baae66243dff6516d4534660926a5adbf11dbca2f

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

module Shamu
  module Security

    # Used to determine the roles that the current {Principal} should be given
    # on a {Services::Service}.
    module RolesService

      # @!visibility private
      def self.create( scorpion, * )
        scorpion.new EmptyRolesService
      end

      # @param [Principal] principal of the currently logged in user.
      # @param [Boolean] reload to reload the roles from storage and bypass any
      # caching.
      # @return [Array<Symbol>] the roles granted to the principal.
      def roles_for( principal, reload: false )
        []
      end

      # Default {RolesService} always returns an empty set.
      class EmptyRolesService
        include RolesService

        # (see RolesService#roles_for)
        def roles_for( principal )
          []
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shamu-0.0.24 lib/shamu/security/roles_service.rb
shamu-0.0.21 lib/shamu/security/roles_service.rb
shamu-0.0.20 lib/shamu/security/roles_service.rb