referrerpolicy=no-referrer-when-downgrade
frame_support::traits

Trait EnsureOrigin

Source
pub trait EnsureOrigin<OuterOrigin> {
    type Success;

    // Required methods
    fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>;
    fn try_successful_origin() -> Result<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.

Source

fn try_successful_origin() -> Result<OuterOrigin, ()>

Attempt to get an outer origin capable of passing try_origin check. May return Err if it is impossible.

** Should be used for benchmarking only!!! **

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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

Source§

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>

Source§

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

Source§

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

Source§

type Success = Success

Source§

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

Source§

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>

Source§

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>,

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Fellows

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Masters

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Members

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

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

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

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

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

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

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

impl<O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32> EnsureOrigin<O> for EnsureMembers<AccountId, I, N>

impl<O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32, const D: u32> EnsureOrigin<O> for EnsureProportionAtLeast<AccountId, I, N, D>

impl<O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32, const D: u32> EnsureOrigin<O> for EnsureProportionMoreThan<AccountId, I, N, D>

impl<O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>, I, AccountId: Decode> EnsureOrigin<O> for EnsureMember<AccountId, I>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<<T as Config>::RuntimeOrigin> for EnsureInducted<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<<T as Config>::RuntimeOrigin> for EnsureMember<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<<T as Config>::RuntimeOrigin> for EnsureRanked<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<<T as Config>::RuntimeOrigin> for EnsureRankedMember<T, I, MIN_RANK>

impl<T: Config> EnsureOrigin<<T as Config>::RuntimeOrigin> for EnsureFounder<T>

impl<O: OriginTrait + From<Origin>, F: Contains<L>, L: TryFrom<Location> + TryInto<Location> + Clone> EnsureOrigin<O> for EnsureXcm<F, L>
where O::PalletsOrigin: From<Origin> + TryInto<Origin, Error = O::PalletsOrigin>,

impl<O: OriginTrait + From<Origin>, F: Contains<Location>> EnsureOrigin<O> for EnsureResponse<F>
where O::PalletsOrigin: From<Origin> + TryInto<Origin, Error = O::PalletsOrigin>,

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Fellows

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Spender

impl<RuntimeOrigin: OriginTrait + Clone, Conversion: TryConvert<RuntimeOrigin, Location>> EnsureOrigin<RuntimeOrigin> for EnsureXcmOrigin<RuntimeOrigin, Conversion>
where RuntimeOrigin::PalletsOrigin: PartialEq,

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Fellows

impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for Spender