💥 (admin): Exige un permiso propio en cada página

This commit is contained in:
Manuel Cillero 2026-10-04 23:50:58 +02:00
parent 2299e63585
commit f337119219
6 changed files with 31 additions and 79 deletions

View file

@ -3,7 +3,7 @@ use pagetop::prelude::*;
use crate::ADMIN_BASE_PATH;
use crate::LOCALES_ADMIN;
use crate::action::SectionBag;
use crate::registry::{AdminPermission, AdminSection};
use crate::registry::AdminSection;
/// Declara las secciones incorporadas del panel de administración.
///
@ -16,35 +16,30 @@ pub(crate) fn declare_default_sections(bag: &mut SectionBag) {
key: "people".to_owned(),
path: format!("{}/people", base),
title: Lc::t("section-people", &LOCALES_ADMIN),
permission: Some(&AdminPermission::AccessPeople),
weight: 10,
});
bag.add(AdminSection {
key: "structure".to_owned(),
path: format!("{}/structure", base),
title: Lc::t("section-structure", &LOCALES_ADMIN),
permission: Some(&AdminPermission::AccessStructure),
weight: 20,
});
bag.add(AdminSection {
key: "config".to_owned(),
path: format!("{}/config", base),
title: Lc::t("section-config", &LOCALES_ADMIN),
permission: Some(&AdminPermission::AccessConfig),
weight: 30,
});
bag.add(AdminSection {
key: "reports".to_owned(),
path: format!("{}/reports", base),
title: Lc::t("section-reports", &LOCALES_ADMIN),
permission: Some(&AdminPermission::AccessReports),
weight: 40,
});
bag.add(AdminSection {
key: "help".to_owned(),
path: format!("{}/help", base),
title: Lc::t("section-help", &LOCALES_ADMIN),
permission: None,
weight: 50,
});
}