Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinioAdmin: conditionally decrypt response in {attach,detach}_policy APIs #1472

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading