Skip to content

Commit

Permalink
Fix role validation by fetching all roles
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercreller committed Oct 8, 2024
1 parent 9bcd8ff commit b1381ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/role/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func ValidateRole(roleID string, conn *sdk.Connection) error {
availableRoles, err := GetRoles(conn)
availableRoles, err := GetAllRoles(conn)
if err != nil {
return fmt.Errorf("can't validate role : %v", err)
}
Expand All @@ -20,8 +20,8 @@ func ValidateRole(roleID string, conn *sdk.Connection) error {
return fmt.Errorf("role %s not found", roleID)
}

func GetRoles(conn *sdk.Connection) ([]*v1.Role, error) {
response, err := conn.AccountsMgmt().V1().Roles().List().Send()
func GetAllRoles(conn *sdk.Connection) ([]*v1.Role, error) {
response, err := conn.AccountsMgmt().V1().Roles().List().Size(-1).Send()

if err != nil {
return nil, fmt.Errorf("can't retrieve roles : %v", err)
Expand Down

0 comments on commit b1381ba

Please sign in to comment.