Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Fix SQL query used to fetch delegate roles + resource servers in FetchRoles to return unique RS URLs #361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/iudx/aaa/server/apiserver/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public class Constants {
+ " GROUP BY roles.role";

public static final String SQL_GET_DELEGATE_ROLE =
"SELECT 'DELEGATE'::text AS role, array_agg(url) AS rs_urls FROM delegations"
"SELECT 'DELEGATE'::text AS role, array_agg(DISTINCT url) AS rs_urls FROM delegations"
+ " JOIN roles ON delegations.role_id = roles.id"
+ " JOIN resource_server on roles.resource_server_id = resource_server.id"
+ " WHERE delegations.user_id = $1::uuid AND delegations.status = 'ACTIVE' HAVING array_agg(url) <> '{}'";
+ " WHERE delegations.user_id = $1::uuid AND delegations.status = 'ACTIVE' HAVING array_agg(DISTINCT url) <> '{}'";

public static final String SQL_GET_ADMIN_ROLE =
"SELECT 'ADMIN'::text AS role, array_agg(url) AS rs_urls"
Expand Down