Skip to content

Commit

Permalink
Previous code allowed for the possibility that there was not a group …
Browse files Browse the repository at this point in the history
…context.
  • Loading branch information
ekes committed Apr 23, 2024
1 parent 38e9043 commit e6146f1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ function localgov_microsites_media_node_create_access(AccountInterface $account,

// Allow group users to add media items to new nodes.
$group = localgov_microsites_group_get_by_context();
$permission = 'create group_node:' . $entity_bundle . ' entity';
return GroupAccessResult::allowedIfHasGroupPermissions($group, $account, [$permission], 'AND');
if ($group) {
$permission = 'create group_node:' . $entity_bundle . ' entity';
return GroupAccessResult::allowedIfHasGroupPermissions($group, $account, [$permission], 'AND');
}

}

0 comments on commit e6146f1

Please sign in to comment.