Fix indempotence issue with policy attach
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
268f9a47cd
commit
765a8108fd
@ -531,6 +531,15 @@ impl MinioService {
|
|||||||
|
|
||||||
/// Attach a user to a policy
|
/// Attach a user to a policy
|
||||||
pub async fn policy_attach_user(&self, user: &MinioUser, policy: &str) -> anyhow::Result<()> {
|
pub async fn policy_attach_user(&self, user: &MinioUser, policy: &str) -> anyhow::Result<()> {
|
||||||
|
// Check if the policy has already been attached to the user
|
||||||
|
if self
|
||||||
|
.policy_attach_get_user_list(user)
|
||||||
|
.await?
|
||||||
|
.contains(&policy.to_string())
|
||||||
|
{
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let res = self
|
let res = self
|
||||||
.exec_mc_cmd::<BasicMinioResult>(&[
|
.exec_mc_cmd::<BasicMinioResult>(&[
|
||||||
"admin",
|
"admin",
|
||||||
|
Loading…
Reference in New Issue
Block a user