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§
Sourcefn get_principal(&self, name: &str) -> Result<Option<Principal>>
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());Sourcefn principal_change_password(&self, name: &str, password: &str) -> Result<()>
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
Sourcefn list_principals(&self, query: Option<&str>) -> Result<Vec<String>>
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}");
}Sourcefn add_policy(&self, builder: &PolicyBuilder) -> Result<()>
fn add_policy(&self, builder: &PolicyBuilder) -> Result<()>
Add a policy
Don’t use this method directly. Instead, use a PolicyBuilder
Sourcefn modify_policy(&self, modifier: &PolicyModifier) -> Result<()>
fn modify_policy(&self, modifier: &PolicyModifier) -> Result<()>
Modify a policy
Don’t use this method directly. Instead, use a PolicyModifier, via Policy::modifier
Sourcefn delete_policy(&self, name: &str) -> Result<()>
fn delete_policy(&self, name: &str) -> Result<()>
Delete a policy
Policy::delete is also available
Sourcefn get_policy(&self, name: &str) -> Result<Option<Policy>>
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());Sourcefn list_policies(&self, query: Option<&str>) -> Result<Vec<String>>
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§
Sourcefn add_principal()
fn add_principal()
Create a principal. Not yet implemented
Sourcefn delete_principal()
fn delete_principal()
Delete a principal. Not yet implemented
Sourcefn modify_principal()
fn modify_principal()
Modify a principal. Not yet implemented
Sourcefn rename_principal()
fn rename_principal()
Rename a principal. Not yet implemented
Sourcefn principal_exists(&self, name: &str) -> Result<bool>
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());Sourcefn policy_exists(&self, name: &str) -> Result<bool>
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.