kanidm_client/
system.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::{ClientError, KanidmClient};

impl KanidmClient {
    pub async fn system_password_badlist_get(&self) -> Result<Vec<String>, ClientError> {
        let list: Option<Vec<String>> = self
            .perform_get_request("/v1/system/_attr/badlist_password")
            .await?;
        Ok(list.unwrap_or_default())
    }

    pub async fn system_password_badlist_append(
        &self,
        list: Vec<String>,
    ) -> Result<(), ClientError> {
        self.perform_post_request("/v1/system/_attr/badlist_password", list)
            .await
    }

    pub async fn system_password_badlist_remove(
        &self,
        list: Vec<String>,
    ) -> Result<(), ClientError> {
        self.perform_delete_request_with_body("/v1/system/_attr/badlist_password", list)
            .await
    }

    pub async fn system_denied_names_get(&self) -> Result<Vec<String>, ClientError> {
        let list: Option<Vec<String>> = self
            .perform_get_request("/v1/system/_attr/denied_name")
            .await?;
        Ok(list.unwrap_or_default())
    }

    pub async fn system_denied_names_append(&self, list: &Vec<String>) -> Result<(), ClientError> {
        self.perform_post_request("/v1/system/_attr/denied_name", list)
            .await
    }

    pub async fn system_denied_names_remove(&self, list: &Vec<String>) -> Result<(), ClientError> {
        self.perform_delete_request_with_body("/v1/system/_attr/denied_name", list)
            .await
    }
}