Skip to content

Commit

Permalink
Fix incorrect apigroup on managedclusterview check (#291)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Padilla <jpadilla@redhat.com>
  • Loading branch information
jlpadilla authored Dec 4, 2024
1 parent 3862b00 commit dac6825
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/rbac/userData.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (user *UserDataCache) getSSRRforNamespace(ctx context.Context, cache *Cache
// Equivalent to: oc auth can-i create ManagedClusterView -n <managedClusterName> --as=<user>
if verb == "create" || verb == "*" {
for _, group := range rule.APIGroups {
if group == "cluster.open-cluster-management.io" || group == "*" {
if group == "view.open-cluster-management.io" || group == "*" {
for _, res := range rule.Resources {
if res == "managedclusterviews" || res == "*" {
user.updateUserManagedClusterList(cache, ns)
Expand Down
8 changes: 4 additions & 4 deletions pkg/rbac/userData_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func Test_managedClusters_emptyCache(t *testing.T) {
ResourceRules: []authz.ResourceRule{
{
Verbs: []string{"create"},
APIGroups: []string{"cluster.open-cluster-management.io"},
APIGroups: []string{"view.open-cluster-management.io"},
Resources: []string{"managedclusterviews"},
},
},
Expand All @@ -398,7 +398,7 @@ func Test_managedClusters_emptyCache(t *testing.T) {
ResourceRules: []authz.ResourceRule{
{
Verbs: []string{"list"},
APIGroups: []string{"cluster.open-cluster-management.io"},
APIGroups: []string{"view.open-cluster-management.io"},
Resources: []string{"managedclusterviews"},
},
},
Expand Down Expand Up @@ -497,7 +497,7 @@ func Test_managedCluster_expiredCache(t *testing.T) {
ResourceRules: []authz.ResourceRule{
{
Verbs: []string{"create"},
APIGroups: []string{"cluster.open-cluster-management.io"},
APIGroups: []string{"view.open-cluster-management.io"},
Resources: []string{"managedclusterviews"},
},
},
Expand All @@ -511,7 +511,7 @@ func Test_managedCluster_expiredCache(t *testing.T) {
ResourceRules: []authz.ResourceRule{
{
Verbs: []string{"list"},
APIGroups: []string{"cluster.open-cluster-management.io"},
APIGroups: []string{"view.open-cluster-management.io"},
Resources: []string{"managedclusterviews"},
},
},
Expand Down

0 comments on commit dac6825

Please sign in to comment.