✨ (auth): Añade CurrentUser y sistema de permisos
- Nuevo módulo `auth` que exporta `CurrentUser`, `CheckPermission` y `has_permission()`. - `Context` y `Page` exponen `current_user()` vía `Contextual`. - `HttpRequest` accede a extensiones de middleware con `extension<T>()`. - `Extension` incluye nuevo método `configure_middleware`. - `try_dispatch_actions` para despachar acciones con control del flujo.
This commit is contained in:
parent
3120fd9a6f
commit
0e96bcce64
22 changed files with 544 additions and 84 deletions
|
|
@ -10,19 +10,16 @@ pub struct AfterRender<C: Component> {
|
|||
weight: Weight,
|
||||
}
|
||||
|
||||
/// Filtro para despachar [`FnActionWithComponent`] después de renderizar un componente `C`.
|
||||
// Filtro para despachar `FnActionWithComponent` después de renderizar un componente `C`.
|
||||
impl<C: Component> ActionDispatcher for AfterRender<C> {
|
||||
/// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`.
|
||||
fn referer_type_id(&self) -> Option<UniqueId> {
|
||||
self.referer_type_id
|
||||
}
|
||||
|
||||
/// Devuelve el identificador del componente.
|
||||
fn referer_id(&self) -> Option<String> {
|
||||
self.referer_id.clone()
|
||||
}
|
||||
|
||||
/// Devuelve el peso para definir el orden de ejecución.
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,19 +10,16 @@ pub struct BeforeRender<C: Component> {
|
|||
weight: Weight,
|
||||
}
|
||||
|
||||
/// Filtro para despachar [`FnActionWithComponent`] antes de renderizar un componente `C`.
|
||||
// Filtro para despachar `FnActionWithComponent` antes de renderizar un componente `C`.
|
||||
impl<C: Component> ActionDispatcher for BeforeRender<C> {
|
||||
/// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`.
|
||||
fn referer_type_id(&self) -> Option<UniqueId> {
|
||||
self.referer_type_id
|
||||
}
|
||||
|
||||
/// Devuelve el identificador del componente.
|
||||
fn referer_id(&self) -> Option<String> {
|
||||
self.referer_id.clone()
|
||||
}
|
||||
|
||||
/// Devuelve el peso para definir el orden de ejecución.
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,19 +10,16 @@ pub struct TransformMarkup<C: Component> {
|
|||
weight: Weight,
|
||||
}
|
||||
|
||||
/// Filtro para despachar [`FnActionTransformMarkup`] sobre el renderizado de un componente `C`.
|
||||
// Filtro para despachar `FnActionTransformMarkup` sobre el renderizado de un componente `C`.
|
||||
impl<C: Component> ActionDispatcher for TransformMarkup<C> {
|
||||
/// Devuelve el identificador de tipo ([`UniqueId`]) del componente `C`.
|
||||
fn referer_type_id(&self) -> Option<UniqueId> {
|
||||
self.referer_type_id
|
||||
}
|
||||
|
||||
/// Devuelve el identificador del componente.
|
||||
fn referer_id(&self) -> Option<String> {
|
||||
self.referer_id.clone()
|
||||
}
|
||||
|
||||
/// Devuelve el peso para definir el orden de ejecución.
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ pub struct AfterRenderBody {
|
|||
weight: Weight,
|
||||
}
|
||||
|
||||
// Filtro para despachar `FnActionWithPage` después de renderizar el cuerpo de la página.
|
||||
impl ActionDispatcher for AfterRenderBody {
|
||||
/// Devuelve el peso para definir el orden de ejecución.
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
|
@ -35,8 +35,7 @@ impl AfterRenderBody {
|
|||
}
|
||||
|
||||
/// Despacha las acciones.
|
||||
#[inline(always)]
|
||||
#[allow(clippy::inline_always)]
|
||||
#[inline]
|
||||
pub(crate) fn dispatch(page: &mut Page) {
|
||||
dispatch_actions(
|
||||
&ActionKey::new(UniqueId::of::<Self>(), None, None),
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ pub struct BeforeRenderBody {
|
|||
weight: Weight,
|
||||
}
|
||||
|
||||
// Filtro para despachar `FnActionWithPage` antes de renderizar el cuerpo de la página.
|
||||
impl ActionDispatcher for BeforeRenderBody {
|
||||
/// Devuelve el peso para definir el orden de ejecución.
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
|
@ -35,8 +35,7 @@ impl BeforeRenderBody {
|
|||
}
|
||||
|
||||
/// Despacha las acciones.
|
||||
#[inline(always)]
|
||||
#[allow(clippy::inline_always)]
|
||||
#[inline]
|
||||
pub(crate) fn dispatch(page: &mut Page) {
|
||||
dispatch_actions(
|
||||
&ActionKey::new(UniqueId::of::<Self>(), None, None),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue