How to extend FilePermissions?

Hi,

is there a way to extend the FilePermissions?

In my case i extended the PagePermissions and injected it through my custom model and register the model with the pageModel extension point. The Permissions prevent any updates of the page when the page is in listed state. Unfortunately the pages’ files are still updatable as the file permissions generally allow update.

So is there anything similar possible for Files?

Best, Thomas E.-E.

You could redefine files() in your page model and use a custom file class, see example here:

this working fine … almost. One thing left is, that the FilesSection seem to read it’s permissions directly from the users model and thus the refined permissions in CustomFilePermissions are not taken into account on the FilesSection level:

Whereas in the options popup the refined permissions are taken.

Do you mean the file view? Because what else is there in the section that doesn’t work as expected?

no the FilesSection.

As the FilePermissions return “canUpdate = true” i would expect the “Hinzufügen”-Button to disappear because canAdd() (FilesSesction.vue L11) should return false.

I guess you would have to fix the upload option in the files section’s PHP part in a custom files section.