Skip to content

Commit

Permalink
Merge pull request #12470 from tharikaGitHub/patch-master-fixes
Browse files Browse the repository at this point in the history
Fix multi group sharing issue
  • Loading branch information
tharikaGitHub committed Jun 26, 2024
2 parents 7bffe83 + 6363447 commit ed58c3a
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6251,18 +6251,16 @@ public Application getApplicationByName(String applicationName, String userId, S
+ " AND LOWER(SUB.USER_ID) = LOWER(?))) AND "
+ "APP.NAME = ? AND SUB.SUBSCRIBER_ID = APP.SUBSCRIBER_ID";

String whereClauseWithMultiGroupId = " WHERE ((APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM " +
"AM_APPLICATION_GROUP_MAPPING WHERE GROUP_ID IN ($params) AND TENANT = ?)) OR SUB.USER_ID = ? " +
String whereClauseWithMultiGroupId = " WHERE (((APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM " +
"AM_APPLICATION_GROUP_MAPPING WHERE GROUP_ID IN ($params) AND TENANT = ?)) " +
"OR (APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM AM_APPLICATION WHERE GROUP_ID = ?))) " +
"AND APP.NAME = ? AND SUB.SUBSCRIBER_ID = APP.SUBSCRIBER_ID";
"AND SUB.USER_ID = ?) AND APP.NAME = ? AND SUB.SUBSCRIBER_ID = APP.SUBSCRIBER_ID";
String whereClauseWithMultiGroupIdCaseInSensitive =
" WHERE ((APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM "
+ "AM_APPLICATION_GROUP_MAPPING WHERE GROUP_ID IN ($params) AND TENANT = ?)) "
+ "OR LOWER(SUB.USER_ID) = LOWER(?) "
+ "OR (APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM AM_APPLICATION WHERE GROUP_ID = " +
"?))) "
+ "AND APP.NAME = ? AND SUB.SUBSCRIBER_ID = APP.SUBSCRIBER_ID";

" WHERE (((APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM "
+ "AM_APPLICATION_GROUP_MAPPING WHERE GROUP_ID IN ($params) AND TENANT = ?)) "
+ "OR (APP.APPLICATION_ID IN (SELECT APPLICATION_ID FROM AM_APPLICATION WHERE GROUP_ID = ?))) "
+ "AND LOWER(SUB.USER_ID) = LOWER(?)) AND APP.NAME = ? AND SUB.SUBSCRIBER_ID = APP.SUBSCRIBER_ID";

if (groupId != null && !"null".equals(groupId) && !groupId.isEmpty()) {
if (multiGroupAppSharingEnabled) {
Subscriber subscriber = getSubscriber(userId);
Expand All @@ -6277,8 +6275,8 @@ public Application getApplicationByName(String applicationName, String userId, S

prepStmt = fillQueryParams(connection, query, groupIds, 1);
prepStmt.setString(++parameterIndex, tenantDomain);
prepStmt.setString(++parameterIndex, userId);
prepStmt.setString(++parameterIndex, tenantDomain + '/' + groupId);
prepStmt.setString(++parameterIndex, userId);
prepStmt.setString(++parameterIndex, applicationName);
} else {
if (forceCaseInsensitiveComparisons) {
Expand Down

0 comments on commit ed58c3a

Please sign in to comment.