diff --git a/uw_cfg_common.install b/uw_cfg_common.install index b98753dbfe7365e5ca492369f99e9c07862d8693..5f00d8b93680c2325767d52cedb2cde483993c7b 100644 --- a/uw_cfg_common.install +++ b/uw_cfg_common.install @@ -10,11 +10,50 @@ use Drupal\node\Entity\Node; use Drupal\uw_cfg_common\UwPermissions\UwPermissions; use Drupal\user\Entity\Role; use Drupal\Core\Config\FileStorage; +use Drupal\uw_cfg_common\UwRoles\UwRoles; /** * Implements hook_install(). */ function uw_cfg_common_install() { + + // Get the role ids for UW roles. + $uw_rids = UwRoles::getUwRoleIds(); + + // Step through each of the rids and create + // role and set permissions. + foreach ($uw_rids as $uw_rid) { + + // Create the role. + $role = Role::create( + [ + 'id' => $uw_rid, + 'label' => UwRoles::getUwRoleLabel($uw_rid), + ] + ); + $role->save(); + + // Get the info about the role. + $uw_role = UwRoles::getUwRole($uw_rid); + + // Set the permissions for the role. + UwRoles::setUwPermissions($uw_role); + } + + // Get the role ids for Drupal roles. + $drupal_rids = UwRoles::getDrupalRoleIds(); + + // Step through each of the Drupal roles and + // set the permissions. + foreach ($drupal_rids as $drupal_rid) { + + // Get the info about the role. + $uw_role = UwRoles::getUwRole($drupal_rid); + + // Set the permissions for the role. + UwRoles::setUwPermissions($uw_role); + } + $permissions_to_process = [ 'Blog' => [ 'Use content type' => [