Skip to content

Commit ea6a45f

Browse files
shishir-intellidivya-intelligiteshkmxr576VladimirAus
authored
Merging AppGroup changes into 2.x branch (#869)
* Checking if the organisation is ApigeeX for AppGroup (#803) * Fix organisation exception (#806) * Changes for Appgroup listing/view/edit/delete page (#805) * Changes for Appgroup listing/view/edit/delete page * Update composer.json * Update composer.json * AppGroup-App implementation for list, view, edit, delete apps (#813) * Merge 2.x into appgroup (#829) * Warrant that queues executed by cron (#808) * Sort API Product listings on App (#812) * Update endpoints to use constants from ClientInterface (#810) * Sort API products on app forms by API product display name (#815) * Sort API Products (#818) * Sort API Products TypeError: array_map(): Argument #2 ($array) must be of type array * Removed test case * App creation fails without API Products (#809) * App creation fails without API Products caused by features.keymanagement.disable.unbounded.permissions flag * Update minimum version of apigee-client-php * Make sure that cron runner starts executing the job (#814) * Checking if the organisation is ApigeeX for AppGroup (#803) * Fix organisation exception (#806) * Changes for Appgroup listing/view/edit/delete page (#805) * Changes for Appgroup listing/view/edit/delete page * Update composer.json * Update composer.json * AppGroup-App implementation for list, view, edit, delete apps (#813) --------- Co-authored-by: Dezső BICZÓ <[email protected]> Co-authored-by: Shishir <[email protected]> Co-authored-by: phdhiren <[email protected]> Co-authored-by: Divyajose <[email protected]> * Support for Add AppGroup/team and update team App credentials with ApiProduct (#824) * Support for AppGroup membership (#825) * The Apigee Edge and X Teams module requirements (#826) * Checking ApigeeX org from OrganizationController and removed from SDKController (#832) * If team not available on Apigee avoid null value exception (#833) * Added admin config setting for Team prefix and channelID (#839) * Implemented AppGroup membership feature for ApigeeX (#843) * Merge 2.x into appgroup branch (#859) * Warrant that queues executed by cron (#808) * Sort API Product listings on App (#812) * Update endpoints to use constants from ClientInterface (#810) * Sort API products on app forms by API product display name (#815) * Sort API Products (#818) * Sort API Products TypeError: array_map(): Argument #2 ($array) must be of type array * Removed test case * App creation fails without API Products (#809) * App creation fails without API Products caused by features.keymanagement.disable.unbounded.permissions flag * Update minimum version of apigee-client-php * Make sure that cron runner starts executing the job (#814) * Update the storage defination of App entity (#831) * Fix issue which removes users from all team (#840) * Drop PHP 7 support again (#816) * Revert "Support for PHP 7.4 (#800)" This reverts commit b71f8a9. * Clearly specify the currently supported PHP versions * Update outdated info.yml * Added accessCheck on entity queries (#842) * added accessCheck on entity queries Co-authored-by: Vladimir Roudakov <[email protected]> * added comment --------- Co-authored-by: Vladimir Roudakov <[email protected]> * Fix for jQuery.once() is deprecated in Drupal 9.3 (#851) Co-authored-by: Vladimir Roudakov <[email protected]> * fix for phpcs failing in github action (#858) * PHPCS FIX --------- Co-authored-by: Shishir <[email protected]> Co-authored-by: Dezső BICZÓ <[email protected]> Co-authored-by: Gitesh Koli <[email protected]> Co-authored-by: Divyajose <[email protected]> Co-authored-by: Vladimir Roudakov <[email protected]> * Implemented AppGroup Team Membership Sync (#853) * Get AppGroup team members from DB (#864) * Get AppGroup team members from DB and fix recurring teams api call * Declaring abstract method * Fix action module getTeam method argument * Fix for team sync issue when DB is empty * Added team member sync note for ApigeeX (#867) --------- Co-authored-by: Shishir <[email protected]> Co-authored-by: Divyajose <[email protected]> Co-authored-by: Gitesh Koli <[email protected]> Co-authored-by: Dezső BICZÓ <[email protected]> Co-authored-by: Vladimir Roudakov <[email protected]>
1 parent 386c83f commit ea6a45f

File tree

52 files changed

+1628
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1628
-104
lines changed

modules/apigee_edge_actions/src/TeamMembershipManager.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,15 @@ public function removeMembers(string $team, array $developers): void {
151151
/**
152152
* {@inheritdoc}
153153
*/
154-
public function getTeams(string $developer): array {
155-
return $this->inner->getTeams($developer);
154+
public function getTeams(string $developer, string $team = NULL): array {
155+
return $this->inner->getTeams($developer, $team);
156+
}
157+
158+
/**
159+
* {@inheritdoc}
160+
*/
161+
public function syncAppGroupMembers(string $team): array {
162+
return $this->inner->syncAppGroupMembers($team);
156163
}
157164

158165
/**

modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityAddMemberEventTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ protected function setUp(): void {
5454
parent::setUp();
5555

5656
$this->installEntitySchema('team_member_role');
57+
58+
$this->addOrganizationMatchedResponse();
5759
}
5860

5961
/**

modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityRemoveMemberEventTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ protected function setUp(): void {
5353
parent::setUp();
5454

5555
$this->installEntitySchema('team_member_role');
56+
57+
$this->addOrganizationMatchedResponse();
5658
}
5759

5860
/**

modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityUpdateEventTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public function testEvent() {
5555
]);
5656
$config_entity->save();
5757

58+
// Add matched organization response so it returns the org whenever called.
59+
$this->addOrganizationMatchedResponse();
60+
5861
// Insert and update entity.
5962
/** @var \Drupal\apigee_edge\Entity\DeveloperAppInterface $entity */
6063
$entity = $this->createDeveloperApp();

modules/apigee_edge_teams/apigee_edge_teams.install

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use Drupal\user\RoleInterface;
2525
use Drupal\views\Views;
2626

2727
/**
28-
* Install, update and uninstall functions for Apigee Edge Teams.
28+
* Install, update and uninstall functions for Apigee Edge and ApigeeX Teams.
2929
*/
3030

3131
/**
@@ -41,13 +41,13 @@ function apigee_edge_teams_requirements($phase) {
4141
$org_controller = \Drupal::service('apigee_edge.controller.organization');
4242
/* @var \Apigee\Edge\Api\Management\Entity\Organization $organization */
4343
$organization = $org_controller->load($sdk_connector->getOrganization());
44-
if ($organization && !OrganizationFeatures::isCompaniesFeatureAvailable($organization)) {
44+
if ($organization && !OrganizationFeatures::isCompaniesFeatureAvailable($organization) && OrganizationFeatures::isMonetizationEnabled($organization)) {
4545
$url = [
4646
':url' => 'https://cloud.google.com/apigee/docs/api-platform/get-started/compare-apigee-products#unsupported-apis',
4747
];
4848
$message = ($phase == 'runtime') ?
49-
t("The Apigee Edge Teams module functionality is not available for your org and should be uninstalled, because <a href=':url' target='_blank'>Edge company APIs are not supported in Apigee X and Apigee Hybrid orgs</a>.", $url) :
50-
t("The Apigee Edge Teams module functionality is not available for your org because <a href=':url' target='_blank'>Edge company APIs are not supported in Apigee X and Apigee Hybrid orgs</a>.", $url);
49+
t("The Teams module functionality is not available for monetization enabled org on Apigee X / Hybrid and should be uninstalled, because <a href=':url' target='_blank'>AppGroup APIs are not supported in Apigee X / Hybrid orgs with monetization enabled</a>.", $url) :
50+
t("The Teams module functionality is not available for monetization enabled org on Apigee X / Hybrid because <a href=':url' target='_blank'>AppGroup APIs are not supported in Apigee X / Hybrid orgs with monetization enabled</a>.", $url);
5151
$requirements['apigee_edge_teams_not_supported'] = [
5252
'title' => t('Apigee Edge Teams'),
5353
'description' => $message,

modules/apigee_edge_teams/apigee_edge_teams.links.task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apigee_edge_teams.settings.team:
22
route_name: apigee_edge_teams.settings.team
3-
title: 'Alias'
3+
title: 'Settings'
44
base_route: apigee_edge_teams.settings.team
55
weight: -10
66

modules/apigee_edge_teams/apigee_edge_teams.services.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ services:
2424
class: Drupal\apigee_edge_teams\CompanyMembershipObjectCache
2525
arguments: ['@cache_factory', '@apigee_edge.cache.memory_cache_factory', '@config.factory', '@datetime.time']
2626

27+
apigee_edge_teams.cache.appgroup_membership_object:
28+
class: Drupal\apigee_edge_teams\AppGroupMembershipObjectCache
29+
arguments: ['@cache_factory', '@apigee_edge.cache.memory_cache_factory', '@config.factory', '@datetime.time']
30+
31+
apigee_edge.controller.cache.appgroup_teams:
32+
class: Drupal\apigee_edge_teams\AppGroupCache
33+
arguments: ['@apigee_edge.cache.memory_cache_factory']
34+
2735
apigee_edge_teams.controller.team:
2836
class: Drupal\apigee_edge_teams\Entity\Controller\TeamController
2937
arguments: ['@apigee_edge.sdk_connector', '@apigee_edge.controller.organization', '@apigee_edge_teams.controller.cache.team', '@apigee_edge_teams.controller.cache.team_ids', '@apigee_edge.entity.controller.cache.app_cache_by_owner_factory', '@apigee_edge.entity.controller.cache.app_name_cache_by_owner_factory', '@apigee_edge_teams.cache.company_membership_object', '@apigee_edge.controller.cache.developer_companies']
@@ -40,6 +48,10 @@ services:
4048
class: Drupal\apigee_edge_teams\CompanyMembersControllerFactory
4149
arguments: ['@apigee_edge.sdk_connector', '@apigee_edge_teams.cache.company_membership_object']
4250

51+
apigee_edge_teams.appgroup_members_controller_factory:
52+
class: Drupal\apigee_edge_teams\AppGroupMembersControllerFactory
53+
arguments: ['@apigee_edge.sdk_connector', '@apigee_edge_teams.cache.appgroup_membership_object']
54+
4355
apigee_edge_teams.controller.cache.team:
4456
class: Drupal\apigee_edge\Entity\Controller\Cache\EntityCache
4557
arguments: ['@apigee_edge_teams.cache.memory_cache_factory', '@apigee_edge_teams.controller.cache.team_ids', team]
@@ -49,7 +61,7 @@ services:
4961

5062
apigee_edge_teams.team_membership_manager:
5163
class: Drupal\apigee_edge_teams\TeamMembershipManager
52-
arguments: [ '@entity_type.manager', '@apigee_edge_teams.company_members_controller_factory', '@apigee_edge.controller.developer', '@apigee_edge.controller.cache.developer_companies', '@cache_tags.invalidator', '@logger.channel.apigee_edge_teams']
64+
arguments: [ '@entity_type.manager', '@apigee_edge_teams.company_members_controller_factory','@apigee_edge_teams.appgroup_members_controller_factory', '@apigee_edge.controller.developer', '@apigee_edge.controller.cache.developer_companies', '@cache_tags.invalidator', '@logger.channel.apigee_edge_teams', '@apigee_edge.controller.organization']
5365

5466
apigee_edge_teams.team_permissions:
5567
class: Drupal\apigee_edge_teams\TeamPermissionHandler
@@ -85,7 +97,7 @@ services:
8597

8698
apigee_edge_teams.event_subscriber.team_invitation_event_subscriber:
8799
class: Drupal\apigee_edge_teams\EventSubscriber\TeamInvitationSubscriber
88-
arguments: ['@logger.channel.apigee_edge_teams', '@entity_type.manager', '@apigee_edge_teams.team_membership_manager', '@apigee_edge_teams.team_invitation_notifier.email']
100+
arguments: ['@logger.channel.apigee_edge_teams', '@entity_type.manager', '@apigee_edge_teams.team_membership_manager', '@apigee_edge_teams.team_invitation_notifier.email', '@apigee_edge.controller.organization']
89101
tags:
90102
- { name: event_subscriber }
91103

modules/apigee_edge_teams/config/install/apigee_edge_teams.team_settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
langcode: en
2+
team_prefix: ''
3+
channelid: ''
24
entity_label_singular: ''
35
entity_label_plural: ''
46
cache_expiration: 900

modules/apigee_edge_teams/config/schema/apigee_edge_teams.schema.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ apigee_edge_teams.team_settings:
22
type: config_object
33
label: 'Team settings'
44
mapping:
5+
team_prefix:
6+
type: label
7+
label: 'Prefix to add for the Team name'
8+
channelid:
9+
type: label
10+
label: 'ChannelId settings'
511
entity_label_singular:
612
type: label
713
label: 'How to refer to a Team on the UI (singular)'

modules/apigee_edge_teams/src/Access/ManageTeamMembersAccess.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ public function access(RouteMatchInterface $route_match, AccountInterface $accou
8686
// If the developer parameter is available in the route make sure it is
8787
// member of the team.
8888
if ($developer !== NULL) {
89-
if (!in_array($team->id(), $this->teamMembershipManager->getTeams($developer->getEmail()))) {
89+
// Argument #2 in getTeams() is required for checking the AppGroup members and not required for Edge.
90+
if (!in_array($team->id(), $this->teamMembershipManager->getTeams($developer->getEmail(), $team->id()))) {
9091
return AccessResultForbidden::forbidden("The {$developer->getEmail()} developer is not member of the {$team->id()} team.");
9192
}
9293
}

0 commit comments

Comments
 (0)