casdoor_sdk_rust

Struct Sdk

Source
pub struct Sdk { /* private fields */ }

Implementations§

Source§

impl Sdk

Source§

impl Sdk

Source

pub fn authn(&self) -> AuthSdk

Source§

impl Sdk

Source

pub async fn get_enforcers( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Enforcer>>

Source

pub async fn enforce(&self, args: EnforceArgs) -> SdkResult<EnforceResult>

Source

pub async fn batch_enforce( &self, args: BatchEnforceArgs, ) -> SdkResult<BatchEnforceResult>

Source

pub async fn get_policies( &self, enforcer_name: String, ) -> SdkResult<Vec<CasbinRule>>

Source

pub async fn add_policy( &self, enforcer_name: String, policy: &CasbinRule, ) -> SdkResult<bool>

Source

pub async fn remove_policy( &self, enforcer_name: String, policy: &CasbinRule, ) -> SdkResult<bool>

Source

pub async fn update_policy( &self, enforcer_name: String, old_policy: &CasbinRule, new_policy: &CasbinRule, ) -> SdkResult<bool>

Source

pub async fn get_permissions( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Permission>>

Source

pub async fn get_permissions_by_submitter( &self, ) -> SdkResult<QueryResult<Permission>>

Source

pub async fn get_permissions_by_role( &self, role_name: &str, ) -> SdkResult<QueryResult<Permission>>

Source

pub async fn get_roles( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Role>>

Source

pub async fn get_roles_by_user(&self, user_id: &str) -> SdkResult<Vec<String>>

Source§

impl Sdk

Source

pub async fn get_certs( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Cert>>

Source

pub async fn get_global_certs( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Cert>>

Source§

impl Sdk

Source

pub async fn get_default_organization( &self, name: String, ) -> SdkResult<Option<Organization>>

Source

pub async fn get_organizations( &self, query_args: OrganizationQueryArgs, ) -> SdkResult<QueryResult<Organization>>

Source

pub async fn get_organization_names(&self) -> SdkResult<Vec<Organization>>

NOTE: Only obtain fields name and display_name of Organization.

Source§

impl Sdk

Source

pub async fn get_providers( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Provider>>

Source

pub async fn get_global_providers( &self, query_args: QueryArgs, ) -> SdkResult<QueryResult<Provider>>

Source§

impl Sdk

Source

pub fn new(config: Config) -> Self

Source

pub fn id(&self, name: &str) -> String

Source

pub fn user_id_query(&self, user_name: &str) -> String

Source

pub async fn request<Data, Data2>( &self, method: Method, url_path: impl AsRef<str>, body: Body<'_, impl Serialize>, ) -> SdkResult<ApiResponse<Data, Data2>>
where Data: DeserializeOwned, Data2: DeserializeOwned,

Source

pub async fn request_data<Data>( &self, method: Method, url_path: impl AsRef<str>, body: Body<'_, impl Serialize>, ) -> SdkResult<ApiResponse<Data, ()>>
where Data: DeserializeOwned,

Source

pub async fn request_data2<Data2>( &self, method: Method, url_path: impl AsRef<str>, body: Body<'_, impl Serialize>, ) -> SdkResult<ApiResponse<(), Data2>>
where Data2: DeserializeOwned,

Source

pub async fn modify_model<T: Model>( &self, args: ModelModifyArgs<T>, ) -> SdkResult<bool>

Source

pub async fn add_model<T: Model>( &self, args: ModelAddArgs<T>, ) -> SdkResult<bool>

Source

pub async fn update_model<T: Model>( &self, args: ModelUpdateArgs<T>, ) -> SdkResult<bool>

Source

pub async fn delete_model<T: Model>( &self, args: ModelDeleteArgs<T>, ) -> SdkResult<bool>

Source

pub async fn get_model_by_name<M: Model>( &self, name: String, ) -> Result<Option<M>, SdkError>

Source

pub async fn get_default_model<M: Model>( &self, name: String, ) -> Result<Option<M>, SdkError>

Source

pub fn get_url_path( &self, ident: impl Into<String>, add_owner_query: bool, query_args: impl Serialize, ) -> SdkResult<String>

Source

pub fn get_url_query_part( &self, add_owner_query: bool, query_args: impl Serialize, ) -> SdkResult<String>

Source§

impl Sdk

Source

pub async fn get_users( &self, query_args: UserQueryArgs, ) -> SdkResult<QueryResult<User>>

Query and return some models and the total number of models.

Source

pub async fn get_user_groups( &self, query_args: UserGroupQueryArgs, ) -> SdkResult<QueryResult<UserGroup>>

Source

pub async fn get_user_count(&self, is_online: QueryUserSet) -> SdkResult<i64>

Source

pub async fn get_user(&self, args: GetUserArgs) -> SdkResult<Option<User>>

Source

pub async fn get_user_by_email(&self, email: String) -> SdkResult<Option<User>>

Source

pub async fn get_user_by_phone(&self, phone: String) -> SdkResult<Option<User>>

Source

pub async fn get_user_by_user_id( &self, user_id: String, ) -> SdkResult<Option<User>>

Source

pub async fn set_user_password(&self, args: SetPasswordArgs) -> SdkResult<()>

NOTE: oldPassword is not required, if you don’t need, just pass a empty string

Methods from Deref<Target = Config>§

Trait Implementations§

Source§

impl Clone for Sdk

Source§

fn clone(&self) -> Sdk

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sdk

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for Sdk

Source§

type Target = Config

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Sdk

§

impl RefUnwindSafe for Sdk

§

impl Send for Sdk

§

impl Sync for Sdk

§

impl Unpin for Sdk

§

impl UnwindSafe for Sdk

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T