@@ -85,8 +85,6 @@ public class PrivacyControlService extends RESTService {
85
85
86
86
private final static String DEFAULT_CONFIG_FILE = "etc/consentConfiguration.xml" ;
87
87
88
- private static ConcurrentMap <String , String > userToMoodleToken = new ConcurrentHashMap <>();
89
-
90
88
private static ReadWriteRegistryClient registryClient ;
91
89
92
90
private static VerificationRegistry verificationRegistry ;
@@ -96,10 +94,12 @@ public class PrivacyControlService extends RESTService {
96
94
private static String consentRegistryAddress ;
97
95
98
96
private static HashMap <Integer , ConsentLevel > consentLevelMap = new HashMap <Integer , ConsentLevel >();
97
+ private static ConcurrentMap <String , List <BigInteger >> consentCache = new ConcurrentHashMap <>();
98
+ private static ConcurrentMap <String , String > userToMoodleToken = new ConcurrentHashMap <>();
99
+
99
100
private static HashSet <String > consentProcessing = new HashSet <String >();
100
101
private static HashSet <String > choosingFunction = new HashSet <String >();
101
-
102
- private static ConcurrentMap <String , List <BigInteger >> consentCache = new ConcurrentHashMap <>();
102
+ private static HashSet <String > processingAction = new HashSet <String >();
103
103
104
104
private static boolean initialized = false ;
105
105
@@ -187,7 +187,14 @@ public Response showConsentMenu(String body) throws ParseException {
187
187
return Response .ok ().entity (err ).build ();
188
188
}
189
189
190
- if (consentProcessing .contains (channel )) {
190
+ if (processingAction .contains (channel )) {
191
+ logger .info ("Got message while processing..." );
192
+ JSONObject res = new JSONObject ();
193
+ res .put ("text" , "Bitte warte, bis die Aktion ausgefuehrt wurde." );
194
+ res .put ("closeContext" , "false" );
195
+ return Response .ok ().entity (res ).build ();
196
+
197
+ } else if (consentProcessing .contains (channel )) {
191
198
// Proceed with storage
192
199
logger .info ("Continuing consent storage for user " + email );
193
200
@@ -202,12 +209,15 @@ public Response showConsentMenu(String body) throws ParseException {
202
209
}
203
210
levels .add (new BigInteger (s ));
204
211
}
205
- storeUserConsentLevels (email , levels );
206
212
consentProcessing .remove (channel );
207
-
213
+
214
+ processingAction .add (channel );
215
+ storeUserConsentLevels (email , levels );
216
+ processingAction .remove (channel );
217
+
208
218
// Build response and close context.
209
219
JSONObject res = new JSONObject ();
210
- res .put ("text" , "Deine Einwilligung wurde erfolgreich gespeichert. \n " + "Melde dich, falls ich noch etwas fuer dich tun kann. " );
220
+ res .put ("text" , "Deine Einwilligung wurde erfolgreich gespeichert." );
211
221
res .put ("closeContext" , "true" );
212
222
return Response .ok ().entity (res ).build ();
213
223
@@ -221,9 +231,8 @@ public Response showConsentMenu(String body) throws ParseException {
221
231
e .printStackTrace ();
222
232
}
223
233
consentProcessing .remove (channel );
224
- }
225
-
226
- if (choosingFunction .contains (channel )) {
234
+
235
+ } else if (choosingFunction .contains (channel )) {
227
236
// If options have been displayed, parse number and evaluate which function to execute.
228
237
String chosenOption = bodyObj .getAsString ("msg" ).split ("\\ ." )[0 ];
229
238
try {
@@ -288,10 +297,12 @@ public Response showConsentMenu(String body) throws ParseException {
288
297
case 3 : // revokeConsent(body);
289
298
logger .info ("Revoking consent for user " + email );
290
299
try {
300
+ processingAction .add (channel );
291
301
revokeUserConsent (email );
292
-
302
+ processingAction .remove (channel );
303
+
293
304
res = new JSONObject ();
294
- res .put ("text" , "Deine Einstellungen wurden angepasst. \n " + "Melde dich, falls ich noch etwas fuer dich tun kann. " );
305
+ res .put ("text" , "Deine Einstellungen wurden angepasst." );
295
306
res .put ("closeContext" , "true" );
296
307
return Response .ok ().entity (res ).build ();
297
308
} catch (EthereumException e ) {
@@ -309,6 +320,7 @@ public Response showConsentMenu(String body) throws ParseException {
309
320
err .put ("closeContext" , "false" );
310
321
return Response .ok ().entity (err ).build ();
311
322
}
323
+
312
324
} else {
313
325
choosingFunction .add (channel );
314
326
StringBuilder menuBuilder = new StringBuilder ();
@@ -396,7 +408,6 @@ public Response showLrsData(String body) {
396
408
397
409
resBuilder .append ("\n " );
398
410
resBuilder .append ("Wenn du in Zukunft direkt zu dieser Ansicht springen moechtest, dann schreibe mich an mit: 'Daten' \n " );
399
- resBuilder .append ("Melde dich, falls ich noch etwas fuer dich tun kann." );
400
411
401
412
JSONObject res = new JSONObject ();
402
413
res .put ("text" , resBuilder .toString ());
0 commit comments