Centraliza configuração de access rules no módulo pai

- Adiciona rota, menu e abas unificados em ldap_groups_sync
- Cria LdapGroupsSyncController (overview dos submódulos)
- Cria UnifiedAccessRulesForm: tabela combinada de regras de todos os
  submódulos habilitados, com único botão "Add Rule"
- Cria GlobalAccessRuleForm: estende AccessRuleFormBase com parâmetro
  {group_type} na rota; exibe select "Group Type" com AJAX rebuild ao
  criar novas regras (desabilitado ao editar)
- Remove rotas access_rules e access_rule_form dos submódulos
- Remove entradas de menu dos submódulos (módulo pai fornece a entrada)
- Atualiza abas dos submódulos para base_route: ldap_groups_sync.config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 09:03:10 -03:00
parent 346b897e25
commit 72813e0f30
13 changed files with 542 additions and 65 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace Drupal\ldap_groups_sync\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Provides the overview page for the LDAP Groups Sync unified configuration.
*/
class LdapGroupsSyncController extends ControllerBase {
/**
* Renders an overview listing the enabled LDAP group sync submodules.
*/
public function overview(): array {
$submodules = [
'ldap_departments_sync' => [
'label' => $this->t('LDAP Departments Sync'),
'description' => $this->t('Synchronizes department groups from LDAP.'),
],
'ldap_research_groups_sync' => [
'label' => $this->t('LDAP Research Groups Sync'),
'description' => $this->t('Synchronizes research group entities from LDAP.'),
],
];
$rows = [];
foreach ($submodules as $module => $info) {
$enabled = $this->moduleHandler()->moduleExists($module);
$rows[] = [
(string) $info['label'],
(string) $info['description'],
$enabled
? ['data' => ['#markup' => '<span style="color:green">&#10003; ' . $this->t('Enabled') . '</span>']]
: ['data' => ['#markup' => '<span style="color:gray">&#10007; ' . $this->t('Disabled') . '</span>']],
];
}
return [
'#type' => 'table',
'#header' => [
$this->t('Module'),
$this->t('Description'),
$this->t('Status'),
],
'#rows' => $rows,
];
}
}