Performs a partial update on an existing profile.

@param string $id Unique profile identifier
@param array $policies List of policies to apply to this profile
@param array $options Optional arguments
@return Profile
14751
public function updateProfile($id, array $policies, array $options = [])
    {
        $data = [
            '_id' => $id,
            'body' => [ 'policies' => $policies ]
        ];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('updateProfile'),
            $data,
            $options
        );

        return new Profile($this, $id, $response['result']['_source'], $response['result']['_meta']);
    }
1103726
public function addPolicy($roleId, Policy $policy)
    {
        try {
            return $this->innerGateway->addPolicy($roleId, $policy);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
498005
public static function cancel($id, $options = null)
    {
        $url = static::classUrl().'/'.$id;
        $params = array('status' => 'canceled');
        return static::_directRequest('put', $url, $params, $options);
    }
871154
public function updatePolicy($roleId, $policyId, Request $request)
    {
        $updateStruct = $this->inputDispatcher->parse(
            new Message(
                array('Content-Type' => $request->headers->get('Content-Type')),
                $request->getContent()
            )
        );

        try {
            // First try to treat $roleId as a role draft ID.
            $role = $this->roleService->loadRoleDraft($roleId);
            foreach ($role->getPolicies() as $policy) {
                if ($policy->id == $policyId) {
                    try {
                        return $this->roleService->updatePolicy(
                            $policy,
                            $updateStruct
                        );
                    } catch (LimitationValidationException $e) {
                        throw new BadRequestException($e->getMessage());
                    }
                }
            }
        } catch (NotFoundException $e) {
            // Then try to treat $roleId as a role ID.
            $role = $this->roleService->loadRole($roleId);
            foreach ($role->getPolicies() as $policy) {
                if ($policy->id == $policyId) {
                    try {
                        return $this->roleService->updatePolicy(
                            $policy,
                            $updateStruct
                        );
                    } catch (LimitationValidationException $e) {
                        throw new BadRequestException($e->getMessage());
                    }
                }
            }
        }

        throw new Exceptions\NotFoundException("Policy not found: '{$request->getPathInfo()}'.");
    }
1050795
public function getTaskStatus($id, $options=array()){

        $data = array();
        
        $data['id'] = $id;

        $data = array_merge($data, $options);

        return $this->request($this->taskStatusUrl, $data);
    }
257181
public function update($collectionName, array $criteria, array $data, array $options = []) {
		$collection = $this->getCollection($collectionName);
		
		if ($this->_profilerEnabled) {
			$message = 'db.' . $collectionName . '.update(' .
				json_encode($criteria) . ',' . 
				json_encode($data) . ');';

			$event = $this->getProfiler()->startWrite($message);
		}

		$result  = $collection->update($criteria, $data, $options);
		$success = (bool) $result['ok'];
		
		if ($this->_profilerEnabled) {
			$success
				? $event->stopSuccess()
				: $event->stopError();
		}
		
		return $success;
	}
1054482
public function find($id, array $options = [])
    {
        return $this->gateway->commit('get', $this->gateway->buildUrlFromString('charges').'/'.$id);
    }
723569
public function trackTransaction($id, array $options = [])
	{
		$options['id'] = $id;
		$this->trackEcommerce(self::ECOMMERCE_TRANSACTION, $options);
	}
50836
public function addPolicyByRoleDraft($roleId, Policy $policy)
    {
        $legacyPolicy = clone $policy;
        $legacyPolicy->originalId = $policy->id;
        $this->limitationConverter->toLegacy($legacyPolicy);

        $this->roleGateway->addPolicy($roleId, $legacyPolicy);
        $policy->id = $legacyPolicy->id;
        $policy->originalId = $legacyPolicy->originalId;
        $policy->roleId = $legacyPolicy->roleId;

        return $policy;
    }
25429
private function getPoliciesNumbers(array $policies): array
    {
        $policiesNumbers = array_column($policies, 'id');

        return array_combine($policiesNumbers, array_fill_keys($policiesNumbers, false));
    }
843932
public function reload(array $options = [])
    {
        return $this->policy = $this->connection->getPolicy([
            'resource' => $this->resource
        ] + $options + $this->options['args']);
    }
389697
public function getById($id, array $options = [])
    {
        $query = $this->createBaseBuilder($options);

        return $query->find($id);
    }
692568
public function findByProfileIdentifier($identifier, $provider, array $options = [])
    {
        return $this->findOneBy(array('profiles.' . $provider . '.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options);
    }
112818
public function update($id, RolesRequest $request)
    {
        $data = $this->mergeRequestWithPermissions($request);

        $this->role->updateAndSyncUsers($id, $data, $request->users);

        flash(trans('core::messages.resource.resource updated', ['name' => trans('user::roles.title.role')]));

        return redirect()->route('backend::user.role.index');
    }
576031
public function withPolicySet(string ...$policies): self
    {
        $obj = clone $this;
        $obj->_policySet = $policies;
        return $obj;
    }
123240
public function startTask($id, $options=array()){

        $data = array();
        
        $data['id'] = $id;

        $data = array_merge($data, $options);

        return $this->request($this->taskStartUrl, $data);
    }
994748
public function getUserRights($id, array $options = [])
    {
        $data = [
            '_id' => $id
        ];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('getUserRights'),
            $data,
            $options
        );

        return $response['result']['hits'];
    }