diff --git a/api/utils.py b/api/utils.py index e1256a4..2a1261e 100644 --- a/api/utils.py +++ b/api/utils.py @@ -9,13 +9,14 @@ from werkzeug.security import generate_password_hash def admin_required(user_id, message='Access denied.'): + "Check if common user try to make administrative action." user = db.session.get(User, user_id) if user is None or user.role != "Administrator": abort(403, message) def validate_access(owner_id, message='Access denied.'): - # Check if user try to access or edit resource that does not belong to them + "Check if user try to access or edit resource that does not belong to them." logged_user_id = int(get_jwt_identity()) logged_user_role = db.session.get(User, logged_user_id).role if logged_user_role != "Administrator" and logged_user_id != owner_id: @@ -31,6 +32,7 @@ def get_user_or_404(user_id): def wait_for_db(max_retries): + "Try to connect with database times." for _ in range(max_retries): try: with db.engine.connect() as connection: