Skip to content

Commit 181105a

Browse files
authored
Remove deprecated functions and variables for 2.x (#632)
* Remove deprecated functions and variables for 2.x * Incorrect organization now returns Forbidden
1 parent 8dbe403 commit 181105a

File tree

4 files changed

+8
-93
lines changed

4 files changed

+8
-93
lines changed

modules/apigee_edge_teams/src/Form/AddTeamMembersForm.php

-32
Original file line numberDiff line numberDiff line change
@@ -142,38 +142,6 @@ public function buildForm(array $form, FormStateInterface $form_state, TeamInter
142142
return $form;
143143
}
144144

145-
/**
146-
* Return an array of user UIDs given a list of emails.
147-
*
148-
* @param string $emails
149-
* The emails, comma separated.
150-
*
151-
* @return array
152-
* An array containing a first array of user accounts, and a second array of
153-
* emails that have no account on the system.
154-
*
155-
* @deprecated in apigee_edge_teams:8.x-1.12 and is removed from apigee_edge_teams:2.x. No replacement.
156-
*
157-
* @see https://github.com/apigee/apigee-edge-drupal/pull/474
158-
*/
159-
protected function getAccountsFromEmails(string $emails): array {
160-
$developerEmails = [];
161-
$notFound = [];
162-
163-
$emails = array_map('trim', explode(',', $emails));
164-
165-
foreach ($emails as $email) {
166-
if ($account = user_load_by_mail($email)) {
167-
$developerEmails[$email] = $account;
168-
}
169-
else {
170-
$notFound[] = $email;
171-
}
172-
}
173-
174-
return [$developerEmails, $notFound];
175-
}
176-
177145
/**
178146
* {@inheritdoc}
179147
*/

src/Plugin/EdgeKeyTypeBase.php

-13
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,6 @@ public function getEndpoint(KeyInterface $key): string {
7777
return $key->getKeyValues()['endpoint'];
7878
}
7979

80-
/**
81-
* {@inheritdoc}
82-
*/
83-
public function getEndpointType(KeyInterface $key): string {
84-
if ($this->getInstanceType($key) === EdgeKeyTypeInterface::INSTANCE_TYPE_PUBLIC) {
85-
/* @phpstan-ignore-next-line */
86-
return EdgeKeyTypeInterface::EDGE_ENDPOINT_TYPE_DEFAULT;
87-
}
88-
89-
/* @phpstan-ignore-next-line */
90-
return EdgeKeyTypeInterface::EDGE_ENDPOINT_TYPE_CUSTOM;
91-
}
92-
9380
/**
9481
* {@inheritdoc}
9582
*/

src/Plugin/EdgeKeyTypeInterface.php

-41
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,6 @@ interface EdgeKeyTypeInterface extends KeyTypeMultivalueInterface, KeyTypeAuthen
6969
const EDGE_AUTH_TYPE_JWT = 'jwt';
7070

7171
const EDGE_AUTH_TYPE_DEFAULT_GCE_SERVICE_ACCOUNT = 'gce-service-account';
72-
/**
73-
* The endpoint type for default.
74-
*
75-
* @var string
76-
*
77-
* @deprecated in apigee_edge:8.x-1.2 and is removed from
78-
* apigee_edge:8.x-2.0. Check for endpoint type instead.
79-
*
80-
* @see EdgeKeyTypeInterface::getEndpointType().
81-
*/
82-
const EDGE_ENDPOINT_TYPE_DEFAULT = 'default';
83-
84-
/**
85-
* The endpoint type for custom.
86-
*
87-
* @var string
88-
*
89-
* @deprecated in apigee_edge:8.x-1.2 and is removed from
90-
* apigee_edge:8.x-2.0. Check for endpoint type instead.
91-
*
92-
* @see EdgeKeyTypeInterface::getEndpointType().
93-
*/
94-
const EDGE_ENDPOINT_TYPE_CUSTOM = 'custom';
9572

9673
/**
9774
* Gets the authentication type.
@@ -126,24 +103,6 @@ public function getEndpoint(KeyInterface $key): string;
126103
*/
127104
public function getInstanceType(KeyInterface $key): string;
128105

129-
/**
130-
* Gets the API endpoint type (default or custom).
131-
*
132-
* It returns "default" on a public cloud instance, otherwise "custom".
133-
*
134-
* @param \Drupal\key\KeyInterface $key
135-
* The key entity.
136-
*
137-
* @return string
138-
* The API endpoint type.
139-
*
140-
* @deprecated in apigee_edge:8.x-1.2 and is removed from
141-
* apigee_edge:8.x-2.0. Use getInstanceType() instead.
142-
*
143-
* @see https://github.com/apigee/apigee-edge-drupal/issues/268
144-
*/
145-
public function getEndpointType(KeyInterface $key): string;
146-
147106
/**
148107
* Gets the API organization.
149108
*

tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,15 @@ protected function validateForm(callable $visitFormAsAdmin): void {
372372
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The organization username should be a valid email. Error message: ");
373373
$page->fillField('Username', $this->username);
374374

375+
// TODO Re-add this assert later, if requires.
376+
// Irrespective of incorrect organization, username or password it will say Forbidden.
375377
// Test invalid organization.
376-
$random_org = $this->randomGenerator->word(16);
377-
$page->fillField('Organization', $random_org);
378-
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The given organization name ({$random_org}) is incorrect. Error message: ");
379-
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', 'HTTP/1.1 404 Not Found');
380-
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', "\"organization\": \"{$random_org}\"");
381-
$page->fillField('Organization', $this->organization);
382-
378+
// $random_org = $this->randomGenerator->word(16);
379+
// $page->fillField('Organization', $random_org);
380+
// $this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The given organization name ({$random_org}) is incorrect. Error message: ");
381+
// $web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', 'HTTP/1.1 404 Not Found');
382+
// $web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', "\"organization\": \"{$random_org}\"");
383+
// $page->fillField('Organization', $this->organization);
383384
// Test invalid endpoint.
384385
$page->selectFieldOption('key_input_settings[instance_type]', EdgeKeyTypeInterface::INSTANCE_TYPE_PRIVATE);
385386
$invalid_domain = "{$this->randomGenerator->word(16)}.example.com";

0 commit comments

Comments
 (0)