1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18/** 19 * The "permissions" collection of methods. 20 * Typical usage is: 21 * <code> 22 * $driveService = new Google_Service_Drive(...); 23 * $permissions = $driveService->permissions; 24 * </code> 25 */ 26class Google_Service_Drive_Resource_Permissions extends Google_Service_Resource 27{ 28 /** 29 * Creates a permission for a file or shared drive. (permissions.create) 30 * 31 * @param string $fileId The ID of the file or shared drive. 32 * @param Google_Service_Drive_Permission $postBody 33 * @param array $optParams Optional parameters. 34 * 35 * @opt_param string emailMessage A plain text custom message to include in the 36 * notification email. 37 * @opt_param bool enforceSingleParent Deprecated. See moveToNewOwnersRoot for 38 * details. 39 * @opt_param bool moveToNewOwnersRoot This parameter will only take effect if 40 * the item is not in a shared drive and the request is attempting to transfer 41 * the ownership of the item. If set to true, the item will be moved to the new 42 * owner's My Drive root folder and all prior parents removed. If set to false, 43 * parents are not changed. 44 * @opt_param bool sendNotificationEmail Whether to send a notification email 45 * when sharing to users or groups. This defaults to true for users and groups, 46 * and is not allowed for other requests. It must not be disabled for ownership 47 * transfers. 48 * @opt_param bool supportsAllDrives Whether the requesting application supports 49 * both My Drives and shared drives. 50 * @opt_param bool supportsTeamDrives Deprecated use supportsAllDrives instead. 51 * @opt_param bool transferOwnership Whether to transfer ownership to the 52 * specified user and downgrade the current owner to a writer. This parameter is 53 * required as an acknowledgement of the side effect. 54 * @opt_param bool useDomainAdminAccess Issue the request as a domain 55 * administrator; if set to true, then the requester will be granted access if 56 * the file ID parameter refers to a shared drive and the requester is an 57 * administrator of the domain to which the shared drive belongs. 58 * @return Google_Service_Drive_Permission 59 */ 60 public function create($fileId, Google_Service_Drive_Permission $postBody, $optParams = array()) 61 { 62 $params = array('fileId' => $fileId, 'postBody' => $postBody); 63 $params = array_merge($params, $optParams); 64 return $this->call('create', array($params), "Google_Service_Drive_Permission"); 65 } 66 /** 67 * Deletes a permission. (permissions.delete) 68 * 69 * @param string $fileId The ID of the file or shared drive. 70 * @param string $permissionId The ID of the permission. 71 * @param array $optParams Optional parameters. 72 * 73 * @opt_param bool supportsAllDrives Whether the requesting application supports 74 * both My Drives and shared drives. 75 * @opt_param bool supportsTeamDrives Deprecated use supportsAllDrives instead. 76 * @opt_param bool useDomainAdminAccess Issue the request as a domain 77 * administrator; if set to true, then the requester will be granted access if 78 * the file ID parameter refers to a shared drive and the requester is an 79 * administrator of the domain to which the shared drive belongs. 80 */ 81 public function delete($fileId, $permissionId, $optParams = array()) 82 { 83 $params = array('fileId' => $fileId, 'permissionId' => $permissionId); 84 $params = array_merge($params, $optParams); 85 return $this->call('delete', array($params)); 86 } 87 /** 88 * Gets a permission by ID. (permissions.get) 89 * 90 * @param string $fileId The ID of the file. 91 * @param string $permissionId The ID of the permission. 92 * @param array $optParams Optional parameters. 93 * 94 * @opt_param bool supportsAllDrives Whether the requesting application supports 95 * both My Drives and shared drives. 96 * @opt_param bool supportsTeamDrives Deprecated use supportsAllDrives instead. 97 * @opt_param bool useDomainAdminAccess Issue the request as a domain 98 * administrator; if set to true, then the requester will be granted access if 99 * the file ID parameter refers to a shared drive and the requester is an 100 * administrator of the domain to which the shared drive belongs. 101 * @return Google_Service_Drive_Permission 102 */ 103 public function get($fileId, $permissionId, $optParams = array()) 104 { 105 $params = array('fileId' => $fileId, 'permissionId' => $permissionId); 106 $params = array_merge($params, $optParams); 107 return $this->call('get', array($params), "Google_Service_Drive_Permission"); 108 } 109 /** 110 * Lists a file's or shared drive's permissions. (permissions.listPermissions) 111 * 112 * @param string $fileId The ID of the file or shared drive. 113 * @param array $optParams Optional parameters. 114 * 115 * @opt_param string includePermissionsForView Specifies which additional view's 116 * permissions to include in the response. Only 'published' is supported. 117 * @opt_param int pageSize The maximum number of permissions to return per page. 118 * When not set for files in a shared drive, at most 100 results will be 119 * returned. When not set for files that are not in a shared drive, the entire 120 * list will be returned. 121 * @opt_param string pageToken The token for continuing a previous list request 122 * on the next page. This should be set to the value of 'nextPageToken' from the 123 * previous response. 124 * @opt_param bool supportsAllDrives Whether the requesting application supports 125 * both My Drives and shared drives. 126 * @opt_param bool supportsTeamDrives Deprecated use supportsAllDrives instead. 127 * @opt_param bool useDomainAdminAccess Issue the request as a domain 128 * administrator; if set to true, then the requester will be granted access if 129 * the file ID parameter refers to a shared drive and the requester is an 130 * administrator of the domain to which the shared drive belongs. 131 * @return Google_Service_Drive_PermissionList 132 */ 133 public function listPermissions($fileId, $optParams = array()) 134 { 135 $params = array('fileId' => $fileId); 136 $params = array_merge($params, $optParams); 137 return $this->call('list', array($params), "Google_Service_Drive_PermissionList"); 138 } 139 /** 140 * Updates a permission with patch semantics. (permissions.update) 141 * 142 * @param string $fileId The ID of the file or shared drive. 143 * @param string $permissionId The ID of the permission. 144 * @param Google_Service_Drive_Permission $postBody 145 * @param array $optParams Optional parameters. 146 * 147 * @opt_param bool removeExpiration Whether to remove the expiration date. 148 * @opt_param bool supportsAllDrives Whether the requesting application supports 149 * both My Drives and shared drives. 150 * @opt_param bool supportsTeamDrives Deprecated use supportsAllDrives instead. 151 * @opt_param bool transferOwnership Whether to transfer ownership to the 152 * specified user and downgrade the current owner to a writer. This parameter is 153 * required as an acknowledgement of the side effect. 154 * @opt_param bool useDomainAdminAccess Issue the request as a domain 155 * administrator; if set to true, then the requester will be granted access if 156 * the file ID parameter refers to a shared drive and the requester is an 157 * administrator of the domain to which the shared drive belongs. 158 * @return Google_Service_Drive_Permission 159 */ 160 public function update($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array()) 161 { 162 $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody); 163 $params = array_merge($params, $optParams); 164 return $this->call('update', array($params), "Google_Service_Drive_Permission"); 165 } 166} 167