Class: Sanction::Whitelist::Node
- Inherits:
-
Node
- Object
- Node
- Sanction::Whitelist::Node
show all
- Defined in:
- lib/sanction/whitelist/node.rb
Instance Attribute Summary
Attributes inherited from Node
#id, #type
Instance Method Summary
collapse
Methods inherited from Node
#[], #add_scope, #add_subject, #change_type!, #children, #children?, #find, #has_scope?, #id?, #initialize, #persisted?, #remove_scope, #resources, #resources=, #scope=, #to_hash, #type?, #wildcarded?
Methods included from Tree
#ancestors, #children, #depth, #descendants, #graft, #has_children?, #height, #leaf?, #only_child?, #parent, #prune, #root, #root?, #siblings, #unlink, #walk
Constructor Details
This class inherits a constructor from Sanction::Node
Instance Method Details
#allow! ⇒ Object
10
11
12
|
# File 'lib/sanction/whitelist/node.rb', line 10
def allow!
false
end
|
#blacklist? ⇒ Boolean
29
30
31
|
# File 'lib/sanction/whitelist/node.rb', line 29
def blacklist?
false
end
|
#deny! ⇒ Object
18
19
20
21
22
23
|
# File 'lib/sanction/whitelist/node.rb', line 18
def deny!
@parent.resources << type
@parent.resources.uniq!
unlink
true
end
|
#mode ⇒ Object
33
34
35
|
# File 'lib/sanction/whitelist/node.rb', line 33
def mode
'whitelist'
end
|
#null_array_class ⇒ Object
#permitted? ⇒ Boolean
5
6
7
8
|
# File 'lib/sanction/whitelist/node.rb', line 5
def permitted?
super
root? ? true : (@parent[type].permitted? && @parent[type].allowed_ids.include?(id))
end
|
#scope ⇒ Object
14
15
16
|
# File 'lib/sanction/whitelist/node.rb', line 14
def scope
permitted? ? super : []
end
|
#whitelist? ⇒ Boolean
25
26
27
|
# File 'lib/sanction/whitelist/node.rb', line 25
def whitelist?
true
end
|