From 7577703d644ead8ab630c5d87e40d2665febf890 Mon Sep 17 00:00:00 2001 From: Lenin Alevski Date: Tue, 8 Dec 2020 22:10:43 -0600 Subject: [PATCH] Fix operator login acl regression (#492) * Fix operator login acl regression * wip --- pkg/acl/endpoints.go | 5 +---- pkg/acl/endpoints_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/acl/endpoints.go b/pkg/acl/endpoints.go index 001c22df0..025c5d24d 100644 --- a/pkg/acl/endpoints.go +++ b/pkg/acl/endpoints.go @@ -284,12 +284,9 @@ func GetAuthorizedEndpoints(actions []string) []string { rangeTake = operatorRules } - if len(actions) == 0 { - return []string{} - } // Prepare new ActionSet structure that will hold all the user actions userAllowedAction := actionsStringToActionSet(actions) - allowedEndpoints := []string{} + var allowedEndpoints []string for endpoint, rules := range rangeTake { // check if user policy matches s3:* or admin:* typesIntersection endpointActionTypes := rules.actionTypes diff --git a/pkg/acl/endpoints_test.go b/pkg/acl/endpoints_test.go index dd333771c..09882f743 100644 --- a/pkg/acl/endpoints_test.go +++ b/pkg/acl/endpoints_test.go @@ -94,11 +94,11 @@ func TestGetAuthorizedEndpoints(t *testing.T) { want: 16, }, { - name: "no endpoints", + name: "Console User - default endpoints", args: args{ []string{}, }, - want: 0, + want: 5, }, } @@ -138,11 +138,11 @@ func TestOperatorOnlyEndpoints(t *testing.T) { want: 2, }, { - name: "Operator Only - no endpoints", + name: "Operator Only - default endpoints", args: args{ []string{}, }, - want: 0, + want: 2, }, }