AccessControls

AccessControls define the rights and options of a Principal to a given Item AccessControls define a set of rights - such as CanUpload, CanDownload, CanView - as well as a set of options - such as NotifyOnUpload - that applies to a given Principal (user) and Item (folder). In ShareFile, Access Controls are only associated with Folders. Access Controls can be inherited on Children Folders, or Children can override the list of the Parent. The ACLs are not additive - either the Child uses the list of the Parent, or it defines a new list.

Get AccessControl by ID

GET https://account.sf-api.com/sf/v3/AccessControls(principalid=principalid,itemid=itemid) 

Retrieves a single Access Control entry for a given Item and Principal

principalidString Principal Identifier
itemidString Item Identifier

Returns: A single AccessControl object matching the query

Get AccessControl List By Item

GET https://account.sf-api.com/sf/v3/Items(id)/AccessControls 

Retrieves the Access Control List for a given Item.

idString Item identifier

Returns: Access Control List of the given object ID.

Create AccessControl

POST https://account.sf-api.com/sf/v3/Items(id)/AccessControls?recursive=false 
             { 
              "Principal":{"url":"https://account.sf-api.com/v3/Groups(id)"}, 
              "CanUpload":true, 
              "CanDownload":true, 
              "CanView":true, 
              "CanDelete":true, 
              "CanManagePermissions":true, 
              "Message":"Message" 
             } 

Creates a new Access Controls entry for a given Item. Access controls can only define a single Principal, which can be either a Group or User. The 'Principal' element is specified as an object - you should populate either the URL or the ID reference. If CanDownload is set to true, CanView will automatically be set to true. If CanDownload is set to false, CanDelete will be set to false. In order for a user/group to be able to manage permissions, they must be able to upload, download, and delete. Otherwise it will be set to false. This endpoint can return an AsyncOperation if the request is to be fulfilled asynchronously

idString Item identifier
accessControlAccessControl AccessControl to create
recursiveBoolean Indicates whether the operation applies to sub-folders of this item. Default is "false", only the target object is modified
messageString Message sent of other principals with rights on the modified Item. This parameter can be sent as a URI param, or as part of the JSON description, added to the AccessControl element described there.
sendDefaultNotificationBoolean Indicates whether or not the system should send a default notification to the Principals. Default is "false"

Returns: the created or modified AccessControl instance, or AsyncOperation

Update AccessControl

PATCH https://account.sf-api.com/sf/v3/Items(id)/AccessControls?recursive=false 
             { 
              "Principal":{"Email":"user@domain.com"}, 
              "CanUpload":true, 
              "CanDownload":true, 
              "CanView":true, 
              "CanDelete":true, 
              "CanManagePermissions":true 
             } 

Updates an existing Access Controls of a given Item. The Principal element cannot be modified, it is provided in the Body to identity the AccessControl element to be modified. You can provide an ID, Email or URL on the Principal object. This endpoint can return an AsyncOperation if the request is to be fulfilled asynchronously

idString Item identifier
accessControlAccessControl
recursiveBoolean Indicates whether the operation applies to sub-folders of this item. Default is "false", only the target object is modified

Returns: the created or modified AccessControl instance, or AsyncOperation

Delete AccessControl

DELETE https://account.sf-api.com/sf/v3/AccessControls(principalid=id,itemid=id) 

Deletes an AccessControl entry by itemID and principalID. This method does not return any object, a 204 (No Content) response indicates success.

principalidString Principal Identifier
itemidString Item Identifier

Create or Update multiple AccessControls for a given Item

POST https://account.sf-api.com/sf/v3/Items(id)/AccessControls/BulkSet 
             { 
              "NotifyUser":true, 
              "NotifyMessage":"msg", 
             
              "AccessControlParams": 
              [ 
                { 
                  "AccessControl": 
                  { 
                    "Principal" : { "Id":"existing_user_id" }, 
                    "CanUpload" : true, 
                    "CanDownload" : false, 
                    "CanView" : true 
                  }, 
                  "NotifyUser":false 
                }, 
                { 
                  "AccessControl": 
                  { 
                    "Principal" : { "Id":"group_id" }, 
                    "CanUpload" : false, 
                    "CanDownload" : true, 
                    "CanView" : true 
                  }, 
                 "Recursive":true 
                }, 
                { 
                  "AccessControl": 
                  { 
                    "Principal" : { "Email":"new_or_existing_user@a.com" }, 
                    "CanUpload" : false, 
                    "CanDownload" : true, 
                    "CanView" : true 
                  } 
                } 
              ] 
             } 

All the AccessControls are created or updated for a single Item identified by the Item id in the URI. AccessControl.Item Ids are not allowed. If an AccessControl doesn't specify NotifyUser or NotifyMessage property their values are inherited from the corresponding top-level properties. The Principal can be identified by Id or Email (Users). If a User with the specified email does not exist it will be created. Defaults for NotifyUser and Recursive are false. See AccessControlsBulkParams for other details.

idString Item id
bulkParamsAccessControlsBulkParams AccessControlsBulkParams

Returns: AccessControlBulkResult

Update multiple access controls for a single principal

POST https://account.sf-api.com/sf/v3/AccessControls/BulkSetForPrincipal?principalId=my-principal-id 
             { 
              "NotifyUser":true, 
              "NotifyMessage":"msg", 
             
              "AccessControlParams": 
              [ 
                { 
                  "AccessControl": 
                  { 
            		   "Item": { "Id": "item-id-1" }, 
                    "Principal" : { "Id":"existing_user_id" }, 
                    "CanUpload" : true, 
                    "CanDownload" : false, 
                    "CanView" : true 
                  }, 
                  "NotifyUser":false 
                }, 
                { 
                  "AccessControl": 
                  { 
                    "Item": { "Id": "item-id-3" }, 
                    "Principal" : { "Id":"group_id" }, 
                    "CanUpload" : false, 
                    "CanDownload" : true, 
                    "CanView" : true 
                  }, 
                 "Recursive":true 
                }, 
                { 
                  "AccessControl": 
                  { 
                    "Item": { "Id": "item-id-2" }, 
                    "Principal" : { "Email":"new_or_existing_user@a.com" }, 
                    "CanUpload" : false, 
                    "CanDownload" : true, 
                    "CanView" : true 
                  } 
                } 
              ] 
             } 
principalIdString Principal id
bulkParamsAccessControlsBulkParams AccessControlsBulkParams

Returns: AccessControlBulkResult

Recursively clones multiple access controls for multiple principals

POST https://account.sf-api.com/sf/v3/AccessControls/Clone 
            { 
              "FolderId":"top-level-folder-id", 
              "PrincipalId":"source-user-or-group-id", 
              "ClonePrincipalIds": 
              [ 
                "clone-user-or-group-id-1", 
                "clone-user-or-group-id-2", 
                "clone-user-or-group-id-3" 
              ] 
            } 
accessControlsCloneParamsAccessControlsCloneParams AccessControlsCloneParams

Returns: Cloned access controls

Delete multiple access controls

POST https://account.sf-api.com/sf/v3/Items(grandparentid)/AccessControls/BulkDelete 
            ["id1","id2"] 
folderIdString Id of Parent item
principalIdsString[] List of IDs of principals to be deleted

Delete multiple access controls for principal

POST https://account.sf-api.com/sf/v3/AccessControls/BulkDeleteForPrincipal?principalId=xxxxx 
            ["id1","id2"] 
principalIdString Id of Principal
folderIdsString[] List of IDs of folders

Notify users that they have access to the parent folder

POST https://account.sf-api.com/sf/v3/Items(id)/AccessControls/NotifyUsers 
            	{ 
            		UserIds: ["id1", "id2"], 
            		CustomMessage: "Message content goes here" 
            	} 

All users should have access to the parent folder

folderIdString ID of Parent item
notifyUsersParamsNotifyUsersParams Parameter container

Shows preview of the folder user email

POST https://account.sf-api.com/sf/v3/Items(id)/AccessControls/NotifyUsersPreview 
folderIdString ID of Parent item
notifyUsersParamsNotifyUsersParams Parameter container