Media library: Cannot add new 'media' unless 'view media' permission is enabled

Created on 26 June 2019, about 5 years ago
Updated 15 May 2024, 4 months ago

I succeeded in migrating my D7 files to D8 media entities and i'm testing the experimental media libray module. I think i found a bug, but i'm not sure.

The node setup:
Media reference field with reference to image

Form display for the given field:
Media Library

Permissions for the authtenticated user role:
Image: Create new media [yes]
Image: Edit own media [ yes]
Create media [yes]

Expected behavior:
Create the media (image) inline via the dialoge window and not showing the other images.

Expected action:
https://gph.is/g/ZWmGXNJ

What happened instead:
The openned dialoge shows the upload button, you can select the file, but there is no 'add' media button. You can see an ajax spinner for a second and nothing els happens when selecting the file.

What happens:
https://gph.is/g/aQNkJG2

The behaviour above changes when you select the permission:
View Media: [ yes ]

Then you can finish uploading and adding the givin image. But since the content of the given field is always unique(in my case), it has no sense in confusing people with giving them access to all the other media files.

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated 1 minute ago

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Does this bug still apply to the latest version of Drupal core?

    To me, this seems like quite an edge case - why allow creating and editing media without being able to view it?

    But since the content of the given field is always unique(in my case), it has no sense in confusing people with giving them access to all the other media files.

    Maybe media library isn't appropriate then?

    Postponing looking for a bit more information as to whether this should really be fixed in core.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Agree with @acbramley, the Media Library sounds like the wrong widget/field type here, it should just use a file field. Media is about reusing.

    And the described results seem inline with what the permission set dictates. Sure, they give confusing results for the end user, but I don't see how we would change the outcome short of trying to guess the intent based on a certain combination of permissions chosen. So "works as designed" I'd say.

Production build 0.71.5 2024