public function isAllowed($role, $resource, $access, array $parameters = null)
{
$sql = implode(' ', ["SELECT " . $this->connection->escapeIdentifier('allowed') . " FROM {$this->accessList} AS a", 'WHERE roles_name IN (', 'SELECT ? ', "UNION SELECT roles_inherit FROM {$this->rolesInherits} WHERE roles_name = ?", "UNION SELECT '*'", ')', "AND resources_name IN (?, '*')", "AND access_name IN (?, '*')", "ORDER BY " . $this->connection->escapeIdentifier('allowed') . " DESC", 'LIMIT 1']);
// fetch one entry...
$allowed = $this->connection->fetchOne($sql, Db::FETCH_NUM, [$role, $role, $resource, $access]);
if (is_array($allowed)) {
return (bool) $allowed[0];
}
/**
* Return the default access action
*/
return $this->_defaultAccess;
}