Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent deletion of predefined folders #120

Open
WebDevM4DC opened this issue May 31, 2023 · 2 comments
Open

Prevent deletion of predefined folders #120

WebDevM4DC opened this issue May 31, 2023 · 2 comments

Comments

@WebDevM4DC
Copy link

Hello,

Thank you for this amazing library. Would it be possible to prevent users from deleting some "main" folders? For example,

uploads
  --> folder 1
  --> folder 2
  --> folder 2

From reading the documentation this would be possible using custom service; if this is correct, could you provide a small example?

@WebDevM4DC
Copy link
Author

Essentially ACLs are needed... who can upload, who cannot... when you have a basic user system with Symfony.

@WebDevM4DC
Copy link
Author

We managed to do ACLs using the following method:

  1. Inject user roles via CustomService (however your documentation is a bit wrong, it should be using TokenStorageInterface)
  2. Subscribe to events and check user roles

However, there are still some things lacking:

  1. You need to put a try/catch here
    public function uploadFileAction(Request $request): JsonResponse|Response {
    because otherwise the custom message is now shown. We also recommend renaming this even to PRE_FILE_UPLOAD for consistency.
  2. There is no event for creating folders; just plain POST so this cannot be restricted.
  3. Folders are not listed, only on the left navigation menu.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant