Skip to content
Snippets Groups Projects
Commit 0aa28234 authored by Nikolay Lobachev's avatar Nikolay Lobachev
Browse files

Issue #3293317 by LOBsTerr: Users cannot see the name of the Group that they were invited

parent 7388281e
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,12 @@
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\ginvite\Event\UserLoginWithInvitationEvent;
use Drupal\ginvite\Event\UserRegisteredFromInvitationEvent;
......@@ -466,3 +469,23 @@ function ginvite_user_login(UserInterface $user) {
$event_dispatcher->dispatch($event, UserLoginWithInvitationEvent::EVENT_NAME);
}
}
/**
* Implements hook_ENTITY_TYPE_access().
*/
function ginvite_group_access(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation == 'view' || $operation == 'view label') {
$properties = [
'entity_id' => $account->id(),
'gid' => $entity->id(),
'invitation_status' => GroupInvitation::INVITATION_PENDING,
];
$invitations = \Drupal::service('ginvite.invitation_loader')->loadByProperties($properties);
if (!empty($invitations)) {
return AccessResult::allowed();
}
}
return AccessResult::neutral();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment