Trait frame_support::traits::EnsureOrigin

source ·
pub trait EnsureOrigin<OuterOrigin> {
    type Success;

    // Required method
    fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>;

    // Provided methods
    fn ensure_origin(o: OuterOrigin) -> Result<Self::Success, BadOrigin> { ... }
    fn ensure_origin_or_root(
        o: OuterOrigin,
    ) -> Result<Option<Self::Success>, BadOrigin>
       where OuterOrigin: OriginTrait { ... }
    fn try_origin_or_root(
        o: OuterOrigin,
    ) -> Result<Option<Self::Success>, OuterOrigin>
       where OuterOrigin: OriginTrait { ... }
}
Expand description

Some sort of check on the origin is performed by this object.

Required Associated Types§

source

type Success

A return type.

Required Methods§

source

fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>

Perform the origin check.

Provided Methods§

source

fn ensure_origin(o: OuterOrigin) -> Result<Self::Success, BadOrigin>

Perform the origin check.

source

fn ensure_origin_or_root( o: OuterOrigin, ) -> Result<Option<Self::Success>, BadOrigin>
where OuterOrigin: OriginTrait,

The same as ensure_origin except that Root origin will always pass. This can only be used if Success has a sensible impl of Default since that will be used in the result.

source

fn try_origin_or_root( o: OuterOrigin, ) -> Result<Option<Self::Success>, OuterOrigin>
where OuterOrigin: OriginTrait,

The same as try_origin except that Root origin will always pass. This can only be used if Success has a sensible impl of Default since that will be used in the result.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O, Original: EnsureOrigin<O>, Mutator: Morph<Original::Success>> EnsureOrigin<O> for MapSuccess<Original, Mutator>

§

type Success = <Mutator as Morph<<Original as EnsureOrigin<O>>::Success>>::Outcome

source§

impl<O: Clone, Original: EnsureOrigin<O>, Mutator: TryMorph<Original::Success>> EnsureOrigin<O> for TryMapSuccess<Original, Mutator>

§

type Success = <Mutator as TryMorph<<Original as EnsureOrigin<O>>::Success>>::Outcome

source§

impl<OO, Success> EnsureOrigin<OO> for NeverEnsureOrigin<Success>

§

type Success = Success

source§

impl<OuterOrigin, L: EnsureOrigin<OuterOrigin>, R: EnsureOrigin<OuterOrigin>> EnsureOrigin<OuterOrigin> for EitherOfDiverse<L, R>

§

type Success = Either<<L as EnsureOrigin<OuterOrigin>>::Success, <R as EnsureOrigin<OuterOrigin>>::Success>

source§

impl<OuterOrigin, L: EnsureOrigin<OuterOrigin>, R: EnsureOrigin<OuterOrigin, Success = L::Success>> EnsureOrigin<OuterOrigin> for EitherOf<L, R>

§

type Success = <L as EnsureOrigin<OuterOrigin>>::Success

source§

impl<OuterOrigin, Origin, PrivilegeCmp> EnsureOrigin<OuterOrigin> for EnsureOriginEqualOrHigherPrivilege<Origin, PrivilegeCmp>
where Origin: Get<OuterOrigin>, OuterOrigin: Eq, PrivilegeCmp: PrivilegeCmp<OuterOrigin>,

§

type Success = ()