Test My Permissions
const url = 'https://example.com/iam/v1/scopes/example/example/access/me/permissions:test';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"scope_type":"example","scope_id":"example","permissions":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/iam/v1/scopes/example/example/access/me/permissions:test \ --header 'Content-Type: application/json' \ --data '{ "scope_type": "example", "scope_id": "example", "permissions": [ "example" ] }'Answers which of the named candidate permissions the calling principal effectively holds at the requested scope. Same advisory semantics as ListMyEffectivePermissions; a candidate naming no existing permission is rejected as invalid rather than reported as not held.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The scope type: PLATFORM, ORGANISATION, WORKSPACE, or GROUP.
This MUST remain a string and MUST NOT become a proto enum, for the same
reason as on ListMyEffectivePermissionsRequest.
The unique identifier of the scope. For the PLATFORM scope this is the zero-UUID sentinel 00000000-0000-0000-0000-000000000000.
Request Body required
Section titled “Request Body required ”TestMyPermissionsRequest
Request message for TestMyPermissions. As with the list request, there is no
principal field - me is fixed in the path.
object
The scope type: PLATFORM, ORGANISATION, WORKSPACE, or GROUP.
This MUST remain a string and MUST NOT become a proto enum, for the same
reason as on ListMyEffectivePermissionsRequest.
The unique identifier of the scope. For the PLATFORM scope this is the zero-UUID sentinel 00000000-0000-0000-0000-000000000000.
The candidate permission keys to test, each <service>.<resource>.<action>.
A candidate naming no existing permission is rejected as invalid - never
reported as simply not held.
Example generated
{ "scope_type": "example", "scope_id": "example", "permissions": [ "example" ]}Responses
Section titled “ Responses ”OK
TestMyPermissionsResponse
Response message for TestMyPermissions.
object
The candidates the caller effectively holds, each with its condition kinds and provenance lineage. A candidate absent here is not held.
One permission the principal effectively holds at the requested scope.
Advisory display data: use it to decide what to show, never as an
authorization decision - every action is enforced by the platform when it is
attempted. Policy conditions are reported via condition_kinds, never
evaluated by this read.
object
The permission key, <service>.<resource>.<action>.
The service facet of the key (e.g. “compute”).
The resource facet of the key (e.g. “vm”).
The action facet of the key (e.g. “create”).
The kinds of condition guarding this permission.
Empty means the permission is held outright - at least one granting binding carries no condition at all. Non-empty means every granting binding is conditional, and these are the kinds involved; CONDITION_KIND_UNKNOWN appears when a condition exists but its definition could not be read.
Reported, never evaluated: the same question asked at any time, from any network, returns the same kinds.
Every granting role, most-local first (direct grants before inherited, then by proximity of the origin scope).
One granting role behind an effective permission - the provenance of a grant.
object
The unique identifier of the granting role.
The human-readable name of the granting role.
Whether the grant was made at the requested scope or inherited from an ancestor.
The scope type the grant was inherited from; unset when origin is DIRECT.
The scope id the grant was inherited from; empty when origin is DIRECT.
Whether this particular grant only holds under a policy condition.
Example
{ "granted": [ { "condition_kinds": [ "CONDITION_KIND_UNSPECIFIED" ], "lineage": [ { "origin": "ROLE_ORIGIN_UNSPECIFIED", "origin_scope_type": "SCOPE_TYPE_UNSPECIFIED" } ] } ]}default
Section titled “default ”Default error response
The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.
object
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
A list of messages that carry the error details. There is a common set of message types for APIs to use.
Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.
object
The type of the serialized message.
Example generated
{ "code": 1, "message": "example", "details": [ { "@type": "example" } ]}