// </Snippet_RemoveACLEntry> #endregion #region Remove ACLs recursively // <Snippet_RemoveACLRecursively> public async Task RemoveACLsRecursively(DataLakeServiceClient serviceClient, bool isDefaultScope) { DataLakeDirectoryClient directoryClient = serviceClient.GetFileSystemClient("my-container"). GetDirectoryClient("my-parent-directory"); List <RemovePathAccessControlItem> accessControlListForRemoval = new List <RemovePathAccessControlItem>() { new RemovePathAccessControlItem(AccessControlType.User, isDefaultScope, entityId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), }; await directoryClient.RemoveAccessControlRecursiveAsync (accessControlListForRemoval, null); }
/// <summary> /// Remove ACL recusive async function /// </summary> protected override async Task OperationAclResusive(long taskId) { IStorageBlobManagement localChannel = Channel; progressRecord = GetProgressRecord("Remove", taskId); continuationToken = this.ContinuationToken; bool foundAFolder = false; DataLakeFileClient fileClient = null; DataLakeDirectoryClient dirClient = null; DataLakeFileSystemClient fileSystem = GetFileSystemClientByName(localChannel, this.FileSystem); foundAFolder = GetExistDataLakeGen2Item(fileSystem, this.Path, out fileClient, out dirClient); if (foundAFolder) { if (ShouldProcess(dirClient.Uri.ToString(), "Remove Acl recursively on Directory: ")) { WriteWarning("To find the ACL Entry to remove, will only compare AccessControlType, DefaultScope and EntityId, will omit Permission."); await dirClient.RemoveAccessControlRecursiveAsync(PSPathAccessControlEntry.ParseRemoveAccessControls(this.Acl), continuationToken, GetAccessControlChangeOptions(taskId), CmdletCancellationToken).ConfigureAwait(false); SetProgressComplete(); WriteResult(taskId); } } else { if (ShouldProcess(fileClient.Uri.ToString(), "Remove Acl recursively on File: ")) { WriteWarning("To find the ACL Entry to remove, will only compare AccessControlType, DefaultScope and EntityId, will omit Permission."); await fileClient.RemoveAccessControlRecursiveAsync(PSPathAccessControlEntry.ParseRemoveAccessControls(this.Acl), continuationToken, GetAccessControlChangeOptions(taskId), CmdletCancellationToken).ConfigureAwait(false); SetProgressComplete(); WriteResult(taskId); } } }