Merge branch 'master' into trav

This commit is contained in:
Naomi 2021-09-17 15:27:04 +02:00
commit a0e4b4028f
5 changed files with 16 additions and 4 deletions

View File

@ -3,6 +3,12 @@
display: none;
}
/* MOVE THIS INTO GNO! */
#block-accreditationcount {
position: absolute;
right: 50%;
}
/* */
body {

View File

@ -40,6 +40,9 @@ view published case entities:
view unpublished case entities:
title: 'View unpublished Case entities'
view unpublished actor entities:
title: 'View unpublished Actor entities'
view all case revisions:
title: 'View all Case revisions'

View File

@ -58,7 +58,11 @@ class OCActorForm extends ContentEntityForm {
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $entity->id()]);
// If you have unpublished the entity and you can't see unpublished entities, redirect to a more informative message than just "Access Denied".
if (!$form_state->getValue('status')['value'] && !\Drupal::currentUser()->hasPermission('view unpublished actor entities')) {
$form_state->setRedirect('entity.node.canonical', ['node' => 1]);
} else {
$form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $entity->id()]);
}
}
}

View File

@ -32,7 +32,7 @@ class OCActorAccessControlHandler extends EntityAccessControlHandler {
case 'view':
if (!$entity->isPublished()) {
return AccessResult::allowedIf(
$account->hasPermission("view unpublished $bundle entities")
$account->hasPermission("view unpublished actor entities")
);
}
return AccessResult::allowedIf(

View File

@ -135,7 +135,6 @@ function opencase_entity_field_access($operation, \Drupal\Core\Field\FieldDefini
function opencase_form_alter(&$form, &$form_state, $form_id) {
if (preg_match('/oc_organisation_relation_.*_delete_form/', $form_id) or (preg_match('/oc_organisation_relation_.*_add_form/', $form_id))) {
$form['actions']['submit']['#submit'][] = '_opencase_organisation_relation_redirect';
// $form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
}
}