kadmin::kadmin

Trait KAdminImpl

Source
pub trait KAdminImpl {
Show 14 methods // Required methods fn get_principal(&self, name: &str) -> Result<Option<Principal>>; fn principal_change_password( &self, name: &str, password: &str, ) -> Result<()>; fn list_principals(&self, query: Option<&str>) -> Result<Vec<String>>; fn add_policy(&self, builder: &PolicyBuilder) -> Result<()>; fn modify_policy(&self, modifier: &PolicyModifier) -> Result<()>; fn delete_policy(&self, name: &str) -> Result<()>; fn get_policy(&self, name: &str) -> Result<Option<Policy>>; fn list_policies(&self, query: Option<&str>) -> Result<Vec<String>>; // Provided methods fn add_principal() { ... } fn delete_principal() { ... } fn modify_principal() { ... } fn rename_principal() { ... } fn principal_exists(&self, name: &str) -> Result<bool> { ... } fn policy_exists(&self, name: &str) -> Result<bool> { ... }
}
Expand description

Common methods for KAdmin implementations

Required Methods§

Source

fn get_principal(&self, name: &str) -> Result<Option<Principal>>

Retrieve a principal

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
let princname = String::from("user@EXAMPLE.ORG");
let principal = kadm.get_principal(&princname).unwrap();
assert!(principal.is_some());
Source

fn principal_change_password(&self, name: &str, password: &str) -> Result<()>

Change a principal password

Don’t use this method directly. Instead, use Principal::change_password

Source

fn list_principals(&self, query: Option<&str>) -> Result<Vec<String>>

List principals

query is a shell-style glob expression that can contain the wild-card characters ?, *, and []. All principal names matching the expression are retuned. If the expression does not contain an @ character, an @ character followed by the local realm is appended to the expression. If no query is provided, all principals are returned.

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
for princ in kadm.list_principals(None).unwrap() {
    println!("{princ}");
}
Source

fn add_policy(&self, builder: &PolicyBuilder) -> Result<()>

Add a policy

Don’t use this method directly. Instead, use a PolicyBuilder

Source

fn modify_policy(&self, modifier: &PolicyModifier) -> Result<()>

Modify a policy

Don’t use this method directly. Instead, use a PolicyModifier, via Policy::modifier

Source

fn delete_policy(&self, name: &str) -> Result<()>

Delete a policy

Policy::delete is also available

Source

fn get_policy(&self, name: &str) -> Result<Option<Policy>>

Retrieve a policy

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
let polname = String::from("mypol");
let policy = kadm.get_policy(&polname).unwrap();
assert!(policy.is_some());
Source

fn list_policies(&self, query: Option<&str>) -> Result<Vec<String>>

List policies

query is a shell-style glob expression that can contain the wild-card characters ?, *, and []. All policy names matching the expression are returned. If no query is provided, all existing policy names are returned.

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
for princ in kadm.list_principals(None).unwrap() {
    println!("{princ}");
}

Provided Methods§

Source

fn add_principal()

Create a principal. Not yet implemented

Source

fn delete_principal()

Delete a principal. Not yet implemented

Source

fn modify_principal()

Modify a principal. Not yet implemented

Source

fn rename_principal()

Rename a principal. Not yet implemented

Source

fn principal_exists(&self, name: &str) -> Result<bool>

Check if a principal exists

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
let princname = String::from("user@EXAMPLE.ORG");
assert!(kadm.principal_exists(&princname).unwrap());
Source

fn policy_exists(&self, name: &str) -> Result<bool>

Check if a policy exists

let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
let polname = String::from("mypol");
assert!(kadm.policy_exists(&polname).unwrap());

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl KAdminImpl for kadmin::sync::KAdmin

Source§

impl KAdminImpl for kadmin::kadmin::KAdmin