Пример #1
0
 public function deleteWithObjectIdExpectTrue()
 {
     $testUser = new AVUser();
     $testUser->username = $this->testUser['username'];
     $testUser->password = $this->testUser['password'];
     $user = $testUser->signup();
     $AVUser = $this->AVUser;
     $return = $AVUser->delete($user->objectId, $user->sessionToken);
     \Enhance\Assert::isTrue($return);
 }
Пример #2
0
 /**
  * Makes a call to a Cloud function
  *
  * @param string $name Cloud function name
  * @param array $data Parameters to pass
  * @param boolean $useMasterKey Whether to use the Master Key
  *
  * @return mixed
  */
 public static function run($name, $data = array(), $useMasterKey = false)
 {
     $sessionToken = null;
     if (AVUser::getCurrentUser()) {
         $sessionToken = AVUser::getCurrentUser()->getSessionToken();
     }
     $response = AVClient::_request('POST', '/functions/' . $name, $sessionToken, json_encode(AVClient::_encode($data, null, false)), $useMasterKey);
     return AVClient::_decode($response['result']);
 }
Пример #3
0
 /**
  * Execute a find query and return the results.
  *
  * @param boolean $useMasterKey
  *
  * @return array
  */
 public function find($useMasterKey = false)
 {
     $sessionToken = null;
     if (AVUser::getCurrentUser()) {
         $sessionToken = AVUser::getCurrentUser()->getSessionToken();
     }
     $queryString = $this->buildQueryString($this->_getOptions());
     $result = AVClient::_request('GET', '/classes/' . $this->className . '?' . $queryString, $sessionToken, null, $useMasterKey);
     $output = array();
     foreach ($result['results'] as $row) {
         $obj = AVObject::create($this->className, $row['objectId']);
         $obj->_mergeAfterFetchWithSelectedKeys($row, $this->selectedKeys);
         $output[] = $obj;
     }
     return $output;
 }
Пример #4
0
 /**
  * Returns true if this user is the current user.
  *
  * @return boolean
  */
 public function isCurrent()
 {
     if (AVUser::getCurrentUser() && $this->getObjectId()) {
         if ($this->getObjectId() == AVUser::getCurrentUser()->getObjectId()) {
             return true;
         }
     }
     return false;
 }