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
1da9666b
Commit
1da9666b
authored
1 year ago
by
Nikolay Lobachev
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3301006
by LOBsTerr: Replace custom route access check with GroupInstalledContentAccessCheck
parent
11eeaf84
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ginvite.routing.yml
+2
-2
2 additions, 2 deletions
ginvite.routing.yml
src/Controller/InvitationOperations.php
+0
-23
0 additions, 23 deletions
src/Controller/InvitationOperations.php
with
2 additions
and
25 deletions
ginvite.routing.yml
+
2
−
2
View file @
1da9666b
...
...
@@ -4,7 +4,7 @@ ginvite.invitation.accept:
_controller
:
'
\Drupal\ginvite\Controller\InvitationOperations::accept'
_title
:
'
Accept
invitation
and
join
group'
requirements
:
_
custom_access
:
'
\Drupal\ginvite\Controller\InvitationOperations::checkAccess
'
_
group_installed_content
:
'
group_invitation
'
options
:
parameters
:
group_relationship
:
...
...
@@ -16,7 +16,7 @@ ginvite.invitation.decline:
_controller
:
'
\Drupal\ginvite\Controller\InvitationOperations::decline'
_title
:
'
Decline
invitation'
requirements
:
_
custom_access
:
'
\Drupal\ginvite\Controller\InvitationOperations::checkAccess
'
_
group_installed_content
:
'
group_invitation
'
options
:
parameters
:
group_relationship
:
...
...
This diff is collapsed.
Click to expand it.
src/Controller/InvitationOperations.php
+
0
−
23
View file @
1da9666b
...
...
@@ -163,29 +163,6 @@ class InvitationOperations extends ControllerBase {
return
$this
->
redirect
(
'user.page'
);
}
/**
* Checks if this current has access to update invitation.
*
* @param \Drupal\group\Entity\GroupRelationshipInterface $group_relationship
* Invitation entity.
*
* @return \Drupal\Core\Access\AccessResult
* Access check result.
*/
public
function
checkAccess
(
GroupRelationshipInterface
$group_relationship
)
{
$invited_user_id
=
$group_relationship
->
getEntityId
();
$group
=
$group_relationship
->
getGroup
();
$membership
=
$this
->
membershipLoader
->
load
(
$group
,
$this
->
currentUser
());
$current_state
=
$group_relationship
->
get
(
'invitation_status'
)
->
value
;
// Only allow user accept/decline own invitations.
if
(
$invited_user_id
==
$this
->
currentUser
()
->
id
()
&&
!
$membership
&&
(
int
)
$current_state
===
GroupInvitation
::
INVITATION_PENDING
)
{
return
AccessResult
::
allowed
();
}
return
AccessResult
::
forbidden
();
}
/**
* Renders title for the group invite member route.
*
...
...
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