PHP Класс Google\Cloud\Iam\Iam

This class is not meant to be used directly. It should be accessed through other objects which support IAM. Note that examples make use of the PubSub API, and the {@see \Google\Cloud\PubSub\Topic} class. Policies can be created using the {@see \Google\Cloud\Iam\PolicyBuilder} to help ensure their validity. Example: IAM policies are obtained via resources which implement IAM. In this example, we'll use PubSub topics to demonstrate how IAM politices are managed. use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder; $pubsub = $cloud->pubsub(); $topic = $pubsub->topic('my-new-topic'); $iam = $topic->iam();
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$connection Google\Cloud\Iam\IamConnectionInterface

Открытые методы

Метод Описание
__construct ( Google\Cloud\Iam\IamConnectionInterface $connection, string $resource )
policy ( array $options = [] ) : array Get the existing IAM policy for this resource.
reload ( array $options = [] ) : array Refresh the IAM policy for this resource.
setPolicy ( array $policy, array $options = [] ) : array Set the IAM policy for this resource.
testPermissions ( array $permissions, array $options = [] ) : array Test if the current user has the given permissions on this resource.

Описание методов

__construct() публичный Метод

public __construct ( Google\Cloud\Iam\IamConnectionInterface $connection, string $resource )
$connection Google\Cloud\Iam\IamConnectionInterface
$resource string

policy() публичный Метод

If a policy has already been retrieved from the API, it will be returned. To fetch a fresh copy of the policy, use {@see \Google\Cloud\Iam\Iam::reload()}. Example: $policy = $iam->policy();
public policy ( array $options = [] ) : array
$options array Configuration Options
Результат array An array of policy data

reload() публичный Метод

Example: $policy = $iam->reload();
public reload ( array $options = [] ) : array
$options array Configuration Options
Результат array An array of policy data

setPolicy() публичный Метод

Bindings with invalid roles, or non-existent members will raise a server error. Example: $oldPolicy = $iam->policy(); $oldPolicy['bindings'][0]['members'] = 'user:[email protected]'; $policy = $iam->setPolicy($oldPolicy);
public setPolicy ( array $policy, array $options = [] ) : array
$policy array A new policy array
$options array Configuration Options
Результат array An array of policy data

testPermissions() публичный Метод

Invalid permissions will raise a BadRequestException. A list of allowed permissions can be found in the access control documentation. Example: $allowedPermissions = $iam->testPermissions([ 'pubsub.topics.publish', 'pubsub.topics.attachSubscription' ]);
public testPermissions ( array $permissions, array $options = [] ) : array
$permissions array A list of permissions to test
$options array Configuration Options
Результат array A subset of $permissions, with only those allowed included.

Описание свойств

$connection защищенное свойство

protected IamConnectionInterface,Google\Cloud\Iam $connection
Результат Google\Cloud\Iam\IamConnectionInterface