You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Check user from user_keys is also a user in this blacklist/whitelist
255
+
foruser_checkinuser_ids_check_list:
256
+
if (user_check==check_irt['user_id']):
257
+
user_found+=1
258
+
if (user_found==0):
259
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' user_id '+check_irt['user_id'] +' does not match any user from user_keys\n'
260
+
if (user_found>1):
261
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' user_id '+check_irt['user_id'] +' is seen more than once\n'
262
+
#Check user_id is string
263
+
if (not (isinstance(check_irt['user_id'], str))):
264
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' the user_id is not a string or is not a list for at least one user\n'
265
+
else:
266
+
#Check user_id is 32 character long alphanumeric
267
+
if (not (
268
+
(check_irt['user_id'].isalnum()) and
269
+
(len(check_irt['user_id']) ==32)
270
+
)):
271
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' + at least one user_id is not a 32-character alphanumeric string\n'
272
+
else:
273
+
error_found_in_mumc_config_yaml+='ConfigNameError: The '+config_var_name+' > user_id key is missing for at least one user\n'
274
+
275
+
276
+
#Check if user_name exists
277
+
if ('user_name'incheck_irt):
278
+
#Set user tracker to zero
279
+
user_found=0
280
+
#Check user from user_name is also a user in this blacklist/whitelist
281
+
foruser_checkinuser_names_check_list:
282
+
if (user_check==check_irt['user_name']):
283
+
user_found+=1
284
+
if (user_found==0):
285
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' user_name '+check_irt['user_name'] +' does not match any user from user_keys\n'
286
+
if (user_found>1):
287
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' user_name '+check_irt['user_name'] +' is seen more than once\n'
288
+
#Check user_name is string
289
+
if (not (isinstance(check_irt['user_name'], str))):
290
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' the user_name is not a string or is not a list for at least one user\n'
291
+
else:
292
+
error_found_in_mumc_config_yaml+='ConfigNameError: The '+config_var_name+' > user_name is missing for at least one user\n'
293
+
294
+
#Check if whitelist exists
295
+
if ('whitelist'incheck_irt):
296
+
#Check whitelist is string
297
+
if (not (isinstance(check_irt['whitelist'], list))):
298
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' the whitelist is not a string or is not a list for at least one user\n'
299
+
else:
300
+
error_found_in_mumc_config_yaml+='ConfigNameError: The '+config_var_name+' > whitelist is missing for at least one user\n'
301
+
302
+
#Check if blacklist exists
303
+
if ('blacklist'incheck_irt):
304
+
#Check blacklist is string
305
+
if (not (isinstance(check_irt['blacklist'], list))):
306
+
error_found_in_mumc_config_yaml+='ConfigValueError: '+config_var_name+' the blacklist is not a string or is not a list for at least one user\n'
307
+
else:
308
+
error_found_in_mumc_config_yaml+='ConfigNameError: The '+config_var_name+' > blacklist is missing for at least one user\n'
309
+
310
+
#Get number of elements
311
+
foruser_elementsincheck_irt:
312
+
#Ignore user_id and user_name
313
+
#Check whitelist and blacklist only if they are not empty lists
314
+
if (((not (user_elements=='user_id')) and (not (user_elements=='user_name'))) and (((user_elements=='whitelist') or (user_elements=='blacklist')) andcheck_irt[user_elements])):
315
+
#Set library key trackers to zero
316
+
lib_id_found=0
317
+
collection_type_found=0
318
+
path_found=0
319
+
network_path_found=0
320
+
subfolder_id_found=0
321
+
lib_enabled_found=0
322
+
#Check if this num_element exists before proceeding
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'action')) ==None)):
422
+
if (
423
+
not (isinstance(check,str) and
424
+
((check.casefold() =='delete') or (check.casefold() =='keep')))
425
+
):
426
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > action must be a string\n\tValid values \'delete\' and \'keep\'\n'
427
+
else:
428
+
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'user_conditional')) ==None)):
429
+
if (
430
+
not (isinstance(check,str) and
431
+
(check.casefold() =='all'))
432
+
):
433
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > user_conditional must be a string\n\tValid values \'any\' and \'all\'\n'
434
+
else:
435
+
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'played_conditional')) ==None)):
436
+
if (
437
+
not (isinstance(check,str) and
438
+
((check.casefold() =='all') or (check.casefold() =='any') or#legacy values
439
+
(check.casefold() =='all_all') or (check.casefold() =='any_any') or
440
+
(check.casefold() =='any_all') or (check.casefold() =='all_any') or
441
+
(check.casefold() =='any_played') or (check.casefold() =='all_played') or
442
+
(check.casefold() =='any_created') or (check.casefold() =='all_created') or
443
+
(check.casefold() =='ignore')))
444
+
):
445
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > played_conditional must be a string\n\tValid values \'any_any\', \'all_all\', \'any_all\', \'all_any\', \'any_played\', \'all_played\', \'any_created\', and \'all_created\'\n'
446
+
else:
447
+
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'action_control')) ==None)):
448
+
if (
449
+
not (isinstance(check,int) and
450
+
((check>=0) and (check<=8)))
451
+
):
452
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > action_control must be an integer\n\tValid range 0 thru 8\n'
453
+
else:
454
+
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'dynamic_behavior')) ==None)):
455
+
if (
456
+
not (isinstance(check,bool) and
457
+
((check==True) or (check==False)))
458
+
):
459
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > dynamic_behavior must be an boolean\n\tValid values True or False\n'
460
+
else:
461
+
if (not ((check:=keys_exist_return_value(cfg,'advanced_settings','behavioral_tags',media_type,tag,'high_priority')) ==None)):
462
+
if (
463
+
not (isinstance(check,bool) and
464
+
((check==True) or (check==False)))
465
+
):
466
+
error_found_in_mumc_config_yaml+='ConfigValueError: advanced_settings > behavioral_tags > '+media_type+' > '+tag+' > high_priority must be an boolean\n\tValid values True or False\n'
0 commit comments