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.
Scopes
You will need authorization for at least one of the following scopes to make a valid call:
- https://www.googleapis.com/auth/drive
- https://www.googleapis.com/auth/drive.file
If unset, the scope for this method defaults to https://www.googleapis.com/auth/drive.
You can set the scope for this method like this: drive2 --scope <scope> permissions insert ...
Required Scalar Argument
- <file-id> (string)
- The ID for the file or shared drive.
Required Request Value
The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.
For example, a structure like this:
Permission:
additional-roles: [string]
auth-key: string
deleted: boolean
domain: string
email-address: string
etag: string
expiration-date: string
id: string
kind: string
name: string
pending-owner: boolean
photo-link: string
role: string
self-link: string
type: string
value: string
view: string
with-link: boolean
can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.
-r . additional-roles=invidunt
- Additional roles for this user. Only
commenter
is currently allowed, though more may be supported in the future. - Each invocation of this argument appends the given value to the array.
- Additional roles for this user. Only
auth-key=consetetur
- Output only. Deprecated.
deleted=false
- Output only. Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
domain=est
- Output 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
ordomain
.
- Output 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
email-address=erat
- Output 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
orgroup
.
- Output 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
etag=duo
- Output only. The ETag of the permission.
expiration-date=sed
- 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
id=dolor
- The ID of the user this permission refers to, and identical to the
permissionId
in the About and Files resources. When making adrive.permissions.insert
request, exactly one of theid
orvalue
fields must be specified unless the permission type isanyone
, in which case bothid
andvalue
are ignored.
- The ID of the user this permission refers to, and identical to the
kind=gubergren
- Output only. This is always
drive#permission
.
- Output only. This is always
name=takimata
- Output only. The name for this permission.
pending-owner=false
- Whether 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.
- Whether the account associated with this permission is a pending owner. Only populated for
photo-link=erat
- Output only. A link to the profile photo, if available.
role=sea
- The primary role for this user. While new values may be supported in the future, the following are currently allowed: *
owner
*organizer
*fileOrganizer
*writer
*reader
- The primary role for this user. While new values may be supported in the future, the following are currently allowed: *
self-link=vero
- Output only. A link back to this permission.
type=diam
- The account type. Allowed values are: *
user
*group
*domain
*anyone
- The account type. Allowed values are: *
value=takimata
- The 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 theid
orvalue
fields must be specified unless the permission type isanyone
, in which case bothid
andvalue
are ignored.
- The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a
view=voluptua.
- Indicates the view for this permission. Only populated for permissions that belong to a view.
published
is the only supported value.
- Indicates the view for this permission. Only populated for permissions that belong to a view.
with-link=false
- Whether the link is required for this permission.
About Cursors
The cursor position is key to comfortably set complex nested structures. The following rules apply:
- The cursor position is always set relative to the current one, unless the field name starts with the
.
character. Fields can be nested such as in-r f.s.o
. - The cursor position is set relative to the top-level structure if it starts with
.
, e.g.-r .s.s
- You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify
-r struct.sub_struct=bar
. - You can move the cursor one level up by using
..
. Each additional.
moves it up one additional level. E.g....
would go three levels up.
Optional Output Flags
The method's return value a JSON encoded structure, which will be written to standard output by default.
- -o out
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
-
to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
Optional Method Properties
You may set the following properties to further configure the call. Please note that -p
is followed by one
or more key-value-pairs, and is called like this -p k1=v1 k2=v2
even though the listing below repeats the
-p
for completeness.
-
-p email-message=string
- A plain text custom message to include in notification emails.
-
-p enforce-single-parent=boolean
- Deprecated: See
moveToNewOwnersRoot
for details.
- Deprecated: See
-
-p move-to-new-owners-root=boolean
- This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to
true
, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set tofalse
, parents are not changed.
- This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to
-
-p send-notification-emails=boolean
- Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the
role
isowner
.
- Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the
-
-p supports-all-drives=boolean
- Whether the requesting application supports both My Drives and shared drives.
-
-p supports-team-drives=boolean
- Deprecated: Use
supportsAllDrives
instead.
- Deprecated: Use
-
-p use-domain-admin-access=boolean
- Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
Optional General Properties
The following properties can configure any call, and are not specific to this method.
-
-p $-xgafv=string
- V1 error format.
-
-p access-token=string
- OAuth access token.
-
-p alt=string
- Data format for response.
-
-p callback=string
- JSONP
-
-p fields=string
- Selector specifying which fields to include in a partial response.
-
-p key=string
- API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
-
-p oauth-token=string
- OAuth 2.0 token for the current user.
-
-p pretty-print=boolean
- Returns response with indentations and line breaks.
-
-p quota-user=string
- Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
-
-p upload-type=string
- Legacy upload protocol for media (e.g. "media", "multipart").
-
-p upload-protocol=string
- Upload protocol for media (e.g. "raw", "multipart").