BSMD users are now allowed to POST times entry, if they are assigned to the ShipcallParticipantMap or the special BSMD-flag-clause takes place

This commit is contained in:
Max Metz 2024-09-09 17:06:03 +02:00
parent d2cd233f13
commit 9127cdeac8

View File

@ -85,13 +85,10 @@ class InputValidationTimes():
# 2.) datasets may only be created, if the respective participant type did not already create one.
InputValidationTimes.check_if_entry_already_exists_for_participant_type(user_data, loadedModel, content)
# 3.) only users who are *not* of type BSMD may post times datasets.
InputValidationTimes.check_user_is_not_bsmd_type(user_data)
# 4.) Reference checking
# 3.) Reference checking
InputValidationTimes.check_dataset_references(content)
# 5.) Value checking
# 4.) Value checking
InputValidationTimes.check_dataset_values(user_data, loadedModel, content)
return
@ -143,6 +140,7 @@ class InputValidationTimes():
@staticmethod
def check_user_is_not_bsmd_type(user_data:dict):
"""a new dataset may only be created by a user who is *not* belonging to participant group BSMD"""
# this method is deprecated for /times POST requests. As the function may be used elsewhere, it will, for now, not be removed
is_bsmd = check_if_user_is_bsmd_type(user_data)
if is_bsmd:
raise ValidationError({"participant_type":f"current user belongs to BSMD. Cannot post 'times' datasets. Found user data: {user_data}"})