💥 (admin): Exige un permiso propio en cada página
This commit is contained in:
parent
2299e63585
commit
f337119219
6 changed files with 31 additions and 79 deletions
|
|
@ -87,9 +87,8 @@ impl ActionBag {
|
|||
/// bag.add(AdminSection {
|
||||
/// key: "tools".to_owned(),
|
||||
/// path: "/admin/tools".to_owned(),
|
||||
/// title: Lc::n("Tools"),
|
||||
/// permission: None,
|
||||
/// weight: 60,
|
||||
/// title: Lc::n("Tools"),
|
||||
/// weight: 60,
|
||||
/// });
|
||||
/// }
|
||||
/// // En Extension::actions():
|
||||
|
|
@ -130,10 +129,18 @@ impl DeclareAdminSections {
|
|||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use pagetop::locale::Lc;
|
||||
/// use pagetop::prelude::*;
|
||||
/// use pagetop_admin::action::{DeclareAdminPages, PageBag};
|
||||
/// use pagetop_admin::registry::{AdminPage, AdminPageKind};
|
||||
///
|
||||
/// struct ExportPermission;
|
||||
///
|
||||
/// impl Permission for ExportPermission {
|
||||
/// fn key(&self) -> CowStr {
|
||||
/// "tools:export".into()
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// fn declare_pages(bag: &mut PageBag) {
|
||||
/// bag.add(AdminPage {
|
||||
/// path: "/admin/tools/export".to_owned(),
|
||||
|
|
@ -141,7 +148,7 @@ impl DeclareAdminSections {
|
|||
/// title: Lc::n("Export"),
|
||||
/// description: Some(Lc::n("Export site data.")),
|
||||
/// weight: 0,
|
||||
/// permission: None,
|
||||
/// permission: &ExportPermission,
|
||||
/// kind: AdminPageKind::View,
|
||||
/// });
|
||||
/// }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue