feat: add IAM export/import

- Add complete IAM configuration export/import functionality with ZIP format
- Add new API endpoints for IAM backup and restore operations
This commit is contained in:
weisd
2025-06-30 14:15:51 +08:00
committed by weisd
parent 8218070ebc
commit e9610f1fb7
11 changed files with 1060 additions and 11 deletions
+19
View File
@@ -5,6 +5,7 @@ use crate::error::{Error, Result};
use crate::manager::IamCache;
use crate::manager::extract_jwt_claims;
use crate::manager::get_default_policyes;
use crate::store::GroupInfo;
use crate::store::MappedPolicy;
use crate::store::Store;
use crate::store::UserType;
@@ -59,6 +60,10 @@ impl<T: Store> IamSys<T> {
self.store.group_notification_handler(name).await
}
pub async fn load_groups(&self, m: &mut HashMap<String, GroupInfo>) -> Result<()> {
self.store.api.load_groups(m).await
}
pub async fn load_policy(&self, name: &str) -> Result<()> {
self.store.policy_notification_handler(name).await
}
@@ -73,6 +78,11 @@ impl<T: Store> IamSys<T> {
self.store.user_notification_handler(name, user_type).await
}
pub async fn load_users(&self, user_type: UserType, m: &mut HashMap<String, UserIdentity>) -> Result<()> {
self.store.api.load_users(user_type, m).await?;
Ok(())
}
pub async fn load_service_account(&self, name: &str) -> Result<()> {
self.store.user_notification_handler(name, UserType::Svc).await
}
@@ -106,6 +116,15 @@ impl<T: Store> IamSys<T> {
})
}
pub async fn load_mapped_policys(
&self,
user_type: UserType,
is_group: bool,
m: &mut HashMap<String, MappedPolicy>,
) -> Result<()> {
self.store.api.load_mapped_policys(user_type, is_group, m).await
}
pub async fn list_polices(&self, bucket_name: &str) -> Result<HashMap<String, Policy>> {
self.store.list_polices(bucket_name).await
}