Sha256: 0c859a851f56d1ee6a1b639d12ffa8d58dbb03b337e5f76d83470ceeea6d1217

Contents?: true

Size: 946 Bytes

Versions: 17

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true

module Waylon
  module Conditions
    # A pre-made catch-all condition for denying access
    class PermissionDenied < Condition
      # Overrides normal Condition initialization to force a specific action
      def initialize(*_args) # rubocop:disable Lint/MissingSuper
        @mechanism = nil
        @action = :denied
        @allowed_groups = [:everyone]
        @help = "This action is not allowed"
      end

      # Matches any input (since the PermissionDenied route, when used, should always function)
      # @return [Boolean]
      def matches?(_input)
        true
      end

      # Permits any user (since the PermissionDenied route, when used, should always function)
      # @return [Boolean]
      def permits?(_user)
        true
      end

      # Just provides back all input as a single token
      # @return [Array<String>]
      def tokens(input)
        [input]
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
waylon-core-0.3.0 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.6 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.5 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.4 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.3 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.2 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.1 lib/waylon/conditions/permission_denied.rb
waylon-core-0.2.0 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.9 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.8 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.6 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.5 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.4 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.3 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.2 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.1 lib/waylon/conditions/permission_denied.rb
waylon-core-0.1.0 lib/waylon/conditions/permission_denied.rb