Class: Sequel::Privacy::ActionsClass

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/sequel/privacy/actions.rb

Overview

Actions provides the DSL methods available inside policy lambdas. When policies are evaluated, they execute in the context of this object, giving them access to allow, deny, pass, and all methods.

Example:

policy :AllowAdmins, ->(actor) {
  allow if actor.is_role?(:admin)
}

Instance Method Summary collapse

Instance Method Details

#all(*policies) ⇒ Object



35
36
37
# File 'lib/sequel/privacy/actions.rb', line 35

def all(*policies)
  policies
end

#allowObject



18
19
20
# File 'lib/sequel/privacy/actions.rb', line 18

def allow
  :allow
end

#denyObject



23
24
25
# File 'lib/sequel/privacy/actions.rb', line 23

def deny
  :deny
end

#evaluate(*args, &blk) ⇒ Object



43
44
45
# File 'lib/sequel/privacy/actions.rb', line 43

def evaluate(*args, &blk)
  T.unsafe(self).instance_exec(*args, &blk)
end

#passObject



28
29
30
# File 'lib/sequel/privacy/actions.rb', line 28

def pass
  :pass
end