|
|
|
|
@ -334,29 +334,4 @@ class AddMediaForm extends FormBase {
|
|
|
|
|
return AccessResult::forbidden(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Utility function to check if user can create 'Islandora' entity types. |
|
|
|
|
*/ |
|
|
|
|
protected function canCreateIslandoraEntity($entity_type, $bundle_type) { |
|
|
|
|
$bundles = $this->entityTypeManager->getStorage($bundle_type)->loadMultiple(); |
|
|
|
|
$access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type); |
|
|
|
|
|
|
|
|
|
$allowed = []; |
|
|
|
|
foreach (array_keys($bundles) as $bundle) { |
|
|
|
|
// Skip bundles that aren't 'Islandora' types. |
|
|
|
|
if (!$this->utils->isIslandoraType($entity_type, $bundle)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$access = $access_control_handler->createAccess($bundle, NULL, [], TRUE); |
|
|
|
|
if (!$access->isAllowed()) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|