-
-
Notifications
You must be signed in to change notification settings - Fork 98
fix: implement more fine grained permission checks #416
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
base: master
Are you sure you want to change the base?
Conversation
|
This PR would resolve the following bug as well: it's currently not possible to delete files when you're a moderator (even if you added the "Delete user uploads" permission, since there's a Is there anything that is holding back merging it? So far it looks good to me. |
|
Thanks @jaspervriends for bringing this up again. I'll try to make progress here next week |
… uploads is required
|
@imorland I've now made the changes as discussed and am happy with them at the moment, namely:
Do you have time to review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This right here is more of a POC of how we can handle cases where other permissions are prerequisites for another permission, similiar like Tags does it for example (permission to create discussion in a tag can only be granted to a new group when the viewForum permissions has that group already.
Open for feedback if this should be extended to cover more cases in fof/upload or if I should abandon this. See https://github.com/flarum/framework/blob/097b3c5baa025b46b1fe96a3191ce25fb9a062e7/extensions/tags/js/src/admin/addTagsPermissionScope.tsx#L34-L46 for a similar implementation in the framework
Fixes #393
Changes proposed in this pull request:
Reviewers should focus on:
No security vulnerabilities are introduced in
DeleteFileHandler&FilePolicy. Here is the intended migration logic:If a group had
fof-upload.deleteUserUploads(previously meaning meaning “delete others”):fof-upload.deleteOtherUsersUploadsfof-upload.hideOtherUsersUploadsIf a group had
fof-upload.upload-shared-files:fof-upload.deleteSharedUploadsfof-upload.hideSharedUploadsTo allow that users can hide their own files by default, I've added a separate migration (2025_11_07_000000_grant_hide_own_to_members.php) which grants members this permission
Screenshot
Before and after the permission migration:
Before:

After:

Confirmed
composer test).Required changes: