From 424d17e1a846ca2f5a88f943e6c522e3f8aec4f8 Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Fri, 17 Jan 2025 12:47:05 +0530 Subject: [PATCH] Moving 3x fixes to 4x branch (#1110) --- .../apigee_edge_apiproduct_rbac.module | 4 ++-- .../apigee_edge_teams/src/Controller/TeamMembersList.php | 2 +- .../src/Entity/ListBuilder/TeamAppListByTeam.php | 2 +- .../src/Entity/Storage/TeamMemberRoleStorage.php | 2 +- modules/apigee_edge_teams/tests/src/Functional/UiTest.php | 6 ++++-- src/Entity/ListBuilder/AppListBuilder.php | 2 +- .../ListBuilder/DeveloperAppListBuilderForDeveloper.php | 2 +- src/Plugin/ApigeeFieldStorageFormat/CSV.php | 1 + src/Plugin/ApigeeFieldStorageFormat/JSON.php | 1 + 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/apigee_edge_apiproduct_rbac/apigee_edge_apiproduct_rbac.module b/modules/apigee_edge_apiproduct_rbac/apigee_edge_apiproduct_rbac.module index 7896c0e51..4918d1e41 100644 --- a/modules/apigee_edge_apiproduct_rbac/apigee_edge_apiproduct_rbac.module +++ b/modules/apigee_edge_apiproduct_rbac/apigee_edge_apiproduct_rbac.module @@ -67,7 +67,7 @@ function apigee_edge_apiproduct_rbac_api_product_access(EntityInterface $entity, if (empty($entity->getAttributeValue($rbac_attribute_name))) { if ('assign' === $operation) { - $result = AccessResult::neutral("{$operation} is not allowed on {$entity->label()} API product."); + $result = AccessResult::forbidden("{$operation} is not allowed on {$entity->label()} API product."); } elseif ($config->get('grant_access_if_attribute_missing')) { $result = AccessResult::allowed(); @@ -94,7 +94,7 @@ function apigee_edge_apiproduct_rbac_api_product_access(EntityInterface $entity, // Displaying these products should be solved on the form level always. if (empty(array_intersect($roles, $account->getRoles()))) { if ('assign' === $operation) { - $result = AccessResult::neutral("{$operation} is not allowed on {$entity->label()} API product."); + $result = AccessResult::forbidden("{$operation} is not allowed on {$entity->label()} API product."); } else { $result = _apigee_edge_user_has_an_app_with_product($entity->id(), $account, TRUE); diff --git a/modules/apigee_edge_teams/src/Controller/TeamMembersList.php b/modules/apigee_edge_teams/src/Controller/TeamMembersList.php index e3ee1e810..02516ce3a 100644 --- a/modules/apigee_edge_teams/src/Controller/TeamMembersList.php +++ b/modules/apigee_edge_teams/src/Controller/TeamMembersList.php @@ -99,7 +99,7 @@ class TeamMembersList extends ControllerBase { * @param \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface $org_controller * The organization controller service. */ - public function __construct(TeamMembershipManagerInterface $team_membership_manager, EntityTypeManagerInterface $entity_type_manager, ?ModuleHandlerInterface $module_handler = NULL, CompanyMembershipObjectCacheInterface $company_membership_object_cache, AppGroupMembershipObjectCacheInterface $appgroup_membership_object_cache, OrganizationControllerInterface $org_controller) { + public function __construct(TeamMembershipManagerInterface $team_membership_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, CompanyMembershipObjectCacheInterface $company_membership_object_cache, AppGroupMembershipObjectCacheInterface $appgroup_membership_object_cache, OrganizationControllerInterface $org_controller) { if (!$module_handler) { @trigger_error('Calling ' . __METHOD__ . ' without the $module_handler is deprecated in apigee_edge:8-x-1.19 and is required before apigee_edge:8.x-2.0. See https://github.com/apigee/apigee-edge-drupal/pull/518.', E_USER_DEPRECATED); $module_handler = \Drupal::moduleHandler(); diff --git a/modules/apigee_edge_teams/src/Entity/ListBuilder/TeamAppListByTeam.php b/modules/apigee_edge_teams/src/Entity/ListBuilder/TeamAppListByTeam.php index 3510dec73..1c6159121 100644 --- a/modules/apigee_edge_teams/src/Entity/ListBuilder/TeamAppListByTeam.php +++ b/modules/apigee_edge_teams/src/Entity/ListBuilder/TeamAppListByTeam.php @@ -66,7 +66,7 @@ class TeamAppListByTeam extends AppListBuilder implements ContainerInjectionInte * @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker * The app warnings checker service. */ - public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, RouteMatchInterface $route_match, ?ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) { + public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory, AppWarningsCheckerInterface $app_warnings_checker) { if (!$config_factory) { $config_factory = \Drupal::service('config.factory'); } diff --git a/modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php b/modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php index cfa27ddd5..af6117052 100644 --- a/modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php +++ b/modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php @@ -94,7 +94,7 @@ class TeamMemberRoleStorage extends SqlContentEntityStorage implements TeamMembe * @param \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface $org_controller * The organization controller service. */ - public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, TeamMembershipManagerInterface $team_membership_manager, LoggerInterface $logger, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?EntityTypeManagerInterface $entity_type_manager = NULL, OrganizationControllerInterface $org_controller) { + public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, TeamMembershipManagerInterface $team_membership_manager, LoggerInterface $logger, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager, OrganizationControllerInterface $org_controller) { parent::__construct($entity_type, $database, $entity_field_manager, $cache, $language_manager, $memory_cache, $entity_type_bundle_info, $entity_type_manager); $this->teamMembershipManager = $team_membership_manager; $this->logger = $logger; diff --git a/modules/apigee_edge_teams/tests/src/Functional/UiTest.php b/modules/apigee_edge_teams/tests/src/Functional/UiTest.php index 494ecf86e..28c6a1728 100644 --- a/modules/apigee_edge_teams/tests/src/Functional/UiTest.php +++ b/modules/apigee_edge_teams/tests/src/Functional/UiTest.php @@ -257,8 +257,10 @@ protected function teamsWorkflowTest() { // Login with the default user, the created team app should be visible on // the team app administer collection page (/team-apps). $this->drupalLogin($this->account); - $this->drupalGet(Url::fromRoute('entity.team_app.collection')); + $this->drupalGet($this->team->toUrl('collection')); $this->assertSession()->linkExists($team_modified_display_name); + $this->clickLink($team_modified_display_name); + $this->clickLink('Team Apps'); $this->assertSession()->linkExists($team_app_1_modified_display_name); // Try to delete the first team app without verification code then with a @@ -270,7 +272,7 @@ protected function teamsWorkflowTest() { // Remove the other user from the team's member list. $this->drupalLogin($this->account); - $this->drupalGet(Url::fromRoute('entity.team_app.collection')); + $this->drupalGet($this->team->toUrl('collection')); $this->clickLink($team_modified_display_name); $this->clickLink('Members'); $this->getSession()->getPage()->findById((Html::getUniqueId($this->otherAccount->getEmail())))->clickLink('Remove'); diff --git a/src/Entity/ListBuilder/AppListBuilder.php b/src/Entity/ListBuilder/AppListBuilder.php index 85e3c1784..5a96173b2 100644 --- a/src/Entity/ListBuilder/AppListBuilder.php +++ b/src/Entity/ListBuilder/AppListBuilder.php @@ -94,7 +94,7 @@ class AppListBuilder extends EdgeEntityListBuilder { * @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker * The app warnings checker service. */ - public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, RequestStack $request_stack, TimeInterface $time, ?ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) { + public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, RequestStack $request_stack, TimeInterface $time, ConfigFactoryInterface $config_factory, AppWarningsCheckerInterface $app_warnings_checker) { if (!$config_factory) { $config_factory = \Drupal::service('config.factory'); } diff --git a/src/Entity/ListBuilder/DeveloperAppListBuilderForDeveloper.php b/src/Entity/ListBuilder/DeveloperAppListBuilderForDeveloper.php index 051aa51be..c46505b0f 100644 --- a/src/Entity/ListBuilder/DeveloperAppListBuilderForDeveloper.php +++ b/src/Entity/ListBuilder/DeveloperAppListBuilderForDeveloper.php @@ -89,7 +89,7 @@ class DeveloperAppListBuilderForDeveloper extends AppListBuilder implements Cont * @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker * The app warnings checker service. */ - public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, AccountInterface $current_user, RouteMatchInterface $route_match, ?ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) { + public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, AccountInterface $current_user, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory, AppWarningsCheckerInterface $app_warnings_checker) { if (!$config_factory) { $config_factory = \Drupal::service('config.factory'); } diff --git a/src/Plugin/ApigeeFieldStorageFormat/CSV.php b/src/Plugin/ApigeeFieldStorageFormat/CSV.php index 9d18a9c13..b44f75b15 100644 --- a/src/Plugin/ApigeeFieldStorageFormat/CSV.php +++ b/src/Plugin/ApigeeFieldStorageFormat/CSV.php @@ -49,6 +49,7 @@ * * @see https://github.com/symfony/symfony/issues/27447 */ +// @phpcs:ignore Drupal.NamingConventions.ValidClassName.NoUpperAcronyms class CSV implements FieldStorageFormatInterface { /** diff --git a/src/Plugin/ApigeeFieldStorageFormat/JSON.php b/src/Plugin/ApigeeFieldStorageFormat/JSON.php index a4140569b..eb18b1496 100644 --- a/src/Plugin/ApigeeFieldStorageFormat/JSON.php +++ b/src/Plugin/ApigeeFieldStorageFormat/JSON.php @@ -31,6 +31,7 @@ * weight = 1000, * ) */ +// @phpcs:ignore Drupal.NamingConventions.ValidClassName.NoUpperAcronyms class JSON implements FieldStorageFormatInterface { /**