mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/ldap_groups_sync.git
synced 2026-03-11 02:37:41 -03:00
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:
50
src/Controller/LdapGroupsSyncController.php
Normal file
50
src/Controller/LdapGroupsSyncController.php
Normal 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">✓ ' . $this->t('Enabled') . '</span>']]
|
||||
: ['data' => ['#markup' => '<span style="color:gray">✗ ' . $this->t('Disabled') . '</span>']],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'#type' => 'table',
|
||||
'#header' => [
|
||||
$this->t('Module'),
|
||||
$this->t('Description'),
|
||||
$this->t('Status'),
|
||||
],
|
||||
'#rows' => $rows,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user