Scalr\Api\Rest\ApiApplication::hasPermissions PHP Method

hasPermissions() public method

hasPermissions(object $obj, bool $modify = false) hasPermissions(int $roleId, string $permissionId = null)
public hasPermissions ( ) : boolean
return boolean Returns TRUE if the authenticated user has access or FALSE otherwise
    public function hasPermissions()
    {
        $args = func_get_args();
        if (func_num_args() < 1 || func_num_args() > 2) {
            throw new \BadMethodCallException(sprintf("%s expects mandatory arguments. Usage: either " . "hasPermission(object \$obj, bool \$modify = null) or " . "hasPermission(int \$roleId, string \$permissionId = null)", __METHOD__));
        }
        if (is_object($args[0])) {
            //Check Entity level permission
            return $this->getContainer()->acl->hasAccessTo($args[0], $this->getUser(), $this->getEnvironment(), isset($args[1]) ? $args[1] : null);
        } else {
            //Check ACL
            return $this->getContainer()->acl->isUserAllowedByEnvironment($this->getUser(), $this->getEnvironment(), $args[0], isset($args[1]) ? $args[1] : null);
        }
    }