/// <summary> /// Update AccessControl /// </summary> /// <example> /// { /// "Principal":{"Email":"*****@*****.**"}, /// "CanUpload":true, /// "CanDownload":true, /// "CanView":true, /// "CanDelete":true, /// "CanManagePermissions":true /// } /// </example> /// <remarks> /// 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. /// </remarks> /// <param name="url"></param> /// <param name="accessControl"></param> /// <param name="recursive"></param> /// <returns> /// the created or modified AccessControl instance /// </returns> public IQuery<AccessControl> UpdateByItem(Uri url, AccessControl accessControl, bool recursive = false) { var sfApiQuery = new ShareFile.Api.Client.Requests.Query<AccessControl>(Client); sfApiQuery.Action("AccessControls"); sfApiQuery.Uri(url); sfApiQuery.QueryString("recursive", recursive); sfApiQuery.Body = accessControl; sfApiQuery.HttpMethod = "PATCH"; return sfApiQuery; }
/// <summary> /// Create AccessControl /// </summary> /// <example> /// { /// "Principal":{"url":"https://account.sf-api.com/v3/Groups(id)"}, /// "CanUpload":true, /// "CanDownload":true, /// "CanView":true, /// "CanDelete":true, /// "CanManagePermissions":true, /// "Message":"Message" /// } /// </example> /// <remarks> /// 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. /// </remarks> /// <param name="url"></param> /// <param name="accessControl"></param> /// <param name="recursive"></param> /// <param name="message"></param> /// <param name="sendDefaultNotification"></param> /// <returns> /// the created or modified AccessControl instance /// </returns> public IQuery<AccessControl> CreateByItem(Uri url, AccessControl accessControl, bool recursive = false, bool sendDefaultNotification = false, string message = null) { var sfApiQuery = new ShareFile.Api.Client.Requests.Query<AccessControl>(Client); sfApiQuery.Action("AccessControls"); sfApiQuery.Uri(url); sfApiQuery.QueryString("recursive", recursive); sfApiQuery.QueryString("sendDefaultNotification", sendDefaultNotification); accessControl.AddProperty("message", message); sfApiQuery.Body = accessControl; sfApiQuery.HttpMethod = "POST"; return sfApiQuery; }