Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
ginvite
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ginvite
Commits
0aa28234
Commit
0aa28234
authored
1 year ago
by
Nikolay Lobachev
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ginvite.module
+23
-0
23 additions, 0 deletions
ginvite.module
with
23 additions
and
0 deletions
ginvite.module
+
23
−
0
View file @
0aa28234
...
...
@@ -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
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment