Skip to content

Commit 5883a11

Browse files
Move teams related update function to apigee_edge_teams. (#519)
1 parent 7054689 commit 5883a11

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

apigee_edge.install

+1-15
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface;
2828
use Drupal\Core\Installer\InstallerKernel;
2929
use Drupal\Core\Url;
3030
use Drupal\user\RoleInterface;
31-
use Drupal\views\Views;
3231

3332
/**
3433
* Implements hook_requirements().
@@ -321,20 +320,7 @@ function apigee_edge_update_8104() {
321320
}
322321

323322
/**
324-
* Remove the "Manage team members and invitations" access for the Team invitations view.
323+
* Deprecated update function.
325324
*/
326325
function apigee_edge_update_8105() {
327-
/** @var \Drupal\views\ViewExecutable $view */
328-
$view = Views::getView('team_invitations');
329-
$view->setDisplay('team');
330-
$access = $view->getDisplay()->getOption('access');
331-
if (empty($access['type']) || $access['type'] !== "team_permission") {
332-
return;
333-
}
334-
335-
$view->getDisplay()->setOption('access', [
336-
'type' => 'none',
337-
'options' => [],
338-
]);
339-
$view->save();
340326
}

modules/apigee_edge_teams/apigee_edge_teams.install

+20
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Apigee\Edge\Utility\OrganizationFeatures;
2222
use Drupal\Core\Config\FileStorage;
2323
use Drupal\user\RoleInterface;
24+
use Drupal\views\Views;
2425

2526
/**
2627
* @file
@@ -139,3 +140,22 @@ function apigee_edge_teams_update_8703() {
139140
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, $authenticated_user_permissions);
140141
}
141142
}
143+
144+
/**
145+
* Remove the "Manage team members and invitations" access for the Team invitations view.
146+
*/
147+
function apigee_edge_teams_update_8704() {
148+
if ($view = Views::getView('team_invitations')) {
149+
$view->setDisplay('team');
150+
$access = $view->getDisplay()->getOption('access');
151+
if (empty($access['type']) || $access['type'] !== "team_permission") {
152+
return;
153+
}
154+
155+
$view->getDisplay()->setOption('access', [
156+
'type' => 'none',
157+
'options' => [],
158+
]);
159+
$view->save();
160+
}
161+
}

0 commit comments

Comments
 (0)