Method: Chawk.check_node_security

Defined in:
lib/chawk.rb

.check_node_security(agent, node, access = :full) ⇒ Object

Raises:

  • (SecurityError)


32
33
34
35
36
37
38
39
# File 'lib/chawk.rb', line 32

def self.check_node_security(agent,node,access=:full)

  rel = node.relations.where(agent_id:agent.id).first

  return node if check_node_relations_security(rel,access) || check_node_public_security(node,access)

  raise SecurityError,"You do not have permission to access this node. #{agent} #{rel} #{access}"
end