Get a File's Permissions

Gets the permissions that are associated with a target file version.

Permissions determine the actions that are available to the requesting user for a target file version. Note that there is no "deny" permission. When a user has certain permissions to a file, it is because those permissions are explicitly granted to their user ID, because the user is a member of a group that has those permissions, or because the user has an assigned role that has those permissions.

If the permissions are set explicitly on the file, then those permissions are returned. Otherwise, inherited permissions are returned. The IsExplicit flag in the response specifies whether the permissions are explicit or implicit. The PermissionsInheritedFromFolderId property in the response specifies the folder ID of the folder from which the permissions are inherited.

Note that in addition to permissions that grant specific access to users, groups, or users that have specific roles, each file could alternatively be configured to base its access permissions on the settings that are applied to its parent folder. For this alternative approach, use the InheritFromFolderPermissions property of the folder. If the value of InheritFromFolderPermissions is true, then any settings on the folder’s Permissions property are ignored.

Note: For more information about this command, including descriptions of any path and request parameters, request body schema, response codes and schemas, and payload examples, refer to the online API reference for this command at the following web page:

Gets a file's permissions

URI

https://bartendercloud.com/api/librarian/files/{fileId}/permissions

Note: The bartendercloud.com domain that is referenced in the URI and in the code example that follows must be replaced with the contents of the DataCenterURI claim that is extracted from your access token. For more information, refer to Extracting the DataCenterURI Claim.

Path Parameters

fileId

Type: String

Specifies the ID of the file. Required.

Query Parameters

versionMajor

Type: Integer <int32>

Specifies the requested major version. Gets the latest version if both major and minor versions are not provided. Also gets the latest version if a major version is not provided and if minor versioning is not enabled in the space, regardless of the minor version value. Optional.

versionMinor

Type: Integer <int32>

Specifies the requested minor version. Required when minor versioning is enabled in the space; otherwise optional.

Example

Request body: None.

Response: See FilePermissions.

Copy
// Assume that fileId is the ID of the target file. 
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");

HttpResponseMessage msg = await client.GetAsync($"https://bartendercloud.com/api/librarian/files/{fileId}/permissions?versionMajor={majorVersion}&versionMinor={minorVersion}");

if (msg.IsSuccessStatusCode)
{
   var response = await msg.Content.ReadAsStringAsync();
   return JsonConvert.DeserializeObject<FilePermissions>(response);
}