2022-02-16 18:07:05 +01:00
|
|
|
from fittrackee import db
|
|
|
|
|
|
|
|
from ..exceptions import UserNotFoundException
|
|
|
|
from ..models import User
|
|
|
|
|
|
|
|
|
|
|
|
def set_admin_rights(username: str) -> None:
|
|
|
|
user = User.query.filter_by(username=username).first()
|
|
|
|
if not user:
|
|
|
|
raise UserNotFoundException()
|
|
|
|
user.admin = True
|
2022-03-20 16:31:48 +01:00
|
|
|
user.is_active = True
|
|
|
|
user.confirmation_token = None
|
2022-02-16 18:07:05 +01:00
|
|
|
db.session.commit()
|