Skip to content

Commit

Permalink
Merge branch 'master' into DHIS2-18607_2.42
Browse files Browse the repository at this point in the history
  • Loading branch information
maikelarabori authored Dec 11, 2024
2 parents cf3f6b3 + 2c6105d commit 30bf46d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,6 @@ public void populateTable(AnalyticsTableUpdateParams params, AnalyticsTableParti
"""
\swhere te.trackedentitytypeid = ${tetId} \
and te.lastupdated < '${startTime}' \
and exists (select 1 from ${enrollment} en \
where en.trackedentityid = te.trackedentityid \
and exists (select 1 from ${event} ev \
where ev.enrollmentid = en.enrollmentid \
and ev.status in (${statuses}) \
and ev.deleted = false)) \
and te.created is not null \
and te.deleted = false""",
Map.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ public JdbcTrackedEntityEnrollmentsAnalyticsTableManager(
this.trackedEntityTypeService = trackedEntityTypeService;
}

/**
* Returns the {@link AnalyticsTableType} of analytics table which this manager handles.
*
* @return type of analytics table.
*/
@Override
public AnalyticsTableType getAnalyticsTableType() {
return TRACKED_ENTITY_INSTANCE_ENROLLMENTS;
Expand Down Expand Up @@ -239,10 +234,7 @@ public void populateTable(AnalyticsTableUpdateParams params, AnalyticsTableParti
and te.lastupdated < '${startTime}' \
left join ${program} p on en.programid=p.programid \
left join analytics_rs_orgunitstructure ous on en.organisationunitid=ous.organisationunitid \
where exists (select 1 from ${event} ev where ev.deleted = false \
and ev.enrollmentid = en.enrollmentid \
and ev.status in (${statuses})) \
and en.occurreddate is not null \
where en.occurreddate is not null \
and en.deleted = false\s""",
Map.of(
"trackedEntityTypeId", valueOf(tetId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ public JdbcTrackedEntityEventsAnalyticsTableManager(
this.analyticsSqlBuilder = analyticsSqlBuilder;
}

/**
* Returns the {@link AnalyticsTableType} of analytics table which this manager handles.
*
* @return type of analytics table.
*/
@Override
public AnalyticsTableType getAnalyticsTableType() {
return TRACKED_ENTITY_INSTANCE_EVENTS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import static com.google.common.base.Strings.isNullOrEmpty;
import static org.hisp.dhis.external.conf.ConfigurationKey.LINKED_ACCOUNTS_ENABLED;
import static org.hisp.dhis.external.conf.ConfigurationKey.LINKED_ACCOUNTS_LOGOUT_URL;
import static org.hisp.dhis.external.conf.ConfigurationKey.LINKED_ACCOUNTS_RELOGIN_URL;
import static org.hisp.dhis.external.conf.ConfigurationKey.OIDC_LOGOUT_REDIRECT_URL;
import static org.hisp.dhis.external.conf.ConfigurationKey.OIDC_OAUTH2_LOGIN_ENABLED;
Expand Down Expand Up @@ -101,15 +102,22 @@ private void handleLinkedAccountsLogout(
HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {

String currentUsername = request.getParameter("current");
String usernameToSwitchTo = request.getParameter("switch");
String linkedAccountsLogoutUrl = config.getProperty(LINKED_ACCOUNTS_LOGOUT_URL);
if (isNullOrEmpty(linkedAccountsLogoutUrl)) {
// Fallback if not defined in config
linkedAccountsLogoutUrl = "/";
}

if (isNullOrEmpty(currentUsername) || isNullOrEmpty(usernameToSwitchTo)) {
setOidcLogoutUrl();
if (isNullOrEmpty(usernameToSwitchTo)) {
// No switch parameter present: redirect to linked_accounts.logout_url
this.handler.setDefaultTargetUrl(linkedAccountsLogoutUrl);
} else {

userStore.setActiveLinkedAccounts(currentUsername, usernameToSwitchTo);

// switch parameter present: switch accounts and then redirect to re-login URL
String currentUsername = request.getParameter("current");
if (!isNullOrEmpty(currentUsername)) {
userStore.setActiveLinkedAccounts(currentUsername, usernameToSwitchTo);
}
this.handler.setDefaultTargetUrl(config.getProperty(LINKED_ACCOUNTS_RELOGIN_URL));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ public enum ConfigurationKey {
LINKED_ACCOUNTS_ENABLED("linked_accounts.enabled", Constants.OFF, false),

LINKED_ACCOUNTS_RELOGIN_URL("linked_accounts.relogin_url", "", false),

LINKED_ACCOUNTS_LOGOUT_URL("linked_accounts.logout_url", "", false),

SWITCH_USER_FEATURE_ENABLED("switch_user_feature.enabled", Constants.OFF, false),
SWITCH_USER_ALLOW_LISTED_IPS(
"switch_user_allow_listed_ips", "localhost,127.0.0.1,[0:0:0:0:0:0:0:1]", false),
Expand Down
2 changes: 1 addition & 1 deletion dhis-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<guava.version>33.3.1-jre</guava.version>
<jsr305.version>3.0.2</jsr305.version>
<imgscalr-lib.version>4.2</imgscalr-lib.version>
<google-api-client.version>2.7.0</google-api-client.version>
<google-api-client.version>2.7.1</google-api-client.version>
<lombok.version>1.18.36</lombok.version>
<lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
<joda-time.version>2.13.0</joda-time.version>
Expand Down

0 comments on commit 30bf46d

Please sign in to comment.