diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index a8d75c094..7cd420ca7 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -1956,7 +1956,7 @@ func (a adminAPIHandlers) DetachPolicyBuiltin(w http.ResponseWriter, r *http.Req UserOrGroup: userOrGroup, UserType: int(userType), IsGroup: isGroup, - Policy: strings.Join(policiesToDetach, ","), + Policy: newPolicies, }, UpdatedAt: updatedAt, })) diff --git a/cmd/peer-s3-client.go b/cmd/peer-s3-client.go index 5c14523ba..2087d2209 100644 --- a/cmd/peer-s3-client.go +++ b/cmd/peer-s3-client.go @@ -167,7 +167,7 @@ func (sys *S3PeerSys) GetBucketInfo(ctx context.Context, bucket string, opts Buc quorum := (len(sys.allPeerClients) / 2) if err = reduceReadQuorumErrs(ctx, errs, bucketOpIgnoredErrs, quorum); err != nil { - return BucketInfo{}, err + return BucketInfo{}, toObjectErr(err, bucket) } for i, err := range errs { @@ -266,12 +266,9 @@ func (sys *S3PeerSys) DeleteBucket(ctx context.Context, bucket string, opts Dele errs := g.Wait() errs = append(errs, deleteBucketLocal(ctx, bucket, opts)) - for _, err := range errs { - if err != nil { - return err - } - } - return nil + quorum := (len(sys.allPeerClients) / 2) + 1 + err := reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, quorum) + return toObjectErr(err, bucket) } // DeleteBucket deletes bucket on a peer diff --git a/docs/bucket/replication/setup_replication.sh b/docs/bucket/replication/setup_replication.sh index 0db50b370..d9b5803eb 100755 --- a/docs/bucket/replication/setup_replication.sh +++ b/docs/bucket/replication/setup_replication.sh @@ -38,11 +38,11 @@ cat > repladmin-policy-source.json < replpolicy.json </dev/null 2>&1 diff --git a/docs/site-replication/run-multi-site-minio-idp.sh b/docs/site-replication/run-multi-site-minio-idp.sh index 5ba8810a3..529d010dd 100755 --- a/docs/site-replication/run-multi-site-minio-idp.sh +++ b/docs/site-replication/run-multi-site-minio-idp.sh @@ -61,14 +61,14 @@ export MC_HOST_minio3=http://minio:minio123@localhost:9003 ## add foobar-g group with foobar ./mc admin group add minio2 foobar-g foobar -./mc admin policy set minio1 consoleAdmin user=foobar +./mc admin policy attach minio1 consoleAdmin --user=foobar sleep 5 ./mc admin user info minio2 foobar ./mc admin group info minio1 foobar-g -./mc admin policy add minio1 rw ./docs/site-replication/rw.json +./mc admin policy create minio1 rw ./docs/site-replication/rw.json sleep 5 ./mc admin policy info minio2 rw >/dev/null 2>&1 @@ -299,7 +299,7 @@ if [ $? -ne 0 ]; then echo "adding user failed, exiting.." exit_1; fi -./mc admin policy set minio1 consoleAdmin user=foobarx +./mc admin policy attach minio1 consoleAdmin --user=foobarx if [ $? -ne 0 ]; then echo "adding policy mapping failed, exiting.." exit_1; @@ -307,7 +307,7 @@ fi sleep 10 # unset policy for foobarx in minio2 -./mc admin policy unset minio2 consoleAdmin user=foobarx +./mc admin policy detach minio2 consoleAdmin --user=foobarx if [ $? -ne 0 ]; then echo "unset policy mapping failed, exiting.." exit_1; @@ -318,10 +318,10 @@ fi sleep 10 -# Test whether policy unset replicated to minio1 +# Test whether policy detach replicated to minio1 policy=$(./mc admin user info minio1 foobarx --json | jq -r .policyName) if [ "${policy}" != "null" ]; then - echo "expected policy unset to have replicated, exiting..." + echo "expected policy detach to have replicated, exiting..." exit_1; fi diff --git a/docs/site-replication/run-multi-site-oidc.sh b/docs/site-replication/run-multi-site-oidc.sh index 2255bae6a..ff0b04f81 100755 --- a/docs/site-replication/run-multi-site-oidc.sh +++ b/docs/site-replication/run-multi-site-oidc.sh @@ -65,7 +65,7 @@ export MC_HOST_minio3=http://minio:minio123@localhost:9003 ./mc admin replicate add minio1 minio2 minio3 -./mc admin policy add minio1 projecta ./docs/site-replication/rw.json +./mc admin policy create minio1 projecta ./docs/site-replication/rw.json sleep 5 ./mc admin policy info minio2 projecta >/dev/null 2>&1 @@ -94,7 +94,7 @@ if [ $? -eq 0 ]; then exit_1; fi -./mc admin policy add minio1 projecta ./docs/site-replication/rw.json +./mc admin policy create minio1 projecta ./docs/site-replication/rw.json sleep 5 # Generate STS credential with STS call to minio1 diff --git a/docs/sts/dex.md b/docs/sts/dex.md index 507385861..e2439b0e0 100644 --- a/docs/sts/dex.md +++ b/docs/sts/dex.md @@ -39,7 +39,7 @@ time="2020-07-12T20:45:50Z" level=info msg="listening (http) on 0.0.0.0:5556" ``` ``` -~ mc admin policy add admin allaccess.json +~ mc admin policy create admin allaccess.json ``` Contents of `allaccess.json` @@ -95,7 +95,7 @@ Now you have successfully configured Dex IdP with MinIO. export MINIO_IDENTITY_OPENID_CLAIM_NAME=groups ``` -and add relevant policies on MinIO using `mc admin policy add myminio/ group-access.json` +and add relevant policies on MinIO using `mc admin policy create myminio/ group-access.json` ## Explore Further diff --git a/docs/sts/ldap.md b/docs/sts/ldap.md index b30e2a085..678dbfa12 100644 --- a/docs/sts/ldap.md +++ b/docs/sts/ldap.md @@ -153,7 +153,7 @@ In the configuration variables, `%s` is substituted with the _username_ from the Access policies may be associated by their name with a group or user directly. Access policies are first defined on the MinIO server using IAM policy JSON syntax. To define a new policy, you can use the [AWS policy generator](https://awspolicygen.s3.amazonaws.com/policygen.html). Copy the policy into a text file `mypolicy.json` and issue the command like so: ```sh -mc admin policy add myminio mypolicy mypolicy.json +mc admin policy create myminio mypolicy mypolicy.json ``` To associate the policy with an LDAP user or group, use the full DN of the user or group: @@ -163,7 +163,7 @@ mc admin idp ldap policy attach myminio mypolicy --user='uid=james,cn=accounts,d ``` ```sh -mc admin idp ldap policy attach myminio mypolicy --group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' +mc admin idp ldap policy attach myminio mypolicy ----group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' ``` To remove a policy association, use the similar `detach` command: @@ -173,7 +173,7 @@ mc admin idp ldap policy detach myminio mypolicy --user='uid=james,cn=accounts,d ``` ```sh -mc admin idp ldap policy detach myminio mypolicy --group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' +mc admin idp ldap policy detach myminio mypolicy ----group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' ``` @@ -184,12 +184,12 @@ Note that the commands above attempt to validate if the given entity (user or gr Please **do not use** these as they may be removed or their behavior may change. ```sh -mc admin policy set myminio mypolicy user='uid=james,cn=accounts,dc=myldapserver,dc=com' +mc admin policy attach myminio mypolicy --user='uid=james,cn=accounts,dc=myldapserver,dc=com' ``` ```sh -mc admin policy set myminio mypolicy group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' +mc admin policy attach myminio mypolicy --group='cn=projectx,ou=groups,ou=hwengg,dc=min,dc=io' ``` diff --git a/helm/minio/templates/_helper_create_policy.txt b/helm/minio/templates/_helper_create_policy.txt index d565b161e..aa584952f 100644 --- a/helm/minio/templates/_helper_create_policy.txt +++ b/helm/minio/templates/_helper_create_policy.txt @@ -55,7 +55,7 @@ createPolicy () { else echo "Policy '$NAME' already exists." fi - ${MC} admin policy add myminio $NAME /config/$FILENAME.json + ${MC} admin policy create myminio $NAME /config/$FILENAME.json } @@ -72,4 +72,4 @@ connectToMinio $scheme {{- range $idx, $policy := .Values.policies }} createPolicy {{ $policy.name }} policy_{{ $idx }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/helm/minio/templates/_helper_create_user.txt b/helm/minio/templates/_helper_create_user.txt index 324bc9d48..6c11c14a3 100644 --- a/helm/minio/templates/_helper_create_user.txt +++ b/helm/minio/templates/_helper_create_user.txt @@ -73,7 +73,7 @@ createUser() { # set policy for user if [ ! -z $POLICY -a $POLICY != " " ] ; then echo "Adding policy '$POLICY' for '$USER'" - ${MC} admin policy set myminio $POLICY user=$USER + ${MC} admin policy attach myminio $POLICY --user=$USER else echo "User '$USER' has no policy attached." fi diff --git a/helm/minio/values.yaml b/helm/minio/values.yaml index 108355add..ef5cb0151 100644 --- a/helm/minio/values.yaml +++ b/helm/minio/values.yaml @@ -433,7 +433,7 @@ makeBucketJob: ## List of command to run after minio install ## NOTE: the mc command TARGET is always "myminio" customCommands: - # - command: "admin policy set myminio consoleAdmin group='cn=ops,cn=groups,dc=example,dc=com'" + # - command: "admin policy attach myminio consoleAdmin --group='cn=ops,cn=groups,dc=example,dc=com'" ## Additional Annotations for the Kubernetes Job customCommandJob customCommandJob: