From e979302e40e95e81142a815bada0880a11e6a1ab Mon Sep 17 00:00:00 2001 From: Pete Stenger Date: Sat, 7 Sep 2024 21:52:38 -0500 Subject: [PATCH] allow anyone to set their bracket --- CTFd/schemas/users.py | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/CTFd/schemas/users.py b/CTFd/schemas/users.py index cd9fdd6a93..6f902aab30 100644 --- a/CTFd/schemas/users.py +++ b/CTFd/schemas/users.py @@ -198,28 +198,11 @@ def validate_bracket_id(self, data): if bracket_id is None: return - current_user = get_current_user() - if is_admin(): - bracket = Brackets.query.filter_by(id=bracket_id, type="users").first() - if bracket is None: - ValidationError( - "Please provide a valid bracket id", field_names=["bracket_id"] - ) - else: - if ( - current_user.bracket_id == int(bracket_id) - or current_user.bracket_id is None - ): - bracket = Brackets.query.filter_by(id=bracket_id, type="users").first() - if bracket is None: - ValidationError( - "Please provide a valid bracket id", field_names=["bracket_id"] - ) - else: - raise ValidationError( - "Please contact an admin to change your bracket", - field_names=["bracket_id"], - ) + bracket = Brackets.query.filter_by(id=bracket_id, type="users").first() + if bracket is None: + ValidationError( + "Please provide a valid bracket id", field_names=["bracket_id"] + ) @pre_load def validate_fields(self, data):