Skip to main content

UserApi

Struct UserApi 

Source
pub struct UserApi<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> UserApi<'a>

Sub-API for user endpoints.

Source

pub async fn checkperm( &self, request: CheckpermRequest, ) -> Result<Value, RsError>

Find out if the current user has a particular permission. The permission strings are shown in the ResourceSpace UI when managing group permissions.

§Arguments
§Returns

TRUE if the user has the permission, FALSE if they don’t.

§TODO: Errors
§TODO: Examples
Source

pub async fn get_users( &self, request: GetUsersRequest, ) -> Result<Value, RsError>

Retrieve a list of users

Permissions are always honoured so users from other groups to which this user does not have access will be omitted.

§Arguments
§Returns

An array of matching user records include ID (“ref”), username, full name and user group ID.

§TODO: Errors
§TODO: Examples
Source

pub async fn get_users_by_permission( &self, request: GetUsersByPermissionRequest, ) -> Result<Value, RsError>

Retrieve information on all users with the given permissions

Permissions are always honoured so users from groups to which this user does not have access will be omitted.

§Arguments
§Returns

An array of matching user records with a subset of information from the user record

§TODO: Errors
§TODO: Examples
Source

pub async fn mark_email_as_invalid( &self, request: MarkEmailAsInvalidRequest, ) -> Result<Value, RsError>

Mark a specified email address as invalid.

Email addresses marked as invalid will be blocked before send_mail() tries to dispatch any emails, this will be applied to any users with this email address.

§Arguments
§Returns

Boolean - true if one or more users are found and mark as having invalid adresses, false otherwise.

§TODO: Errors
§TODO: Examples
Source

pub async fn save_user( &self, request: SaveUserRequest, ) -> Result<Value, RsError>

Save a user record.

Use new_user first to create the user, then call this with the returned ID to populate the user’s details.

§Arguments
§Returns

Returns Ok(()) on success (HTTP 200). Returns an error on HTTP 409 (e.g. missing required fields) or HTTP 403 (permission denied).

§TODO: Errors
§TODO: Examples
Source

pub async fn new_user(&self, request: NewUserRequest) -> Result<Value, RsError>

Create a new user record.

Create a user record. Use the returned ID to then call save_user() with the user details.

§Arguments
§Returns

The new user ID in data.ref on success (HTTP 200). HTTP 409 if the username already exists (data.ref = false) or the user limit has been reached (data.ref = -2). HTTP 403 on permission failure.

§TODO: Errors
§TODO: Examples

Trait Implementations§

Source§

impl<'a> Debug for UserApi<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for UserApi<'a>

§

impl<'a> !RefUnwindSafe for UserApi<'a>

§

impl<'a> Send for UserApi<'a>

§

impl<'a> Sync for UserApi<'a>

§

impl<'a> Unpin for UserApi<'a>

§

impl<'a> UnsafeUnpin for UserApi<'a>

§

impl<'a> !UnwindSafe for UserApi<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more