Skip to content

Commit

Permalink
SMQ-2682 - Fix incorrectly referenced field name (#2725)
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
  • Loading branch information
nyagamunene authored Feb 20, 2025
1 parent 72c762f commit eaaba5b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/roles/repo/postgres/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,10 @@ func (repo *Repository) RoleListActions(ctx context.Context, roleID string) ([]s
}

func (repo *Repository) RoleCheckActionsExists(ctx context.Context, roleID string, actions []string) (bool, error) {
q := fmt.Sprintf(`SELECT COUNT(*) FROM %s_role_actions WHERE role_id = :role_id AND action IN (:actions)`, repo.tableNamePrefix)
q := fmt.Sprintf(`SELECT COUNT(*) FROM %s_role_actions WHERE role_id = :role_id AND action IN ('%s')`, repo.tableNamePrefix, strings.Join(actions, ","))

params := map[string]interface{}{
"role_id": roleID,
"actions": actions,
}
var count int
query, err := repo.db.NamedQueryContext(ctx, q, params)
Expand Down Expand Up @@ -639,11 +638,10 @@ func (repo *Repository) RoleListMembers(ctx context.Context, roleID string, limi
}

func (repo *Repository) RoleCheckMembersExists(ctx context.Context, roleID string, members []string) (bool, error) {
q := fmt.Sprintf(`SELECT COUNT(*) FROM %s_role_members WHERE role_id = :role_id AND action IN (:members)`, repo.tableNamePrefix)
q := fmt.Sprintf(`SELECT COUNT(*) FROM %s_role_members WHERE role_id = :role_id AND member_id IN ('%s')`, repo.tableNamePrefix, strings.Join(members, ","))

params := map[string]interface{}{
"role_id": roleID,
"members": members,
}
var count int
query, err := repo.db.NamedQueryContext(ctx, q, params)
Expand Down

0 comments on commit eaaba5b

Please # to comment.