Exemplo n.º 1
0
        /// <summary>
        /// Update multiple access controls for a single principal
        /// </summary>
        /// <example>
        /// {
        /// "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":"*****@*****.**" },
        /// "CanUpload" : false,
        /// "CanDownload" : true,
        /// "CanView" : true
        /// }
        /// }
        /// ]
        /// }
        /// </example>
        /// <param name="principalId"></param>
        /// <param name="bulkParams"></param>
        /// <returns>
        /// AccessControlBulkResult
        /// </returns>
        public IQuery <AccessControlBulkResult> BulkSetForPrincipal(AccessControlsBulkParams bulkParams, string principalId)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <AccessControlBulkResult>(Client);

            sfApiQuery.From("AccessControls");
            sfApiQuery.Action("BulkSetForPrincipal");
            sfApiQuery.QueryString("principalId", principalId);
            sfApiQuery.Body       = bulkParams;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create or Update multiple AccessControls for a given Item
        /// </summary>
        /// <example>
        /// {
        /// "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":"*****@*****.**" },
        /// "CanUpload" : false,
        /// "CanDownload" : true,
        /// "CanView" : true
        /// }
        /// }
        /// ]
        /// }
        /// </example>
        /// <remarks>
        /// 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.
        /// </remarks>
        /// <param name="url"></param>
        /// <param name="bulkParams"></param>
        /// <returns>
        /// AccessControlBulkResult
        /// </returns>
        public IQuery <AccessControlBulkResult> BulkSet(Uri url, AccessControlsBulkParams bulkParams)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query <AccessControlBulkResult>(Client);

            sfApiQuery.Action("AccessControls");
            sfApiQuery.Uri(url);
            sfApiQuery.SubAction("BulkSet");
            sfApiQuery.Body       = bulkParams;
            sfApiQuery.HttpMethod = "POST";
            return(sfApiQuery);
        }