Skip to main content

permissions

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

Overview

Namepermissions
TypeResource
Idgoogleworkspace.drivev3.permissions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringOutput only. The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. IDs should be treated as opaque values.
allowFileDiscoverybooleanWhether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
deletedbooleanOutput only. Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
displayNamestringOutput only. The "pretty" name of the value of the permission. The following is a list of examples for each type of permission: * user - User's full name, as defined for their Google account, such as "Joe Smith." * group - Name of the Google Group, such as "The Company Administrators." * domain - String domain name, such as "thecompany.com." * anyone - No displayName is present.
domainstringThe domain to which this permission refers.
emailAddressstringThe email address of the user or group to which this permission refers.
expirationTimestring (date-time)The time at which this permission will expire (RFC 3339 date-time). Expiration times have the following restrictions: - They can only be set on user and group permissions - The time must be in the future - The time cannot be more than a year in the future
inheritedPermissionsDisabledbooleanWhen true, only organizers, owners, and users with permissions added directly on the item can access it.
kindstringOutput only. Identifies what kind of resource this is. Value: the fixed string "drive#permission". (default: drive#permission)
pendingOwnerbooleanWhether the account associated with this permission is a pending owner. Only populated for user type permissions for files that are not in a shared drive.
permissionDetailsarrayOutput only. Details of whether the permissions on this item are inherited or directly on this item.
photoLinkstringOutput only. A link to the user's profile photo, if available.
rolestringThe role granted by this permission. While new values may be supported in the future, the following are currently allowed: * owner * organizer * fileOrganizer * writer * commenter * reader
teamDrivePermissionDetailsarrayOutput only. Deprecated: Output only. Use permissionDetails instead.
typestringThe type of the grantee. Valid values are: * user * group * domain * anyone When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn't extra information required for an anyone type.
viewstringIndicates the view for this permission. Only populated for permissions that belong to a view. published and metadata are the only supported values. - published: The permission's role is published_reader. - metadata: The item is only visible to the metadata view because the item has limited access and the scope has at least read access to the parent. Note: The metadata view is currently only supported on folders.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, permissionIdsupportsAllDrives, supportsTeamDrives, useDomainAdminAccessGets a permission by ID.
listselectfileIdpageSize, pageToken, supportsAllDrives, supportsTeamDrives, useDomainAdminAccess, includePermissionsForViewLists a file's or shared drive's permissions.
createinsertfileIdemailMessage, enforceSingleParent, moveToNewOwnersRoot, sendNotificationEmail, supportsAllDrives, supportsTeamDrives, transferOwnership, useDomainAdminAccess, enforceExpansiveAccessCreates a permission for a file or shared drive. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.
updateupdatefileId, permissionIdremoveExpiration, supportsAllDrives, supportsTeamDrives, transferOwnership, useDomainAdminAccess, enforceExpansiveAccessUpdates a permission with patch semantics. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.
deletedeletefileId, permissionIdsupportsAllDrives, supportsTeamDrives, useDomainAdminAccess, enforceExpansiveAccessDeletes a permission. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

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
fileIdstring
permissionIdstring
emailMessagestring
enforceExpansiveAccessboolean
enforceSingleParentboolean
includePermissionsForViewstring
moveToNewOwnersRootboolean
pageSizeinteger (int32)
pageTokenstring
removeExpirationboolean
sendNotificationEmailboolean
supportsAllDrivesboolean
supportsTeamDrivesboolean
transferOwnershipboolean
useDomainAdminAccessboolean

SELECT examples

Gets a permission by ID.

SELECT
id,
allowFileDiscovery,
deleted,
displayName,
domain,
emailAddress,
expirationTime,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
teamDrivePermissionDetails,
type,
view
FROM googleworkspace.drivev3.permissions
WHERE fileId = '{{ fileId }}' -- required
AND permissionId = '{{ permissionId }}' -- required
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
;

INSERT examples

Creates a permission for a file or shared drive. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

INSERT INTO googleworkspace.drivev3.permissions (
data__id,
data__displayName,
data__type,
data__kind,
data__photoLink,
data__emailAddress,
data__role,
data__allowFileDiscovery,
data__domain,
data__expirationTime,
data__deleted,
data__view,
data__pendingOwner,
data__inheritedPermissionsDisabled,
fileId,
emailMessage,
enforceSingleParent,
moveToNewOwnersRoot,
sendNotificationEmail,
supportsAllDrives,
supportsTeamDrives,
transferOwnership,
useDomainAdminAccess,
enforceExpansiveAccess
)
SELECT
'{{ id }}',
'{{ displayName }}',
'{{ type }}',
'{{ kind }}',
'{{ photoLink }}',
'{{ emailAddress }}',
'{{ role }}',
{{ allowFileDiscovery }},
'{{ domain }}',
'{{ expirationTime }}',
{{ deleted }},
'{{ view }}',
{{ pendingOwner }},
{{ inheritedPermissionsDisabled }},
'{{ fileId }}',
'{{ emailMessage }}',
'{{ enforceSingleParent }}',
'{{ moveToNewOwnersRoot }}',
'{{ sendNotificationEmail }}',
'{{ supportsAllDrives }}',
'{{ supportsTeamDrives }}',
'{{ transferOwnership }}',
'{{ useDomainAdminAccess }}',
'{{ enforceExpansiveAccess }}'
RETURNING
id,
allowFileDiscovery,
deleted,
displayName,
domain,
emailAddress,
expirationTime,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
teamDrivePermissionDetails,
type,
view
;

UPDATE examples

Updates a permission with patch semantics. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

UPDATE googleworkspace.drivev3.permissions
SET
data__id = '{{ id }}',
data__displayName = '{{ displayName }}',
data__type = '{{ type }}',
data__kind = '{{ kind }}',
data__photoLink = '{{ photoLink }}',
data__emailAddress = '{{ emailAddress }}',
data__role = '{{ role }}',
data__allowFileDiscovery = {{ allowFileDiscovery }},
data__domain = '{{ domain }}',
data__expirationTime = '{{ expirationTime }}',
data__deleted = {{ deleted }},
data__view = '{{ view }}',
data__pendingOwner = {{ pendingOwner }},
data__inheritedPermissionsDisabled = {{ inheritedPermissionsDisabled }}
WHERE
fileId = '{{ fileId }}' --required
AND permissionId = '{{ permissionId }}' --required
AND removeExpiration = {{ removeExpiration}}
AND supportsAllDrives = {{ supportsAllDrives}}
AND supportsTeamDrives = {{ supportsTeamDrives}}
AND transferOwnership = {{ transferOwnership}}
AND useDomainAdminAccess = {{ useDomainAdminAccess}}
AND enforceExpansiveAccess = {{ enforceExpansiveAccess}}
RETURNING
id,
allowFileDiscovery,
deleted,
displayName,
domain,
emailAddress,
expirationTime,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
teamDrivePermissionDetails,
type,
view;

DELETE examples

Deletes a permission. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.

DELETE FROM googleworkspace.drivev3.permissions
WHERE fileId = '{{ fileId }}' --required
AND permissionId = '{{ permissionId }}' --required
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
AND enforceExpansiveAccess = '{{ enforceExpansiveAccess }}'
;