Skip to content

Commit 204efa1

Browse files
committed
Merge branch 'release-1.2.6'
2 parents 94e9a15 + 3c3d5db commit 204efa1

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>ubc.pavlab</groupId>
77
<artifactId>rdp</artifactId>
8-
<version>1.2.5</version>
8+
<version>1.2.6</version>
99

1010
<parent>
1111
<groupId>org.springframework.boot</groupId>

src/main/java/ubc/pavlab/rdp/services/UserServiceImpl.java

+21
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,28 @@ public User update( User user ) {
124124
// Pre-Post authorized annotations.
125125
String currentUsername = getCurrentEmail();
126126
if ( user.getEmail().equals( currentUsername ) ) {
127+
if (applicationSettings.getPrivacy() == null){
128+
log.warn( currentUsername + " attempted to updated, but applicationSettings is null. ");
129+
} else {
130+
Integer defaultPrivacyLevel = applicationSettings.getPrivacy().getDefaultLevel();
131+
boolean defaultSharing = applicationSettings.getPrivacy().isDefaultSharing();
132+
boolean defaultGenelist = applicationSettings.getPrivacy().isAllowHideGenelist();
133+
134+
if (user.getProfile().getPrivacyLevel() == null){
135+
log.warn("Received a null 'privacyLevel' value in profile.");
136+
user.getProfile().setPrivacyLevel(defaultPrivacyLevel);
137+
}
138+
if (user.getProfile().getShared() == null){
139+
log.warn("Received a null 'shared' value in profile.");
140+
user.getProfile().setShared(defaultSharing);
141+
}
142+
if (user.getProfile().getHideGenelist() == null){
143+
log.warn("Received a null 'hideGeneList' value in profile.");
144+
user.getProfile().setHideGenelist(defaultGenelist);
145+
}
146+
}
127147
return userRepository.save( user );
148+
128149
} else {
129150
log.warn( currentUsername + " attempted to update a user that is not their own: " + user.getEmail() );
130151
}

0 commit comments

Comments
 (0)