-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopeny_myy.install
42 lines (37 loc) · 1.03 KB
/
openy_myy.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* @file
* Open Y Node Alert install file.
*/
use \Drupal\user\Entity\Role;
use \Drupal\user\RoleInterface;
/**
* Adds permissions for MyY related REST services.
*/
function openy_myy_update_8001() {
$roles = Role::loadMultiple([
RoleInterface::ANONYMOUS_ID,
RoleInterface::AUTHENTICATED_ID,
]);
$permissions = [
"restful get myy_childcare_sessions_add",
"restful get myy_childcare_session_cancel",
"restful get myy_profile_guest_passes",
"restful get myy_childcare_scheduled",
"restful get myy_profile_family_list",
"restful get myy_profile_visits_stat",
"restful get myy_profile_membership_info",
"restful get myy_orders",
"restful get myy_profile_visits_details",
"restful get myy_profile_visits_overview"
];
global $_openy_config_import_event;
$_openy_config_import_event = TRUE;
foreach ($roles as $role) {
foreach ($permissions as $permission) {
$role->grantPermission($permission);
}
$role->save();
}
$_openy_config_import_event = FALSE;
}