Skip to content

Commit

Permalink
fix(cli): argocd CLI RBAC validation doesn't work on actions (#13911) (
Browse files Browse the repository at this point in the history
…#14578) (#14582)

* #11602 fix : Object options menu truncated when selected in ApplicationListView.



* #11602 fix : Object options menu truncated when selected in ApplicationListView.



* changes for argocd_rbac



---------

Signed-off-by: schakradari <[email protected]>
Signed-off-by: schakrad <[email protected]>
Co-authored-by: schakrad <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
  • Loading branch information
3 people authored Jul 18, 2023
1 parent 7d67b4d commit 62e9973
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/argocd/commands/admin/settings_rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"

"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -373,6 +374,9 @@ func resolveRBACResourceName(name string) string {

// isValidRBACAction checks whether a given action is a valid RBAC action
func isValidRBACAction(action string) bool {
if strings.HasPrefix(action, rbacpolicy.ActionAction+"/") {
return true
}
_, ok := validRBACActions[action]
return ok
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/argocd/commands/admin/settings_rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func Test_isValidRBACAction(t *testing.T) {
})
}

func Test_isValidRBACAction_ActionAction(t *testing.T) {
ok := isValidRBACAction("action/apps/Deployment/restart")
assert.True(t, ok)
}

func Test_isValidRBACResource(t *testing.T) {
for k := range validRBACResources {
t.Run(k, func(t *testing.T) {
Expand Down

0 comments on commit 62e9973

Please sign in to comment.