permissions
Creates, updates, deletes, gets or lists a permissions resource.
Overview
| Name | permissions |
| Type | Resource |
| Id | googleworkspace.drivev3.permissions |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Output 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. |
allowFileDiscovery | boolean | Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone. |
deleted | boolean | Output only. Whether the account associated with this permission has been deleted. This field only pertains to permissions of type user or group. |
displayName | string | Output 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. |
domain | string | Output only. The domain to which this permission refers. |
emailAddress | string | Output only. The email address of the user or group to which this permission refers. |
expirationTime | string (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 |
inheritedPermissionsDisabled | boolean | When true, only organizers, owners, and users with permissions added directly on the item can access it. |
kind | string | Output only. Identifies what kind of resource this is. Value: the fixed string "drive#permission". (default: drive#permission) |
pendingOwner | boolean | Whether 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. |
permissionDetails | array | Output only. Details of whether the permissions on this item are inherited or are directly on this item. |
photoLink | string | Output only. A link to the user's profile photo, if available. |
role | string | The role granted by this permission. Supported values include: * owner * organizer * fileOrganizer * writer * commenter * reader For more information, see Roles and permissions. |
teamDrivePermissionDetails | array | Output only. Deprecated: Output only. Use permissionDetails instead. |
type | string | The 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. |
view | string | Indicates 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. |
| Name | Datatype | Description |
|---|---|---|
id | string | Output 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. |
allowFileDiscovery | boolean | Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone. |
deleted | boolean | Output only. Whether the account associated with this permission has been deleted. This field only pertains to permissions of type user or group. |
displayName | string | Output 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. |
domain | string | Output only. The domain to which this permission refers. |
emailAddress | string | Output only. The email address of the user or group to which this permission refers. |
expirationTime | string (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 |
inheritedPermissionsDisabled | boolean | When true, only organizers, owners, and users with permissions added directly on the item can access it. |
kind | string | Output only. Identifies what kind of resource this is. Value: the fixed string "drive#permission". (default: drive#permission) |
pendingOwner | boolean | Whether 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. |
permissionDetails | array | Output only. Details of whether the permissions on this item are inherited or are directly on this item. |
photoLink | string | Output only. A link to the user's profile photo, if available. |
role | string | The role granted by this permission. Supported values include: * owner * organizer * fileOrganizer * writer * commenter * reader For more information, see Roles and permissions. |
teamDrivePermissionDetails | array | Output only. Deprecated: Output only. Use permissionDetails instead. |
type | string | The 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. |
view | string | Indicates 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | fileId, permissionId | supportsAllDrives, supportsTeamDrives, useDomainAdminAccess | Gets a permission by ID. For more information, see Share files, folders, and drives. |
list | select | fileId | pageToken, supportsTeamDrives, supportsAllDrives, pageSize, includePermissionsForView, useDomainAdminAccess | Lists a file's or shared drive's permissions. For more information, see Share files, folders, and drives. |
create | insert | fileId | enforceSingleParent, moveToNewOwnersRoot, supportsTeamDrives, supportsAllDrives, transferOwnership, enforceExpansiveAccess, useDomainAdminAccess, emailMessage, sendNotificationEmail | 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. |
update | update | fileId, permissionId | removeExpiration, supportsTeamDrives, supportsAllDrives, transferOwnership, enforceExpansiveAccess, useDomainAdminAccess | 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. |
delete | delete | fileId, permissionId | useDomainAdminAccess, enforceExpansiveAccess, supportsAllDrives, supportsTeamDrives | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
fileId | string | |
permissionId | string | |
emailMessage | string | |
enforceExpansiveAccess | boolean | |
enforceSingleParent | boolean | |
includePermissionsForView | string | |
moveToNewOwnersRoot | boolean | |
pageSize | integer (int32) | |
pageToken | string | |
removeExpiration | boolean | |
sendNotificationEmail | boolean | |
supportsAllDrives | boolean | |
supportsTeamDrives | boolean | |
transferOwnership | boolean | |
useDomainAdminAccess | boolean |
SELECT examples
- get
- list
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 }}'
;
Lists a file's or shared drive's permissions. 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 pageToken = '{{ pageToken }}'
AND supportsTeamDrives = '{{ supportsTeamDrives }}'
AND supportsAllDrives = '{{ supportsAllDrives }}'
AND pageSize = '{{ pageSize }}'
AND includePermissionsForView = '{{ includePermissionsForView }}'
AND useDomainAdminAccess = '{{ useDomainAdminAccess }}'
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: permissions
props:
- name: fileId
value: "{{ fileId }}"
description: Required parameter for the permissions resource.
- name: kind
value: "{{ kind }}"
description: |
Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#permission"`.
default: drive#permission
- name: pendingOwner
value: {{ pendingOwner }}
description: |
Whether 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.
- name: type
value: "{{ type }}"
description: |
The 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.
- name: deleted
value: {{ deleted }}
description: |
Output only. Whether the account associated with this permission has been deleted. This field only pertains to permissions of type `user` or `group`.
- name: view
value: "{{ view }}"
description: |
Indicates 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](https://developers.google.com/workspace/drive/api/guides/ref-roles#views).
- name: inheritedPermissionsDisabled
value: {{ inheritedPermissionsDisabled }}
description: |
When `true`, only organizers, owners, and users with permissions added directly on the item can access it.
- name: photoLink
value: "{{ photoLink }}"
description: |
Output only. A link to the user's profile photo, if available.
- name: allowFileDiscovery
value: {{ allowFileDiscovery }}
description: |
Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type `domain` or `anyone`.
- name: displayName
value: "{{ displayName }}"
description: |
Output 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.
- name: expirationTime
value: "{{ expirationTime }}"
description: |
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
- name: role
value: "{{ role }}"
description: |
The role granted by this permission. Supported values include: * `owner` * `organizer` * `fileOrganizer` * `writer` * `commenter` * `reader` For more information, see [Roles and permissions](https://developers.google.com/workspace/drive/api/guides/ref-roles).
- name: id
value: "{{ id }}"
description: |
Output only. The ID of this permission. This is a unique identifier for the grantee, and is published in the [User resource](https://developers.google.com/workspace/drive/api/reference/rest/v3/User) as `permissionId`. IDs should be treated as opaque values.
- name: enforceSingleParent
value: {{ enforceSingleParent }}
- name: moveToNewOwnersRoot
value: {{ moveToNewOwnersRoot }}
- name: supportsTeamDrives
value: {{ supportsTeamDrives }}
- name: supportsAllDrives
value: {{ supportsAllDrives }}
- name: transferOwnership
value: {{ transferOwnership }}
- name: enforceExpansiveAccess
value: {{ enforceExpansiveAccess }}
- name: useDomainAdminAccess
value: {{ useDomainAdminAccess }}
- name: emailMessage
value: "{{ emailMessage }}"
- name: sendNotificationEmail
value: {{ sendNotificationEmail }}
UPDATE examples
- update
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
- delete
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 }}'
;