Problem/Motivation

Trying to add Media to a new Paragraph in an existing node (User cannot create a new node of content type). It appears that the entity_id of the paragraph being empty causes the module to fallback to an access check for the node but while users can update the content type, they cannot create new ones, and the check fails.
Message: Error message
Oops, something went wrong. Check your browser's developer console for more details.
Console: POST https://site/media-library?ajax_form=1&_wrapper_format=…m4lhVVo2v3bHQD35-nYJdo&views_display_id=widget&_wrapper_format=drupal_ajax 403 (Forbidden)
Uncaught
Drupal.AjaxError {message: '\nAn AJAX HTTP error occurred.\nHTTP Result Code: 40…et\nStatusText: error\nResponseText: {"message":""}', name: 'AjaxError', stack: undefined}
message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 403\nDebugging information follows.\nPath: /media-library?ajax_form=1&_wrapper_format=drupal_ajax&media_library_opener_id=media_library.opener.field_widget&media_library_allowed_types%5Bimage%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfield_widget_id%5D=field_image%3A-field_profiles_factoids-0-subform-field_media_cards-0-subform&media_library_opener_parameters%5Bentity_type_id%5D=paragraph&media_library_opener_parameters%5Bbundle%5D=media_card&media_library_opener_parameters%5Bfield_name%5D=field_image&media_library_opener_parameters%5Breplace_checkbox_by_order_indicator%5D=0&media_library_opener_parameters%5Bmulti_edit_on_create%5D=0&media_library_opener_parameters%5Bno_edit_on_create%5D=0&media_library_opener_parameters%5Bcheck_selected%5D=0&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_finder_plugin_id%5D=group_by_subgroup&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_type_id%5D=academic_branch&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_uuid%5D=516f16ff-5ff3-4d93-b72b-1b6873ba8a9f&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_id%5D=425&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_relation_plugin_id%5D=group_node%3Aacademic_program&media_library_opener_parameters%5Bgroup_parameters%5D%5Bgroup_media_relation_plugin_id%5D=group_media%3Aimage&hash=_NXv80TMrFWeDkBp3dtv9m4lhVVo2v3bHQD35-nYJdo&views_display_id=widget\nStatusText: error\nResponseText: {\"message\":\"\"}"

Steps to reproduce

Prevent user from creating content type. Edit existing node of type. Add new paragraph which contains media field, add media.

Proposed resolution

Capture the existing root form entity. In a paragraph, pass the root entity's type/ID as group_host_entity_type_id and group_host_entity_id then check Update access on the existing host entity.

Attached patch works for me.

Comments

naidim created an issue.