There is currently only one permission that allows for replacing any files. In some cases, we want to only allow a user to use this feature if they are replacing their own file.

Thoughts? Mods?

Comments

johnsicili created an issue. See original summary.

casey’s picture

Status: Needs review » Needs work

Interesting, we would need a update path however.

kyilmaz80’s picture

Hello and thanks for adding this feature,

I tested the new patch on Drupal 10.2.5 and Php 8.2.7. The access logic did not worked as expected. The code below have to be changed:

$is_owner = (bool) $account->id() == $file->getOwnerId();

to

$is_owner = $account->id() == $file->getOwnerId();

bool cast have a problem i think. Overall the patch worked after that. I am also adding the revised patch (add_permission_for_own_files-r1-240429.patch).

Best regards,

-Koray

kyilmaz80’s picture

kyilmaz80’s picture

StatusFileSize
new786 bytes
kyilmaz80’s picture