Loading src/TcaPermissionGenerator.php +16 −6 Original line number Diff line number Diff line Loading @@ -70,14 +70,24 @@ class TcaPermissionGenerator implements ContainerInjectionInterface { ->getEntityType(); $permissions += [ 'tca administer ' . $def['entityType'] => [ 'title' => $this->t( 'Administer Token Content Access settings for %entity_type', ['%entity_type' => $entity_type->getLabel()]), 'title' => $this->t('Administer Token Content Access settings for %entity_type', [ '%entity_type' => $entity_type->getLabel(), ]), 'dependencies' => [ 'module' => [ $def['provider'], ], ], ], 'tca bypass ' . $def['entityType'] => [ 'title' => $this->t( 'Bypass Token Content Access action for %entity_type', ['%entity_type' => $entity_type->getLabel()]), 'title' => $this->t('Bypass Token Content Access action for %entity_type', [ '%entity_type' => $entity_type->getLabel(), ]), 'dependencies' => [ 'module' => [ $def['provider'], ], ], ], ]; } Loading tca.install +19 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ * Contains tca.install. */ use Drupal\user\Entity\Role; /** * Add the public field to TCA Settings entity. */ Loading @@ -27,3 +29,20 @@ function tca_update_8101(&$sandbox) { } } } /** * Add TCA permission dependencies. */ function tca_update_8301(&$sandbox) { $plugin_manager = \Drupal::service('plugin.manager.tca_plugin'); $roles = Role::loadMultiple(); foreach ($plugin_manager->getDefinitions() as $def) { foreach ($roles as $role) { if ($role->hasPermission('tca administer ' . $def['entityType']) || $role->hasPermission('tca bypass ' . $def['entityType'])) { $role->calculateDependencies(); $role->save(); } } } } Loading
src/TcaPermissionGenerator.php +16 −6 Original line number Diff line number Diff line Loading @@ -70,14 +70,24 @@ class TcaPermissionGenerator implements ContainerInjectionInterface { ->getEntityType(); $permissions += [ 'tca administer ' . $def['entityType'] => [ 'title' => $this->t( 'Administer Token Content Access settings for %entity_type', ['%entity_type' => $entity_type->getLabel()]), 'title' => $this->t('Administer Token Content Access settings for %entity_type', [ '%entity_type' => $entity_type->getLabel(), ]), 'dependencies' => [ 'module' => [ $def['provider'], ], ], ], 'tca bypass ' . $def['entityType'] => [ 'title' => $this->t( 'Bypass Token Content Access action for %entity_type', ['%entity_type' => $entity_type->getLabel()]), 'title' => $this->t('Bypass Token Content Access action for %entity_type', [ '%entity_type' => $entity_type->getLabel(), ]), 'dependencies' => [ 'module' => [ $def['provider'], ], ], ], ]; } Loading
tca.install +19 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ * Contains tca.install. */ use Drupal\user\Entity\Role; /** * Add the public field to TCA Settings entity. */ Loading @@ -27,3 +29,20 @@ function tca_update_8101(&$sandbox) { } } } /** * Add TCA permission dependencies. */ function tca_update_8301(&$sandbox) { $plugin_manager = \Drupal::service('plugin.manager.tca_plugin'); $roles = Role::loadMultiple(); foreach ($plugin_manager->getDefinitions() as $def) { foreach ($roles as $role) { if ($role->hasPermission('tca administer ' . $def['entityType']) || $role->hasPermission('tca bypass ' . $def['entityType'])) { $role->calculateDependencies(); $role->save(); } } } }