Problem/Motivation

The 'view media' permission is necessary to allow users to see the content of media fields. However it also grants access to the canonical media entity route, which on most sites doesn't really make sense for anonymous and/or authenticated users to be able to see.

It would be useful to split the permission somehow if we can, so that you can grant access to 'embedded' media but not the route itself.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

catch created an issue. See original summary.

maacl’s picture

I am also interested in this, but this has been discussed and closed in #3081741: Allow media to expose a standalone URL on a per-bundle basis as far I can tell.

catch’s picture

That's talking about moving the configuration around, not a permission.

maacl’s picture

Thanks for clarification! So when "Standalone media URL" is checked, we could generate the permissions "View @bundle Entities on own Page" in "MediaPermissions.php" and extend "MediaAccessControlHandler.php" to check those permissions, if a canonical route of a Media entity is visited? Or is there a better approach to this?

It would be useful to split the permission somehow if we can

This lets me think I do not see the full picture yet.

catch’s picture

@maacl I was thinking of deprecating the configuration and controlling access to the route purely by permissions.

Version: 10.0.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.