Skip to content

Commit 5eb0f8c

Browse files
authored
Merge branch '3.x' into vpa24-acceptance-link-problem-with-mixed-case-email-addresss
2 parents 51a9b1b + 0f0e59a commit 5eb0f8c

File tree

9 files changed

+755
-22
lines changed

9 files changed

+755
-22
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"require": {
77
"php": "~8.1.0 || ~8.2.0",
88
"ext-json": "*",
9-
"apigee/apigee-client-php": "~3.0.4",
9+
"apigee/apigee-client-php": "~3.0.5",
1010
"drupal/core": "^10.1",
1111
"drupal/entity": "^1.0",
1212
"drupal/key": "^1.8",

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/Entity/Form/TeamForm.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@ public function save(array $form, FormStateInterface $form_state) {
267267

268268
if ($was_new) {
269269
try {
270-
if ($this->orgController->isOrganizationApigeeX()) {
271-
// For ApigeeX adding the member as admin.
272-
$this->teamMembershipManager->addMembers($team->id(), [
273-
$this->currentUser->getEmail() => ['admin']
274-
]);
275-
}
276-
else {
270+
if (!$this->orgController->isOrganizationApigeeX()) {
277271
$this->teamMembershipManager->addMembers($team->id(), [
278272
$this->currentUser->getEmail()
279273
]);
@@ -312,6 +306,12 @@ public function save(array $form, FormStateInterface $form_state) {
312306
}
313307

314308
}
309+
$options = [];
310+
$query = $this->getRequest()->query;
311+
if ($query->has('destination')) {
312+
$options['query']['destination'] = $query->get('destination');
313+
$query->remove('destination');
314+
}
315315
// Redirecting user to team view page to manage the team members and apps.
316316
$form_state->setRedirectUrl($team->toUrl('canonical'));
317317

modules/apigee_edge_teams/src/Entity/ListBuilder/TeamAppListBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected function buildInfoRow(AppInterface $app, array &$rows) {
5151
/** @var \Drupal\apigee_edge_teams\Entity\TeamInterface[] $teams */
5252
$teams = $this->entityTypeManager->getStorage('team')->loadMultiple();
5353
$css_id = $this->getCssIdForInfoRow($app);
54-
$rows[$css_id]['data']['team']['data'] = $teams[$app->getCompanyName()]->access('view') ? $teams[$app->getCompanyName()]->toLink()->toRenderable() : $teams[$app->getCompanyName()]->label();
54+
$team_name = $app->isApigeeX() ? $app->getAppGroup() : $app->getCompanyName();
55+
$rows[$css_id]['data']['team']['data'] = $teams[$team_name]->access('view') ? $teams[$team_name]->toLink()->toRenderable() : $teams[$team_name]->label();
5556
parent::buildInfoRow($app, $rows);
5657
}
5758

modules/apigee_edge_teams/src/Entity/TeamApp.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
#[\AllowDynamicProperties]
8787
class TeamApp extends App implements TeamAppInterface {
8888

89+
/**
90+
* True if organization is Apigee X.
91+
*
92+
* @var bool
93+
*/
94+
public static $apigeex = FALSE;
95+
8996
/**
9097
* The decorated company app entity from the SDK.
9198
*
@@ -156,7 +163,11 @@ public function getAppGroup(): ?string {
156163
*/
157164
public static function isApigeeX(): bool {
158165
$orgController = \Drupal::service('apigee_edge.controller.organization');
159-
return $orgController->isOrganizationApigeeX();
166+
if ($orgController->isOrganizationApigeeX()) {
167+
TeamApp::$apigeex = $orgController->isOrganizationApigeeX();
168+
}
169+
170+
return TeamApp::$apigeex;
160171
}
161172

162173
/**

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.

0 commit comments

Comments
 (0)