- πΊπΈUnited States jalite1991
Can confirm this is still an issue. The taxonomy terms do not get filtered when trying to add media through the "Media Library add form upload" component and the media types are associated with the workbench schemes.
- πΊπΈUnited States jonraedeke
It seems like a bug if a user can assign new media to a section they don't have access to.
- πΊπΈUnited States aarontocenter
I can concur with @jonraedeke that this is a bug, @agentrickard can you change this request from Feature, to bug.
Recently have a client that needs users to be able to upload to directories they are part of as a "group" associated by the "area" of ownership.
Because of this taxonomy issue, they are able to upload files, to areas they themselves have no access too, and the only way to give them access, is to open up areas they should be restricted from.
- πΊπΈUnited States bkosborne New Jersey, USA
Confirmed this is an issue as well.
The form_alters that Workbench Access performs assume that the form a property entity form:
function workbench_access_form_alter(&$form, FormStateInterface $form_state) { $form_object = $form_state->getFormObject(); if (!$form_object instanceof EntityForm) { return; } $entity = $form_object->getEntity(); if (!$entity instanceof ContentEntityInterface) { return; } \Drupal::classResolver()->getInstanceFromDefinition(FormAlterHelper::class)->alterForm($form, $form, $form_state, $entity); }
But the form that the Media Library module uses is actually a custom form called
Drupal\media_library\Form\FileUploadForm
. That form embeds an entity form within it, but doing so does not invoke form alter hooks for the entity form.I think Workbench Access needs to add some special handling for these media library forms. I'll add a merge request.
- Merge request !23Ensure AccessControlHierarchy plugins act on media add forms from the media library widget. β (Open) created by bkosborne
- πΊπΈUnited States bkosborne New Jersey, USA
Okay, this will need tests obviously, but I think this approach could work. I'm a little uncertain on if I should be passing the complete form in or not as the second argument to FormAlterHelper::alterForm. But in my brief testing this works.