Skip to content

Commit

Permalink
MinioAdmin: conditionally decrypt response in {attach,detach}_policy …
Browse files Browse the repository at this point in the history
…APIs (#1472)

Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana authored Jan 8, 2025
1 parent 06c7dd8 commit 6425726
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion minio/minioadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,21 @@ def _attach_detach_policy(
"POST",
command,
body=encrypt(body, self._provider.retrieve().secret_key),
preload_content=False,
)
return response.data.decode()
if (
command in [
_COMMAND.IDP_BUILTIN_POLICY_ATTACH,
_COMMAND.IDP_BUILTIN_POLICY_DETACH,
] and
response.status in [201, 204]
):
# Older MinIO servers do not return response.
response.close()
response.release_conn()
return ""
data = decrypt(response, self._provider.retrieve().secret_key)
return data.decode()
raise ValueError("either user or group must be set")

def attach_policy_ldap(
Expand Down

0 comments on commit 6425726

Please sign in to comment.