Skip to content

Commit

Permalink
Bugfix release 7.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Sep 18, 2024
1 parent 387c8ff commit 68a8934
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion account-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>myconext</artifactId>
<version>7.3.3</version>
<version>7.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>account-gui</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion myconext-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>myconext</artifactId>
<version>7.3.3</version>
<version>7.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>myconext-gui</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion myconext-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>myconext</artifactId>
<version>7.3.3</version>
<version>7.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>myconext-server</artifactId>
Expand Down
9 changes: 2 additions & 7 deletions myconext-server/src/main/java/myconext/model/EduID.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,8 @@ public EduID(String value, ServiceProvider serviceProvider) {
}

public EduID updateServiceProvider(ServiceProvider serviceProvider) {
//We migrate to the situation that en eduID only has a unique value and multiple services
this.serviceProviderEntityId = null;
this.serviceName = null;
this.serviceNameNl = null;
this.serviceLogoUrl = null;
this.serviceHomeUrl = null;
this.serviceInstutionGuid = null;
//We migrate to the situation that an eduID only has a unique value and multiple services
//but the version for the migration also needs to work with this situation
//We only consider an SP as the same SP, if the entityId's equal OR the institutionGUID's are equal and the entityId's are null
Optional<ServiceProvider> optionalServiceProvider = this.services.stream()
.filter(sp -> (StringUtils.hasText(sp.getEntityId()) && sp.getEntityId().equals(serviceProvider.getEntityId())) ||
Expand Down
23 changes: 22 additions & 1 deletion myconext-server/src/main/java/myconext/mongo/Migrations.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
import com.github.cloudyrock.mongock.ChangeSet;
import com.github.cloudyrock.mongock.driver.mongodb.springdata.v3.decorator.impl.MongockTemplate;
import myconext.manage.Manage;
import myconext.manage.RemoteManage;
import myconext.model.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.schema.JsonSchemaObject;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

@ChangeLog(order = "001")
Expand Down Expand Up @@ -139,6 +140,26 @@ public void deleteSessionOneMore(MongockTemplate mongoTemplate) {
mongoTemplate.remove(new Query(), "sessions");
}

@SuppressWarnings("unchecked")
@ChangeSet(order = "010", id = "bugfixForFaultyMigration", author = "[email protected]")
public void bugfixForFaultyMigration(MongockTemplate mongoTemplate) {
List<User> users = mongoTemplate.findAll(User.class, "users");
users.forEach(user -> {
if (!CollectionUtils.isEmpty(user.getEduIDS())) {
AtomicBoolean userNeedsUpdate = new AtomicBoolean(false);
user.getEduIDS().forEach(eduID -> {
if (!StringUtils.hasText(eduID.getServiceProviderEntityId()) && !CollectionUtils.isEmpty(eduID.getServices()) ) {
eduID.backwardCompatibleTransformation(eduID.getServices().get(0));
userNeedsUpdate.set(true);
}
});
if (userNeedsUpdate.get()) {
mongoTemplate.save(user);
}
}
});
}

protected User mergeEduIDs(User user) {
List<EduID> eduIDS = user.getEduIDS();
//Make a copy to search in
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.openconext</groupId>
<artifactId>myconext</artifactId>
<version>7.3.3</version>
<version>7.3.4</version>
<packaging>pom</packaging>
<name>myconext</name>
<description>My OpenConext</description>
Expand Down
2 changes: 1 addition & 1 deletion tiqr-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>myconext</artifactId>
<version>7.3.3</version>
<version>7.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tiqr-mock</artifactId>
Expand Down

0 comments on commit 68a8934

Please sign in to comment.