Class: Waylon::Conditions::PermissionDenied

Inherits:
Waylon::Condition show all
Defined in:
lib/waylon/conditions/permission_denied.rb

Overview

A pre-made catch-all condition for denying access

Instance Attribute Summary

Attributes inherited from Waylon::Condition

#action, #help, #mechanism

Instance Method Summary collapse

Methods inherited from Waylon::Condition

#mention_only?, #named_tokens, #properly_mentions?

Constructor Details

#initialize(*_args) ⇒ PermissionDenied

Overrides normal Condition initialization to force a specific action



8
9
10
11
12
13
# File 'lib/waylon/conditions/permission_denied.rb', line 8

def initialize(*_args) # rubocop:disable Lint/MissingSuper
  @mechanism = nil
  @action = :denied
  @allowed_groups = [:everyone]
  @help = "This action is not allowed"
end

Instance Method Details

#matches?(_input) ⇒ Boolean

Matches any input (since the PermissionDenied route, when used, should always function)

Returns:

  • (Boolean)


17
18
19
# File 'lib/waylon/conditions/permission_denied.rb', line 17

def matches?(_input)
  true
end

#permits?(_user) ⇒ Boolean

Permits any user (since the PermissionDenied route, when used, should always function)

Returns:

  • (Boolean)


23
24
25
# File 'lib/waylon/conditions/permission_denied.rb', line 23

def permits?(_user)
  true
end

#tokens(input) ⇒ Array<String>

Just provides back all input as a single token

Returns:

  • (Array<String>)


29
30
31
# File 'lib/waylon/conditions/permission_denied.rb', line 29

def tokens(input)
  [input]
end