question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE REQ] Consider a method for moving files that change ACL to match default values of parent directory

See original GitHub issue

Library or service name. Azure.Storage.Files.DataLake

I would like to move a file between directories or file systems that automatically sets ACL to that of the values specified by the default ACL of the destination.

Current options seem to be:

  1. Use DataLakeFileClient.RenameAsync then use DataLakeDirectoryClient.GetAccessControlAsync to get parent’s ACL then use DataLakeFileClient.SetAccessControlListAsync

  2. Download file to MemoryStream using DataLakeFileClient.ReadAsync then upload to a new file using DataLakeFileClient.AppendAsync.

Option 1 requires heightened permissions than option 2 and option 2 is less efficient than option 1.

Better options may be:

  1. Create a DataLakeFileClient.MoveAsync (or DataLakeFileSystemClient.MoveAysnc) method that works similarly to RenameAsync but sets ACL to those of the parent’s default ACL (and change owner and group would occur if new file was created), similarly to if a new file was created

  2. Add a parameter to DataLakeFileClient.RenameAsync that allows the resetting of the file’s ACL

  3. Follow Microsoft.Azure.Storage.Blob v11 lead with a StartCopy method.

Pointing out obvious errors in my reasoning is welcomed. Thanks for your consideration and thank you for this great library.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
amnguyecommented, Sep 4, 2020

Hi,

Let me know if I’m incorrect in what you’re saying. Is your ask is to create a convenience method that calls the following methods in these steps.

  1. Calls Rename on the DataLake file
  2. Call GetAccessControlList on the destination folder holding the DataLake FIle
  3. Calls SetAccessControlList on the newly renamed DataLake File (Which means that this method would make three calls to storage)

As for the StartCopy suggestion, I don’t think that would resolve your request, as you would most likely would have to call Delete on the source blob afterwards. You would also have to create the destination blob. Also since StartCopy is a blob API and not a datalake API, I don’t think it would be wise to call StartCopy on a DataLake File. (Also this would take a total of 2 calls instead of 1).

I’m not sure if this is a convenience method we want to support (also naming it Move doesn’t seem to encompass what the method would do). If there’s more of ask for a convenience method like this, I will reopen this issue/feature request.

Thanks for your input! Please let us know if you have any other suggestions or issues.

1reaction
msftbot[bot]commented, Jun 4, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @sumantmehtams.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am using the Files.move function to move a file, but it does ...
I expect that the file I am moving to a new directory will inherit the ACL permissions that have been set for that...
Read more >
Make all new files in a directory accessible to a group
Set default acls of user and group to rwx as well. This defines permissions that files and directories inherit from foo . So...
Read more >
ACL permissions required to work on files and directories
ACL Operation ACL Permission ACL Permission ACL Permission ACL Pe... Traverse folder / execute file List folder / read data Read attribute Read e... Execute...
Read more >
POSIX Access Control Lists on Linux
This paper discusses file system Access Control Lists as implemented in ... If the parent directory has no default ACL, the permissions of...
Read more >
Permission Propagation: Info and Tips
Permission propagation is when you set permissions – also called Access Control Lists (ACL) – on a folder or a drive, and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found