mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-06-13 23:36:45 +03:00
7b44cf5627
* fix(iam): implement CreatePolicyVersion for managed policies The AWS Terraform provider updates a managed policy in place via CreatePolicyVersion, which returned 501 NotImplemented and broke terraform apply on any policy change. Implement CreatePolicyVersion (plus ListPolicyVersions, GetPolicyVersion and DeletePolicyVersion) on both the standalone IAM server and the embedded S3 IAM API. Managed policies keep a single current document, so each is modeled as one default version "v1": CreatePolicyVersion replaces the document, List/GetPolicyVersion expose it, and DeletePolicyVersion rejects deleting the default. GetPolicy now reports DefaultVersionId so the provider's read can fetch the document. The standalone path also refreshes the cached Identity.Actions of every identity the policy is attached to so the new document takes effect. * fix(iam): reject CreatePolicyVersion unless SetAsDefault=true With a single always-default managed-policy version, a request with SetAsDefault=false (or omitted) would stage a non-default version on AWS but here silently replaced the active document. Reject it on both the standalone and embedded paths. Isolate the new policy-version tests from the shared package fixtures so they stay order-independent, and assert IsDefaultVersion on the response.
61 lines
3.4 KiB
Go
61 lines
3.4 KiB
Go
package iamapi
|
|
|
|
// This file re-exports IAM response types from the shared weed/iam package
|
|
// for backwards compatibility with existing code.
|
|
|
|
import (
|
|
iamlib "github.com/seaweedfs/seaweedfs/weed/iam"
|
|
)
|
|
|
|
// Type aliases for IAM response types from shared package
|
|
type (
|
|
CommonResponse = iamlib.CommonResponse
|
|
ListUsersResponse = iamlib.ListUsersResponse
|
|
ListAccessKeysResponse = iamlib.ListAccessKeysResponse
|
|
DeleteAccessKeyResponse = iamlib.DeleteAccessKeyResponse
|
|
CreatePolicyResponse = iamlib.CreatePolicyResponse
|
|
CreateUserResponse = iamlib.CreateUserResponse
|
|
DeleteUserResponse = iamlib.DeleteUserResponse
|
|
GetUserResponse = iamlib.GetUserResponse
|
|
UpdateUserResponse = iamlib.UpdateUserResponse
|
|
CreateAccessKeyResponse = iamlib.CreateAccessKeyResponse
|
|
UpdateAccessKeyResponse = iamlib.UpdateAccessKeyResponse
|
|
PutUserPolicyResponse = iamlib.PutUserPolicyResponse
|
|
DeleteUserPolicyResponse = iamlib.DeleteUserPolicyResponse
|
|
GetUserPolicyResponse = iamlib.GetUserPolicyResponse
|
|
ListUserPoliciesResponse = iamlib.ListUserPoliciesResponse
|
|
GetPolicyResponse = iamlib.GetPolicyResponse
|
|
DeletePolicyResponse = iamlib.DeletePolicyResponse
|
|
ListPoliciesResponse = iamlib.ListPoliciesResponse
|
|
ListPolicyVersionsResponse = iamlib.ListPolicyVersionsResponse
|
|
GetPolicyVersionResponse = iamlib.GetPolicyVersionResponse
|
|
CreatePolicyVersionResponse = iamlib.CreatePolicyVersionResponse
|
|
DeletePolicyVersionResponse = iamlib.DeletePolicyVersionResponse
|
|
AttachUserPolicyResponse = iamlib.AttachUserPolicyResponse
|
|
DetachUserPolicyResponse = iamlib.DetachUserPolicyResponse
|
|
ListAttachedUserPoliciesResponse = iamlib.ListAttachedUserPoliciesResponse
|
|
ErrorResponse = iamlib.ErrorResponse
|
|
ServiceAccountInfo = iamlib.ServiceAccountInfo
|
|
CreateServiceAccountResponse = iamlib.CreateServiceAccountResponse
|
|
DeleteServiceAccountResponse = iamlib.DeleteServiceAccountResponse
|
|
ListServiceAccountsResponse = iamlib.ListServiceAccountsResponse
|
|
GetServiceAccountResponse = iamlib.GetServiceAccountResponse
|
|
UpdateServiceAccountResponse = iamlib.UpdateServiceAccountResponse
|
|
// Group response types
|
|
CreateGroupResponse = iamlib.CreateGroupResponse
|
|
DeleteGroupResponse = iamlib.DeleteGroupResponse
|
|
UpdateGroupResponse = iamlib.UpdateGroupResponse
|
|
GetGroupResponse = iamlib.GetGroupResponse
|
|
ListGroupsResponse = iamlib.ListGroupsResponse
|
|
AddUserToGroupResponse = iamlib.AddUserToGroupResponse
|
|
RemoveUserFromGroupResponse = iamlib.RemoveUserFromGroupResponse
|
|
AttachGroupPolicyResponse = iamlib.AttachGroupPolicyResponse
|
|
DetachGroupPolicyResponse = iamlib.DetachGroupPolicyResponse
|
|
ListAttachedGroupPoliciesResponse = iamlib.ListAttachedGroupPoliciesResponse
|
|
PutGroupPolicyResponse = iamlib.PutGroupPolicyResponse
|
|
GetGroupPolicyResponse = iamlib.GetGroupPolicyResponse
|
|
DeleteGroupPolicyResponse = iamlib.DeleteGroupPolicyResponse
|
|
ListGroupPoliciesResponse = iamlib.ListGroupPoliciesResponse
|
|
ListGroupsForUserResponse = iamlib.ListGroupsForUserResponse
|
|
)
|