fix: implement more fine grained permission checks#416
fix: implement more fine grained permission checks#416DavideIadeluca wants to merge 15 commits into1.xfrom
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.
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
|
As a user of Flaurum who has the issue described by imorland, I would be happy to test any fix you may have. |
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: