updated core from 8.4 to 8.5 : bug with login_destination

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:01:21 +01:00
parent 0d78da249b
commit e668535a4e
3486 changed files with 89604 additions and 33283 deletions
+43
View File
@@ -6,6 +6,7 @@
*/
use Drupal\user\RoleInterface;
use Drupal\user\Entity\Role;
/**
* Implements hook_install().
@@ -77,3 +78,45 @@ function media_requirements($phase) {
return $requirements;
}
/**
* Introduce per-bundle permissions.
*/
function media_update_8500() {
$media_types = \Drupal::entityQuery('media_type')->execute();
/** @var \Drupal\user\RoleInterface $role */
foreach (Role::loadMultiple() as $role) {
if ($role->hasPermission('update media')) {
foreach ($media_types as $media_type) {
$role->grantPermission("edit own $media_type media");
}
}
if ($role->hasPermission('update any media')) {
foreach ($media_types as $media_type) {
$role->grantPermission("edit any $media_type media");
}
}
if ($role->hasPermission('delete media')) {
foreach ($media_types as $media_type) {
$role->grantPermission("delete own $media_type media");
}
}
if ($role->hasPermission('delete any media')) {
foreach ($media_types as $media_type) {
$role->grantPermission("delete any $media_type media");
}
}
if ($role->hasPermission('create media')) {
foreach ($media_types as $media_type) {
$role->grantPermission("create $media_type media");
}
}
$role->save();
}
}