Trait frame_support::traits::OriginTrait
source · pub trait OriginTrait: Sized {
type Call;
type PalletsOrigin: Parameter + Member + Into<Self> + From<RawOrigin<Self::AccountId>> + MaxEncodedLen;
type AccountId;
fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static);
fn reset_filter(&mut self);
fn set_caller_from(&mut self, other: impl Into<Self>);
fn filter_call(&self, call: &Self::Call) -> bool;
fn caller(&self) -> &Self::PalletsOrigin;
fn try_with_caller<R>(
self,
f: impl FnOnce(Self::PalletsOrigin) -> Result<R, Self::PalletsOrigin>
) -> Result<R, Self>;
fn none() -> Self;
fn root() -> Self;
fn signed(by: Self::AccountId) -> Self;
fn as_signed(self) -> Option<Self::AccountId>;
}
Expand description
Methods available on frame_system::Config::Origin
.
Required Associated Types§
sourcetype PalletsOrigin: Parameter + Member + Into<Self> + From<RawOrigin<Self::AccountId>> + MaxEncodedLen
type PalletsOrigin: Parameter + Member + Into<Self> + From<RawOrigin<Self::AccountId>> + MaxEncodedLen
The caller origin, overarching type of all pallets origins.
Required Methods§
sourcefn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static)
fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static)
Add a filter to the origin.
sourcefn reset_filter(&mut self)
fn reset_filter(&mut self)
Reset origin filters to default one, i.e frame_system::Config::BaseCallFilter
.
sourcefn set_caller_from(&mut self, other: impl Into<Self>)
fn set_caller_from(&mut self, other: impl Into<Self>)
Replace the caller with caller from the other origin
sourcefn filter_call(&self, call: &Self::Call) -> bool
fn filter_call(&self, call: &Self::Call) -> bool
Filter the call if caller is not root, if false is returned then the call must be filtered out.
For root origin caller, the filters are bypassed and true is returned.
sourcefn caller(&self) -> &Self::PalletsOrigin
fn caller(&self) -> &Self::PalletsOrigin
Get the caller.
sourcefn try_with_caller<R>(
self,
f: impl FnOnce(Self::PalletsOrigin) -> Result<R, Self::PalletsOrigin>
) -> Result<R, Self>
fn try_with_caller<R>(
self,
f: impl FnOnce(Self::PalletsOrigin) -> Result<R, Self::PalletsOrigin>
) -> Result<R, Self>
Do something with the caller, consuming self but returning it if the caller was unused.