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.

Constructors #

Instantiates a new Profile object, representing a security profile, which is a set of one or many Role objects.


Profile(Security, id, content, [meta]) #

ArgumentsTypeDescription
SecuritySecurityAn instantiated Security object
idstringUnique profile identifier
contentJSON ObjectProfile content
metaJSON ObjectProfile metadata

Note: this constructor won't make any call to Kuzzle.


Properties #

Property nameTypeDescriptionget/set
contentJSON objectRaw profile contentget
idstringUnique profile identifierget
metaJSON objectProfile metadataget

Return Value #

Returns to the 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();
// Using the Security factory:
$profile = $security->profile($profileId, $profileDefinition);
// Or directly with the constructor:
$profile = new Profile($security, $profileId, $profileDefinition);