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.

profile #

Instantiate a new security Profile object.


profile(id, content) #

ArgumentsTypeDescription
idstringUnique profile identifier
contentJSON ObjectProfile content

Return Value #

Returns the new security Profile object.

Usage #

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