pub struct AllowAny;Expand description
AllowAny - grants permission to all requests
This permission class allows unrestricted access. Use with caution.
§Examples
use reinhardt_auth::{Permission, AllowAny, PermissionContext};
use reinhardt_http::Request;
use hyper::{Method, Uri, Version, header::HeaderMap};
use bytes::Bytes;
let permission = AllowAny;
let request = Request::builder()
.method(Method::GET)
.uri("/")
.version(Version::HTTP_11)
.headers(HeaderMap::new())
.body(Bytes::new())
.build()
.unwrap();
let context = PermissionContext {
request: &request,
is_authenticated: false,
is_admin: false,
is_active: false,
user: None,
};
assert!(permission.has_permission(&context).await);Trait Implementations§
Source§impl<B> BitAnd<B> for AllowAnywhere
B: Permission,
impl<B> BitAnd<B> for AllowAnywhere
B: Permission,
Source§impl<B> BitOr<B> for AllowAnywhere
B: Permission,
impl<B> BitOr<B> for AllowAnywhere
B: Permission,
Source§impl Permission for AllowAny
impl Permission for AllowAny
Source§fn has_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_context: &'life1 PermissionContext<'life2>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
AllowAny: 'async_trait,
fn has_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_context: &'life1 PermissionContext<'life2>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
AllowAny: 'async_trait,
Checks if the user has permission to perform the action Read more
impl Copy for AllowAny
Auto Trait Implementations§
impl Freeze for AllowAny
impl RefUnwindSafe for AllowAny
impl Send for AllowAny
impl Sync for AllowAny
impl Unpin for AllowAny
impl UnsafeUnpin for AllowAny
impl UnwindSafe for AllowAny
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().