SDK
SDK PHP v3.x
1

profile #

Instantiate a new security Profile object.


profile(id, content) #

Arguments Type Description
id string Unique profile identifier
content JSON Object Profile content

Return Value #

Returns the new security Profile object.

Usage #

Copied to clipboard!
<?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