SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

updateProfile #

Performs a partial update on an existing profile.


updateProfile(id, content, [options], [callback]) #

ArgumentsTypeDescription
idstringUnique role identifier
policiesarray of objectsList of policies to apply to this profile
optionsstring(Optional) Optional arguments
callbackfunction(Optional) Callback handling the response

Options #

FilterTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue
refreshstringIf set to wait_for, Kuzzle will wait for the persistence layer to finish indexing (available with Elasticsearch 5.x and above)undefined

Return Value #

Returns the Security object to allow chaining.


Callback Response #

Return an updated Profile object.

Usage #

<?php
use \Kuzzle\Kuzzle;
use \Kuzzle\Security\Profile;
$profileId = 'myProfile';
$policies = [
  [
    'roleId' => 'myRole'
  ],
  [
    'roleId' => 'anonymous',
    'restrictedTo' => [
      ['index' => 'my-second-index', 'collection' => ['my-collection']]
    ]
  ]
];
$kuzzle = new Kuzzle('localhost');
$security = $kuzzle->security();
try {
  $profile = $security->updateProfile($profileId, $policies);
  // $profile instanceof Profile
}
catch (ErrorException $e) {
}