Skip to content

Commit 490815a

Browse files
Removing TeamInvitationQueryAccessSubscriber for AppGroup member edit/add (#1034)
1 parent 9a66fec commit 490815a

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

modules/apigee_edge_teams/apigee_edge_teams.services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ services:
117117

118118
apigee_edge_teams.team_invitation_query_access_subscriber:
119119
class: Drupal\apigee_edge_teams\EventSubscriber\TeamInvitationQueryAccessSubscriber
120-
arguments: ['@entity_type.manager']
120+
arguments: ['@apigee_edge.controller.organization', '@entity_type.manager']
121121
tags:
122122
- { name: event_subscriber }
123123

modules/apigee_edge_teams/src/EventSubscriber/TeamInvitationQueryAccessSubscriber.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace Drupal\apigee_edge_teams\EventSubscriber;
2222

23+
use Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface;
2324
use Drupal\Core\Entity\EntityTypeManagerInterface;
2425
use Drupal\entity\QueryAccess\QueryAccessEvent;
2526
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -29,6 +30,13 @@
2930
*/
3031
class TeamInvitationQueryAccessSubscriber implements EventSubscriberInterface {
3132

33+
/**
34+
* The organization controller service.
35+
*
36+
* @var \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface
37+
*/
38+
private $orgController;
39+
3240
/**
3341
* The entity type manager service.
3442
*
@@ -39,10 +47,13 @@ class TeamInvitationQueryAccessSubscriber implements EventSubscriberInterface {
3947
/**
4048
* TeamInvitationQueryAccessSubscriber constructor.
4149
*
50+
* @param \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface $org_controller
51+
* The organization controller service.
4252
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
4353
* The entity type manager service.
4454
*/
45-
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
55+
public function __construct(OrganizationControllerInterface $org_controller, EntityTypeManagerInterface $entity_type_manager) {
56+
$this->orgController = $org_controller;
4657
$this->entityTypeManager = $entity_type_manager;
4758
}
4859

@@ -62,6 +73,10 @@ public static function getSubscribedEvents() {
6273
* The event.
6374
*/
6475
public function onQueryAccess(QueryAccessEvent $event) {
76+
// AppGroup members information is stored in Database tables.
77+
if ($this->orgController->isOrganizationApigeeX()) {
78+
return;
79+
}
6580
// Add a condition to check for a valid team.
6681
// We query team from storage instead of check for a null team field because
6782
// the team might have been deleted on the remote server.

modules/apigee_edge_teams/tests/src/Functional/ApigeeX/TeamInvitationsTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,13 @@ public function testMultipleInvitations() {
159159
$this->teamB->decorated(),
160160
];
161161

162-
$inCache = FALSE;
163162
foreach ($teams as $team) {
164-
if (!$inCache) {
165-
$this->queueAppGroupResponse($team->decorated());
166-
}
163+
$this->queueAppGroupResponse($team->decorated());
167164
$this->drupalGet(Url::fromRoute('entity.team.add_members', [
168165
'team' => $team->id(),
169166
]));
170167

171168
$this->assertSession()->pageTextContains('Invite members');
172-
173-
$this->queueAppGroupsResponse($appgroups);
174-
$this->queueAppGroupsResponse($appgroups);
175-
$this->queueDevsInCompanyResponse([]);
176169
$this->submitForm([
177170
'developers' => $this->accountUser->getEmail(),
178171
], 'Invite members');
@@ -184,7 +177,6 @@ public function testMultipleInvitations() {
184177
]);
185178

186179
$this->assertSession()->pageTextContains($successMessage);
187-
$inCache = TRUE;
188180
}
189181
}
190182

0 commit comments

Comments
 (0)