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§

type Success

A return type.

Required Methods§

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

Perform the origin check.

Provided Methods§

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

Perform the origin check.

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.

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.

Implementors§

§

impl<O, AccountId> EnsureOrigin<O> for EnsureNone<AccountId>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>,

§

type Success = ()

§

impl<O, AccountId> EnsureOrigin<O> for EnsureRoot<AccountId>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>,

§

type Success = ()

§

impl<O, AccountId> EnsureOrigin<O> for EnsureSigned<AccountId>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode,

§

type Success = AccountId

§

impl<O, AccountId, Success> EnsureOrigin<O> for EnsureRootWithSuccess<AccountId, Success>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, Success: TypedGet,

§

type Success = <Success as TypedGet>::Type

§

impl<O, Ensure, AccountId, Success> EnsureOrigin<O> for EnsureWithSuccess<Ensure, AccountId, Success>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, Ensure: EnsureOrigin<O>, Success: TypedGet,

§

type Success = <Success as TypedGet>::Type

§

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

§

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

§

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

§

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

§

impl<O, Success> EnsureOrigin<O> for EnsureNever<Success>

§

type Success = Success

§

impl<O, Who, AccountId> EnsureOrigin<O> for EnsureSignedBy<Who, AccountId>where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, Who: SortedMembers<AccountId>, AccountId: PartialEq<AccountId> + Clone + Ord + Decode,

§

type Success = AccountId

§

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

§

type Success = Success

§

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

§

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

§

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

§

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

§

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

§

type Success = ()