Skip to main content

permissions

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

Overview

Namepermissions
TypeResource
Idgoogleworkspace.drivev2.permissions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored.
namestringOutput only. The name for this permission.
additionalRolesarrayAdditional roles for this user. Only commenter is currently allowed, though more may be supported in the future.
authKeystringOutput only. Deprecated.
deletedbooleanOutput only. Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
domainstringOutput only. The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
emailAddressstringOutput only. The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
etagstringOutput only. The ETag of the permission.
expirationDatestring (date-time)The time at which this permission will expire (RFC 3339 date-time). Expiration dates have the following restrictions: - They can only be set on user and group permissions - The date must be in the future - The date cannot be more than a year in the future - The date can only be set on drive.permissions.update or drive.permissions.patch requests
inheritedPermissionsDisabledbooleanWhen true, only organizers, owners, and users with permissions added directly on the item can access it.
kindstringOutput only. This is always 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 profile photo, if available.
rolestringThe primary role for this user. While new values may be supported in the future, the following are currently allowed: * owner * organizer * fileOrganizer * writer * reader
selfLinkstringOutput only. A link back to this permission.
teamDrivePermissionDetailsarrayOutput only. Deprecated: Use permissionDetails instead.
typestringThe account type. Allowed values are: * user * group * domain * anyone
valuestringThe email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored.
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.
withLinkbooleanWhether the link is required for this permission.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, permissionIdsupportsAllDrives, supportsTeamDrives, useDomainAdminAccessGets a permission by ID.
listselectfileIdmaxResults, pageToken, supportsAllDrives, supportsTeamDrives, useDomainAdminAccess, includePermissionsForViewLists a file's or shared drive's permissions.
insertinsertfileIdemailMessage, enforceSingleParent, moveToNewOwnersRoot, sendNotificationEmails, supportsAllDrives, supportsTeamDrives, useDomainAdminAccess, enforceExpansiveAccessInserts 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.
patchupdatefileId, permissionIdremoveExpiration, supportsAllDrives, supportsTeamDrives, transferOwnership, useDomainAdminAccess, enforceExpansiveAccessUpdates a permission using patch semantics. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.
updatereplacefileId, permissionIdremoveExpiration, supportsAllDrives, supportsTeamDrives, transferOwnership, useDomainAdminAccess, enforceExpansiveAccessUpdates a permission. Warning: Concurrent permissions operations on the same file are not supported; only the last update is applied.
deletedeletefileId, permissionIdsupportsAllDrives, supportsTeamDrives, useDomainAdminAccess, enforceExpansiveAccessDeletes a permission from a file or shared drive. 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
maxResultsinteger (int32)
moveToNewOwnersRootboolean
pageTokenstring
removeExpirationboolean
sendNotificationEmailsboolean
supportsAllDrivesboolean
supportsTeamDrivesboolean
transferOwnershipboolean
useDomainAdminAccessboolean

SELECT examples

Gets a permission by ID.

SELECT
id,
name,
additionalRoles,
authKey,
deleted,
domain,
emailAddress,
etag,
expirationDate,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
selfLink,
teamDrivePermissionDetails,
type,
value,
view,
withLink
FROM googleworkspace.drivev2.permissions
WHERE fileId = '{{ fileId }}' -- required
AND permissionId = '{{ permissionId }}' -- required
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
;

INSERT examples

Inserts 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.drivev2.permissions (
data__id,
data__name,
data__type,
data__role,
data__additionalRoles,
data__authKey,
data__value,
data__kind,
data__withLink,
data__photoLink,
data__selfLink,
data__emailAddress,
data__domain,
data__etag,
data__expirationDate,
data__deleted,
data__view,
data__pendingOwner,
data__inheritedPermissionsDisabled,
fileId,
emailMessage,
enforceSingleParent,
moveToNewOwnersRoot,
sendNotificationEmails,
supportsAllDrives,
supportsTeamDrives,
useDomainAdminAccess,
enforceExpansiveAccess
)
SELECT
'{{ id }}',
'{{ name }}',
'{{ type }}',
'{{ role }}',
'{{ additionalRoles }}',
'{{ authKey }}',
'{{ value }}',
'{{ kind }}',
{{ withLink }},
'{{ photoLink }}',
'{{ selfLink }}',
'{{ emailAddress }}',
'{{ domain }}',
'{{ etag }}',
'{{ expirationDate }}',
{{ deleted }},
'{{ view }}',
{{ pendingOwner }},
{{ inheritedPermissionsDisabled }},
'{{ fileId }}',
'{{ emailMessage }}',
'{{ enforceSingleParent }}',
'{{ moveToNewOwnersRoot }}',
'{{ sendNotificationEmails }}',
'{{ supportsAllDrives }}',
'{{ supportsTeamDrives }}',
'{{ useDomainAdminAccess }}',
'{{ enforceExpansiveAccess }}'
RETURNING
id,
name,
additionalRoles,
authKey,
deleted,
domain,
emailAddress,
etag,
expirationDate,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
selfLink,
teamDrivePermissionDetails,
type,
value,
view,
withLink
;

UPDATE examples

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

UPDATE googleworkspace.drivev2.permissions
SET
data__id = '{{ id }}',
data__name = '{{ name }}',
data__type = '{{ type }}',
data__role = '{{ role }}',
data__additionalRoles = '{{ additionalRoles }}',
data__authKey = '{{ authKey }}',
data__value = '{{ value }}',
data__kind = '{{ kind }}',
data__withLink = {{ withLink }},
data__photoLink = '{{ photoLink }}',
data__selfLink = '{{ selfLink }}',
data__emailAddress = '{{ emailAddress }}',
data__domain = '{{ domain }}',
data__etag = '{{ etag }}',
data__expirationDate = '{{ expirationDate }}',
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,
name,
additionalRoles,
authKey,
deleted,
domain,
emailAddress,
etag,
expirationDate,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
selfLink,
teamDrivePermissionDetails,
type,
value,
view,
withLink;

REPLACE examples

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

REPLACE googleworkspace.drivev2.permissions
SET
data__id = '{{ id }}',
data__name = '{{ name }}',
data__type = '{{ type }}',
data__role = '{{ role }}',
data__additionalRoles = '{{ additionalRoles }}',
data__authKey = '{{ authKey }}',
data__value = '{{ value }}',
data__kind = '{{ kind }}',
data__withLink = {{ withLink }},
data__photoLink = '{{ photoLink }}',
data__selfLink = '{{ selfLink }}',
data__emailAddress = '{{ emailAddress }}',
data__domain = '{{ domain }}',
data__etag = '{{ etag }}',
data__expirationDate = '{{ expirationDate }}',
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,
name,
additionalRoles,
authKey,
deleted,
domain,
emailAddress,
etag,
expirationDate,
inheritedPermissionsDisabled,
kind,
pendingOwner,
permissionDetails,
photoLink,
role,
selfLink,
teamDrivePermissionDetails,
type,
value,
view,
withLink;

DELETE examples

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

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