pub async fn validate(&self, user: &D, method: &Method, db: Option<&AxumDatabasePool>) -> bool
    where
        D: HasPermission + Authentication<D>,
    {
        if self.auth_required && !user.is_authenticated() {
            return false;
        }

        if self.methods.iter().any(|r| r == method) {
            self.rights.evaluate(user, &db).await
        } else {
            false
        }
    }
/// Validates if the Methods MAtch, Rights Exist or do not and If the user is Authenticated.
///
/// Contains an Optional axum_session_database Pool for User auto loading.
///
/// # Examples
/// ```rust no_run
/// if !Auth::<User>::build([Method::POST], true)
///     .requires(Rights::all([
///         Rights::permission("admin:view"),
///         Rights::permission("form:editreports"),
///     ]))
///     .validate(&current_user, &state.method, None)
///     .await
/// {
///     return handler_404(state).await.into_response();
/// }
/// ```
///
Validates if the Methods MAtch, Rights Exist or do not and If the user is Authenticated.
Contains an Optional axum_session_database Pool for User auto loading.
Validates if the Methods MAtch Rights Exist or do not and If the user is Authenticated . Contains an Optional axum_session_database Pool for User auto loading .
pub async fn validate(&self, user: &D, method: &Method, db: Option<&AxumDatabasePool>) -> bool
    where
        D: HasPermission + Authentication<D>,
    {
        if self.auth_required && !user.is_authenticated() {
            return false;
        }
        if self.methods.iter().any(|r| r == method) {
            self.rights.evaluate(user, &db).await
        } else {
            false
        }
    }
pub async fn validate ( & self , user : & D , method : & Method , db : Option < & AxumDatabasePool > ) -> bool where D : HasPermission + Authentication < D > , { if self . auth_required && ! user . is_authenticated ( ) { return false ; } if self . methods . iter ( ) . any ( | r | r == method ) { self . rights . evaluate ( user , & db ) . await } else { false } }
Validates if the Methods MAtch, Rights Exist or do not and If the user is Authenticated.
Validates if the Methods MAtch Rights Exist or do not and If the user is Authenticated .
&self
user
&D
method
&Method
db
Option<&AxumDatabasePool>
&self
user
&D
method
&Method
db
Option<&AxumDatabasePool>
examples
```rust no_run
if !Auth::::build([Method::POST], true)
.requires(Rights::all([
Rights::permission("admin:view"),
Rights::permission("form:editreports"),
]))
.validate(&current_user, &state.method, None)
.await
{
return handler_404(state).await.into_response();
}
```
` ` ` rust no_run if !Auth :::: build ( [ Method :: POST ] true ) . requires ( Rights :: all ( [ Rights :: permission ( " admin : view " ) Rights :: permission ( " form : editreports " ) ] )) . validate ( &current_user &state . method None ) . await { return handler_404 ( state ) . await . into_response () ; } ` ` `