Phalcon\Acl\Adapter\Mongo::isAllowed PHP Method

isAllowed() public method

Example: Does Andres have access to the customers resource to create? $acl->isAllowed('Andres', 'Products', 'create'); Do guests have access to any resource to edit? $acl->isAllowed('guests', '*', 'edit');
public isAllowed ( string $role, string $resource, string $access, array $parameters = null ) : boolean
$role string
$resource string
$access string
$parameters array
return boolean
    public function isAllowed($role, $resource, $access, array $parameters = null)
    {
        $accessList = $this->getCollection('accessList');
        $access = $accessList->findOne(['roles_name' => $role, 'resources_name' => $resource, 'access_name' => $access]);
        if (is_array($access)) {
            return (bool) $access['allowed'];
        }
        /**
         * Check if there is an common rule for that resource
         */
        $access = $accessList->findOne(['roles_name' => $role, 'resources_name' => $resource, 'access_name' => '*']);
        if (is_array($access)) {
            return (bool) $access['allowed'];
        }
        return $this->_defaultAccess;
    }