private function setAccess($accessType, $userId, $allowed)
    {
        if ($userId instanceof AVUser)
        {
            $userId = $userId->getObjectId();
        }
        if ($userId instanceof AVRole)
        {
            $userId = "role:" . $userId->getName();
        }
        if (!is_string($userId))
        {
            throw new AVException("Invalid target for access control.");
        }
        if (!isset($this->permissionsById[$userId]))
        {
            if (!$allowed)
            {
                return;
            }
            $this->permissionsById[$userId] = array();
        }
        if ($allowed)
        {
            $this->permissionsById[$userId][$accessType] = true;
        } else
        {
            unset($this->permissionsById[$userId][$accessType]);
            if (empty($this->permissionsById[$userId]))
            {
                unset($this->permissionsById[$userId]);
            }
        }
    }
private function setAccess($accessType, $userId, $allowed)
    {
        if ($userId instanceof AVUser)
        {
            $userId = $userId->getObjectId();
        }
        if ($userId instanceof AVRole)
        {
            $userId = "role:" . $userId->getName();
        }
        if (!is_string($userId))
        {
            throw new AVException("Invalid target for access control.");
        }
        if (!isset($this->permissionsById[$userId]))
        {
            if (!$allowed)
            {
                return;
            }
            $this->permissionsById[$userId] = array();
        }
        if ($allowed)
        {
            $this->permissionsById[$userId][$accessType] = true;
        } else
        {
            unset($this->permissionsById[$userId][$accessType]);
            if (empty($this->permissionsById[$userId]))
            {
                unset($this->permissionsById[$userId]);
            }
        }
    }
private function setAccess ( $ accessType , $ userId , $ allowed ) { if ( $ userId instanceof AVUser ) { $ userId = $ userId -> getObjectId ( ) ; } if ( $ userId instanceof AVRole ) { $ userId = "role:" . $ userId -> getName ( ) ; } if ( ! is_string ( $ userId ) ) { throw new AVException ( "Invalid target for access control." ) ; } if ( ! isset ( $ this -> permissionsById [ $ userId ] ) ) { if ( ! $ allowed ) { return ; } $ this -> permissionsById [ $ userId ] = array ( ) ; } if ( $ allowed ) { $ this -> permissionsById [ $ userId ] [ $ accessType ] = true ; } else { unset ( $ this -> permissionsById [ $ userId ] [ $ accessType ] ) ; if ( empty ( $ this -> permissionsById [ $ userId ] ) ) { unset ( $ this -> permissionsById [ $ userId ] ) ; } } }
Set access permission with access name, user id and if
the user has permission for accessing or not.

@param string $accessType Access name.
@param string $userId User id.
@param bool $allowed If user allowed to access or not.

@throws AVException
Set access permission with access name user id and if the user has permission for accessing or not .