Mercurial > hg > isophonics-drupal-site
comparison core/modules/user/user.post_update.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Post update functions for User module. | |
6 */ | |
7 | |
8 use Drupal\user\Entity\Role; | |
9 | |
10 /** | |
11 * Enforce order of role permissions. | |
12 */ | |
13 function user_post_update_enforce_order_of_permissions() { | |
14 $entity_save = function (Role $role) { | |
15 $permissions = $role->getPermissions(); | |
16 sort($permissions); | |
17 if ($permissions !== $role->getPermissions()) { | |
18 $role->save(); | |
19 } | |
20 }; | |
21 array_map($entity_save, Role::loadMultiple()); | |
22 } |