Edit button should check permissions for every media instead of only the first one in multi-value-fields

Created on 27 January 2024, 5 months ago
Updated 29 January 2024, 5 months ago

Problem/Motivation

In OpenCulturas we use Media Library Edit to allow users to add media to a gallery (multi-value media reference field). We allow users to select assets from the media browser with creative commons licenses, so that it is possible to select assets that are not authored by the user and therefor can not be edited.

We noticed that the edit-button appears based on the edit permissions valid for only for the first media asset. If the first asset is not one authored by the user, the edit button does not show up for all the following assets. Whereas if the first asset is authored by the user, all assets show the button. However, clicking the edit button throws an error when you do not have the permission to edit the asset.

Steps to reproduce

1. add a media reference field with unlimited number of values and enable the edit button in the form widget
2. allow users to see anyone's assets in media library
3. add assets from the library with an "underprivileged" user
a) first one asset that belongs to the user and then add an asset authored by a different user -> edit button appears on both assets
b) first one asset authored by a different user and then add an own asset -> edit button does not appear on both assets.

Bonus fun fact: fumble with deleting and re-adding assets and watch the button (dis)appear.

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇩🇪Germany moritz.steinhauer Göttingen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024