Google\Cloud\Iam\Iam::testPermissions PHP 메소드

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.
    public function testPermissions(array $permissions, array $options = [])
    {
        return $this->connection->testPermissions($options + ['permissions' => $permissions, 'resource' => $this->resource]);
    }

Usage Example

예제 #1
0
 public function testTestPermissions()
 {
     $permissions = ['foo', 'bar'];
     $this->connection->testPermissions(Argument::withEntry('permissions', $permissions))->willReturn($permissions);
     $iam = new Iam($this->connection->reveal(), self::RESOURCE);
     $this->assertEquals($permissions, $iam->testPermissions($permissions));
 }