Struct create_rust_app::auth::Role
source · pub struct Role;
Implementations§
source§impl Role
impl Role
sourcepub fn assign(db: &mut Connection, user_id: i32, role: &str) -> Result<bool>
pub fn assign(db: &mut Connection, user_id: i32, role: &str) -> Result<bool>
assign role
to the User whose id is user_id
Returns true if successful
sourcepub fn assign_many(
db: &mut Connection,
user_id: i32,
roles: Vec<String>
) -> Result<bool>
pub fn assign_many( db: &mut Connection, user_id: i32, roles: Vec<String> ) -> Result<bool>
assigns every role in roles
to the User whose id is user_id
returns true if successful
sourcepub fn unassign(db: &mut Connection, user_id: i32, role: &str) -> Result<bool>
pub fn unassign(db: &mut Connection, user_id: i32, role: &str) -> Result<bool>
unassigns role
from the User whose id is user_id
returns true if successful
sourcepub fn unassign_many(
db: &mut Connection,
user_id: i32,
roles: Vec<String>
) -> Result<bool>
pub fn unassign_many( db: &mut Connection, user_id: i32, roles: Vec<String> ) -> Result<bool>
unassigns every role in roles
from the User whose id is user_id
returns true if successful
Auto Trait Implementations§
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,
Convert
&self
to an expression for Diesel’s query builder. Read more