File tree 2 files changed +22
-1
lines changed
src/main/java/ubc/pavlab/rdp/services
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
<groupId >ubc.pavlab</groupId >
7
7
<artifactId >rdp</artifactId >
8
- <version >1.2.5 </version >
8
+ <version >1.2.6 </version >
9
9
10
10
<parent >
11
11
<groupId >org.springframework.boot</groupId >
Original file line number Diff line number Diff line change @@ -124,7 +124,28 @@ public User update( User user ) {
124
124
// Pre-Post authorized annotations.
125
125
String currentUsername = getCurrentEmail ();
126
126
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
+ }
127
147
return userRepository .save ( user );
148
+
128
149
} else {
129
150
log .warn ( currentUsername + " attempted to update a user that is not their own: " + user .getEmail () );
130
151
}
You can’t perform that action at this time.
0 commit comments