User Management
The Rust SDK lets you create users, assign them roles and associated privileges, and remove them from the system.
User-Management APIs
Users who have been assigned the Admin role for the cluster are able to create, edit, and remove users. The SDK lets you programmatically create users, assign them roles and associated privileges, and remove them from the system.
Using the UserManager API
The most common uses of the UserManager API are administering users:
Upserting Users
let mgr = cluster.users();
mgr.upsert_user(
User::new("example-user", "display-name", vec![Role::new("admin")]).password("password"),
None,
)
.await?;
Listing Users
let mgr = cluster.users();
let users = mgr.get_all_users(None).await?;
Removing Users
let mgr = cluster.users();
mgr.drop_user("example-user", None).await?;
Changing a password
let mgr = cluster.users();
mgr.change_password("new-password", None).await?;
change_password applies to the user currently authenticated in the Cluster instance.
|
Further Reading
The SDK also contains management APIs for dealing with Cluster resources.