Class: DefaultArsecurityHandler

Inherits:
ArsecurityHandler show all
Defined in:
lib/arsecurity_default.rb

Class Method Summary collapse

Methods inherited from ArsecurityHandler

permissions

Class Method Details

.accept?Boolean

for customize logic, such as for administrator

Returns:

  • (Boolean)


26
27
28
# File 'lib/arsecurity_default.rb', line 26

def accept?
  false
end

.get_conditions(invocation) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/arsecurity_default.rb', line 33

def get_conditions(invocation)
  case invocation.method
    when *ArsecurityDefault::CLASS_READ_METHOD
    args = invocation.args || []
    options = args.extract_options!
    invocation.args = args
    invocation.options = options
    conditions = options[:conditions]
    when ArsecurityDefault::CLASS_DELETE_METHOD
    conditions = invocation.args[0]
    when ArsecurityDefault::CLASS_UPDATE_METHOD
    conditions = invocation.args[1]
  end
  conditions
end

.reject?Boolean

for customize logic, such as for time restriction

Returns:

  • (Boolean)


30
31
32
# File 'lib/arsecurity_default.rb', line 30

def reject?
  false
end

.set_conditions(invocation, conditions) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/arsecurity_default.rb', line 49

def set_conditions(invocation, conditions)
  case invocation.method
    when *ArsecurityDefault::CLASS_READ_METHOD
    options = invocation.options
    options[:conditions] = conditions 
    when ArsecurityDefault::CLASS_DELETE_METHOD
    invocation.args[0] = conditions 
    when ArsecurityDefault::CLASS_UPDATE_METHOD
    invocation.args[1] = conditions
  end
end