Class: Sanction::Blacklist::Node
- Inherits:
-
Node
- Object
- Node
- Sanction::Blacklist::Node
show all
- Defined in:
- lib/sanction/blacklist/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
13
14
|
# File 'lib/sanction/blacklist/node.rb', line 10
def allow!
@parent.resources.reject! {|x| x == type } unless @parent[type].count > 1
unlink
true
end
|
#blacklist? ⇒ Boolean
28
29
30
|
# File 'lib/sanction/blacklist/node.rb', line 28
def blacklist?
true
end
|
#deny! ⇒ Object
20
21
22
|
# File 'lib/sanction/blacklist/node.rb', line 20
def deny!
false
end
|
#mode ⇒ Object
32
33
34
|
# File 'lib/sanction/blacklist/node.rb', line 32
def mode
'blacklist'
end
|
#null_array_class ⇒ Object
#permitted? ⇒ Boolean
5
6
7
8
|
# File 'lib/sanction/blacklist/node.rb', line 5
def permitted?
super
root? ? true : (@parent[type].permitted? && @parent[type].allowed_ids.include?(id))
end
|
#scope ⇒ Object
16
17
18
|
# File 'lib/sanction/blacklist/node.rb', line 16
def scope
permitted? ? super : []
end
|
#whitelist? ⇒ Boolean
24
25
26
|
# File 'lib/sanction/blacklist/node.rb', line 24
def whitelist?
false
end
|