Skip to main content

role_assignments

Creates, updates, deletes, gets or lists a role_assignments resource.

Overview

Namerole_assignments
TypeResource
Idgoogleadmin.directory.role_assignments

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
assignedTostringThe unique ID of the entity this role is assigned to—either the user_id of a user, the group_id of a group, or the uniqueId of a service account as defined in Identity and Access Management (IAM).
assigneeTypestringOutput only. The type of the assignee (USER or GROUP).
conditionstringOptional. The condition associated with this role assignment. Note: Feature is available to Enterprise Standard, Enterprise Plus, Google Workspace for Education Plus and Cloud Identity Premium customers. A RoleAssignment with the condition field set will only take effect when the resource being accessed meets the condition. If condition is empty, the role (role_id) is applied to the actor (assigned_to) at the scope (scope_type) unconditionally. Currently, the following conditions are supported: - To make the RoleAssignment only applicable to Security Groups: api.getAttribute('cloudidentity.googleapis.com/groups.labels', []).hasAny(['groups.security']) && resource.type == 'cloudidentity.googleapis.com/Group' - To make the RoleAssignment not applicable to Security Groups: !api.getAttribute('cloudidentity.googleapis.com/groups.labels', []).hasAny(['groups.security']) && resource.type == 'cloudidentity.googleapis.com/Group' Currently, the condition strings have to be verbatim and they only work with the following pre-built administrator roles: - Groups Editor - Groups Reader The condition follows Cloud IAM condition syntax. - To make the RoleAssignment not applicable to Locked Groups: !api.getAttribute('cloudidentity.googleapis.com/groups.labels', []).hasAny(['groups.locked']) && resource.type == 'cloudidentity.googleapis.com/Group' This condition can also be used in conjunction with a Security-related condition.
etagstringETag of the resource.
kindstringThe type of the API resource. This is always admin#directory#roleAssignment. (default: admin#directory#roleAssignment)
orgUnitIdstringIf the role is restricted to an organization unit, this contains the ID for the organization unit the exercise of this role is restricted to.
roleAssignmentIdstring (int64)ID of this roleAssignment.
roleIdstring (int64)The ID of the role that is assigned.
scopeTypestringThe scope in which this role is assigned.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcustomer, roleAssignmentIdRetrieves a role assignment.
listselectcustomermaxResults, pageToken, roleId, userKey, includeIndirectRoleAssignmentsRetrieves a paginated list of all roleAssignments.
insertinsertcustomerCreates a role assignment.
deletedeletecustomer, roleAssignmentIdDeletes a role assignment.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
customerstring
roleAssignmentIdstring
includeIndirectRoleAssignmentsboolean
maxResultsinteger (int32)
pageTokenstring
roleIdstring
userKeystring

SELECT examples

Retrieves a role assignment.

SELECT
assignedTo,
assigneeType,
condition,
etag,
kind,
orgUnitId,
roleAssignmentId,
roleId,
scopeType
FROM googleadmin.directory.role_assignments
WHERE customer = '{{ customer }}' -- required
AND roleAssignmentId = '{{ roleAssignmentId }}' -- required;

INSERT examples

Creates a role assignment.

INSERT INTO googleadmin.directory.role_assignments (
data__roleAssignmentId,
data__roleId,
data__kind,
data__etag,
data__assignedTo,
data__scopeType,
data__orgUnitId,
data__condition,
customer
)
SELECT
'{{ roleAssignmentId }}',
'{{ roleId }}',
'{{ kind }}',
'{{ etag }}',
'{{ assignedTo }}',
'{{ scopeType }}',
'{{ orgUnitId }}',
'{{ condition }}',
'{{ customer }}'
RETURNING
assignedTo,
assigneeType,
condition,
etag,
kind,
orgUnitId,
roleAssignmentId,
roleId,
scopeType
;

DELETE examples

Deletes a role assignment.

DELETE FROM googleadmin.directory.role_assignments
WHERE customer = '{{ customer }}' --required
AND roleAssignmentId = '{{ roleAssignmentId }}' --required;