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 the User resource 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 permissions of type user or group.
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 "Dana A." * group - Name of the Google Group, such as "The Company Administrators." * domain - String domain name, such as "cymbalgroup.com." * anyone - No displayName is present.
domainstringOutput only. The domain to which this permission refers.
emailAddressstringOutput only. The 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 permissions of type user for files that aren't in a shared drive.
permissionDetailsarrayOutput only. Details of whether the permissions on this item are inherited or are directly on this item.
photoLinkstringOutput only. A link to the user's profile photo, if available.
rolestringThe role granted by this permission. Supported values include: * owner * organizer * fileOrganizer * writer * commenter * reader For more information, see Roles and permissions.
teamDrivePermissionDetailsarrayOutput only. Deprecated: Output only. Use permissionDetails instead.
typestringThe type of the grantee. Supported values include: * user * group * domain * anyone When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. If type is domain, you must provide a domain. If type is anyone, no extra information is required.
viewstringIndicates the view for this permission. Only populated for permissions that belong to a view. The only supported values are published and metadata: * published: The permission's role is publishedReader. * 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. The metadata view is only supported on folders. For more information, see Views.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, permissionIdsupportsAllDrives, supportsTeamDrives, useDomainAdminAccessGets a permission by ID. For more information, see Share files, folders, and drives.
listselectfileIdpageToken, supportsTeamDrives, supportsAllDrives, pageSize, includePermissionsForView, useDomainAdminAccessLists a file's or shared drive's permissions. For more information, see Share files, folders, and drives.
createinsertfileIdenforceSingleParent, moveToNewOwnersRoot, supportsTeamDrives, supportsAllDrives, transferOwnership, enforceExpansiveAccess, useDomainAdminAccess, emailMessage, sendNotificationEmailCreates a permission for a file or shared drive. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't supported; only the last update is applied.
updateupdatefileId, permissionIdremoveExpiration, supportsTeamDrives, supportsAllDrives, transferOwnership, enforceExpansiveAccess, useDomainAdminAccessUpdates a permission with patch semantics. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't supported; only the last update is applied.
deletedeletefileId, permissionIduseDomainAdminAccess, enforceExpansiveAccess, supportsAllDrives, supportsTeamDrivesDeletes a permission. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't 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. For more information, see Share files, folders, and drives.

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. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't supported; only the last update is applied.

INSERT INTO googleworkspace.drivev3.permissions (
data__kind,
data__pendingOwner,
data__type,
data__deleted,
data__view,
data__inheritedPermissionsDisabled,
data__photoLink,
data__allowFileDiscovery,
data__displayName,
data__expirationTime,
data__role,
data__id,
fileId,
enforceSingleParent,
moveToNewOwnersRoot,
supportsTeamDrives,
supportsAllDrives,
transferOwnership,
enforceExpansiveAccess,
useDomainAdminAccess,
emailMessage,
sendNotificationEmail
)
SELECT
'{{ kind }}',
{{ pendingOwner }},
'{{ type }}',
{{ deleted }},
'{{ view }}',
{{ inheritedPermissionsDisabled }},
'{{ photoLink }}',
{{ allowFileDiscovery }},
'{{ displayName }}',
'{{ expirationTime }}',
'{{ role }}',
'{{ id }}',
'{{ fileId }}',
'{{ enforceSingleParent }}',
'{{ moveToNewOwnersRoot }}',
'{{ supportsTeamDrives }}',
'{{ supportsAllDrives }}',
'{{ transferOwnership }}',
'{{ enforceExpansiveAccess }}',
'{{ useDomainAdminAccess }}',
'{{ emailMessage }}',
'{{ sendNotificationEmail }}'
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. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't supported; only the last update is applied.

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

DELETE examples

Deletes a permission. For more information, see Share files, folders, and drives. Warning: Concurrent permissions operations on the same file aren't supported; only the last update is applied.

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