pub trait TryUpdate<'subject, 'context, 'input, Ctx>: Send + Syncwhere
    Ctx: Sync + 'subject + 'context,{
    // Provided methods
    fn can_update<'life0, 'async_trait, DM, SC, TC, I>(
        ctx: &'life0 Ctx,
        input: &'input I
    ) -> Pin<Box<dyn Future<Output = Result<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Ok, <DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error>> + Send + 'async_trait>>
       where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait,
             DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait,
             SC: StorageClient + Send + Sync + 'async_trait,
             TC: Send + Sync + TransactionCache + 'async_trait,
             Ctx: AuthorizationContext<DM, SC, TC>,
             I: Send + Sync + 'async_trait,
             'subject: 'async_trait,
             'context: 'async_trait + 'input,
             'input: 'async_trait,
             'life0: 'async_trait + 'subject + 'context { ... }
    fn try_update<'life0, 'async_trait, DM, SC, TC, I>(
        ctx: &'life0 Ctx,
        input: I
    ) -> Pin<Box<dyn Future<Output = Result<<Update<Self> as StorageAction<SC, I>>::Ok, ActionError<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error, <Update<Self> as StorageAction<SC, I>>::Error, <TC as TransactionCache>::Error>>> + Send + 'async_trait>>
       where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait,
             DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait,
             SC: StorageClient + Send + Sync + 'async_trait,
             TC: Send + Sync + TransactionCache + TransactionCacheAction<Update<Self>, SC, I> + 'async_trait,
             Ctx: AuthorizationContext<DM, SC, TC>,
             Update<Self>: StorageAction<SC, I>,
             I: Send + Sync + 'async_trait,
             'subject: 'async_trait,
             'context: 'async_trait,
             'input: 'async_trait,
             'life0: 'async_trait + 'subject + 'context { ... }
    fn try_update_one<'life0, 'async_trait, DM, SC, TC, I>(
        ctx: &'life0 Ctx,
        input: I
    ) -> Pin<Box<dyn Future<Output = Result<<<Update<Self> as StorageAction<SC, [I; 1]>>::Ok as IntoIterator>::Item, ActionError<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, [I; 1], <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error, <Update<Self> as StorageAction<SC, [I; 1]>>::Error, <TC as TransactionCache>::Error>>> + Send + 'async_trait>>
       where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait,
             DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, [I; 1], <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait,
             SC: StorageClient + Send + Sync + 'async_trait,
             TC: Send + Sync + TransactionCache + TransactionCacheAction<Update<Self>, SC, [I; 1]> + 'async_trait,
             Ctx: AuthorizationContext<DM, SC, TC>,
             Update<Self>: StorageAction<SC, [I; 1]>,
             I: Send + Sync + 'async_trait,
             <Update<Self> as StorageAction<SC, [I; 1]>>::Ok: IntoIterator,
             <<Update<Self> as StorageAction<SC, [I; 1]>>::Ok as IntoIterator>::Item: Send,
             'subject: 'async_trait,
             'context: 'async_trait,
             'input: 'async_trait,
             'life0: 'async_trait + 'subject + 'context { ... }
}
Expand description

Makes an authorization query and performs "update" action.

Includes:

  • a query whether the action with type "update" can be performed given the provided input and context (which must provide information about the event’s subject, context and decision maker). Automatically implmented for any object which can be queried about for the given DecisionMaker.
  • upon approval of the action by the specified DecisionMaker, the action is actually performed

Provided Methods§

source

fn can_update<'life0, 'async_trait, DM, SC, TC, I>( ctx: &'life0 Ctx, input: &'input I ) -> Pin<Box<dyn Future<Output = Result<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Ok, <DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error>> + Send + 'async_trait>>where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait, DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait, SC: StorageClient + Send + Sync + 'async_trait, TC: Send + Sync + TransactionCache + 'async_trait, Ctx: AuthorizationContext<DM, SC, TC>, I: Send + Sync + 'async_trait, 'subject: 'async_trait, 'context: 'async_trait + 'input, 'input: 'async_trait, 'life0: 'async_trait + 'subject + 'context,

Query whether the subject is authorized to update the specified object(s).

source

fn try_update<'life0, 'async_trait, DM, SC, TC, I>( ctx: &'life0 Ctx, input: I ) -> Pin<Box<dyn Future<Output = Result<<Update<Self> as StorageAction<SC, I>>::Ok, ActionError<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error, <Update<Self> as StorageAction<SC, I>>::Error, <TC as TransactionCache>::Error>>> + Send + 'async_trait>>where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait, DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, I, <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait, SC: StorageClient + Send + Sync + 'async_trait, TC: Send + Sync + TransactionCache + TransactionCacheAction<Update<Self>, SC, I> + 'async_trait, Ctx: AuthorizationContext<DM, SC, TC>, Update<Self>: StorageAction<SC, I>, I: Send + Sync + 'async_trait, 'subject: 'async_trait, 'context: 'async_trait, 'input: 'async_trait, 'life0: 'async_trait + 'subject + 'context,

Query whether the subject is authorized to update the specified objects. If so, perform the action.

source

fn try_update_one<'life0, 'async_trait, DM, SC, TC, I>( ctx: &'life0 Ctx, input: I ) -> Pin<Box<dyn Future<Output = Result<<<Update<Self> as StorageAction<SC, [I; 1]>>::Ok as IntoIterator>::Item, ActionError<<DM as DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, [I; 1], <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId>>::Error, <Update<Self> as StorageAction<SC, [I; 1]>>::Error, <TC as TransactionCache>::Error>>> + Send + 'async_trait>>where Self: AsStorage<<SC as StorageClient>::Backend> + 'async_trait, DM: DecisionMaker<<Ctx as AuthorizationContext<DM, SC, TC>>::Subject<'subject>, Update<Self>, Self, [I; 1], <Ctx as AuthorizationContext<DM, SC, TC>>::Context<'context>, SC::TransactionId> + Sync + 'async_trait, SC: StorageClient + Send + Sync + 'async_trait, TC: Send + Sync + TransactionCache + TransactionCacheAction<Update<Self>, SC, [I; 1]> + 'async_trait, Ctx: AuthorizationContext<DM, SC, TC>, Update<Self>: StorageAction<SC, [I; 1]>, I: Send + Sync + 'async_trait, <Update<Self> as StorageAction<SC, [I; 1]>>::Ok: IntoIterator, <<Update<Self> as StorageAction<SC, [I; 1]>>::Ok as IntoIterator>::Item: Send, 'subject: 'async_trait, 'context: 'async_trait, 'input: 'async_trait, 'life0: 'async_trait + 'subject + 'context,

Query whether the subject is authorized to update the specified object. If so, perform the action. Expects the return type of the storage action to implement IntoIterator.

Implementors§

source§

impl<'subject, 'context, 'input, Ctx, T> TryUpdate<'subject, 'context, 'input, Ctx> for Twhere Self: Send + Sync, Ctx: Sync + 'subject + 'context,