Skip to content

Commit

Permalink
Apigee X tests for team, team membership level and admin permissions,…
Browse files Browse the repository at this point in the history
… team roles (#1045)
  • Loading branch information
shishir-intelli authored Feb 27, 2024
1 parent d3f04aa commit 0f0e59a
Show file tree
Hide file tree
Showing 3 changed files with 729 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ protected function buildInfoRow(AppInterface $app, array &$rows) {
/** @var \Drupal\apigee_edge_teams\Entity\TeamInterface[] $teams */
$teams = $this->entityTypeManager->getStorage('team')->loadMultiple();
$css_id = $this->getCssIdForInfoRow($app);
$rows[$css_id]['data']['team']['data'] = $teams[$app->getCompanyName()]->access('view') ? $teams[$app->getCompanyName()]->toLink()->toRenderable() : $teams[$app->getCompanyName()]->label();
$team_name = $app->isApigeeX() ? $app->getAppGroup() : $app->getCompanyName();
$rows[$css_id]['data']['team']['data'] = $teams[$team_name]->access('view') ? $teams[$team_name]->toLink()->toRenderable() : $teams[$team_name]->label();
parent::buildInfoRow($app, $rows);
}

Expand Down
13 changes: 12 additions & 1 deletion modules/apigee_edge_teams/src/Entity/TeamApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
#[\AllowDynamicProperties]
class TeamApp extends App implements TeamAppInterface {

/**
* True if organization is Apigee X.
*
* @var bool
*/
public static $apigeex = FALSE;

/**
* The decorated company app entity from the SDK.
*
Expand Down Expand Up @@ -156,7 +163,11 @@ public function getAppGroup(): ?string {
*/
public static function isApigeeX(): bool {
$orgController = \Drupal::service('apigee_edge.controller.organization');
return $orgController->isOrganizationApigeeX();
if ($orgController->isOrganizationApigeeX()) {
TeamApp::$apigeex = $orgController->isOrganizationApigeeX();
}

return TeamApp::$apigeex;
}

/**
Expand Down
Loading

0 comments on commit 0f0e59a

Please sign in to comment.