This commit is contained in:
Kenneth Kehl
2024-07-11 09:38:32 -07:00
parent 3a2ba3a8c0
commit 058a999ed0
22 changed files with 235 additions and 70 deletions

View File

@@ -54,16 +54,23 @@ class NotifyAdminAPIClient(BaseAPIClient):
):
abort(403)
def check_inactive_user(self):
if not current_user or not current_user.is_active:
abort(403)
def post(self, *args, **kwargs):
self.check_inactive_service()
self.check_inactive_user()
return super().post(*args, **kwargs)
def put(self, *args, **kwargs):
self.check_inactive_service()
self.check_inactive_user()
return super().put(*args, **kwargs)
def delete(self, *args, **kwargs):
self.check_inactive_service()
self.check_inactive_user()
return super().delete(*args, **kwargs)

View File

@@ -217,6 +217,10 @@ class UserApiClient(NotifyAdminAPIClient):
def activate_user(self, user_id):
return self.post("/user/{}/activate".format(user_id), data=None)
@cache.delete("user-{user_id}")
def deactivate_user(self, user_id):
return self.post("/user/{}/deactivate".format(user_id), data=None)
def send_change_email_verification(self, user_id, new_email):
endpoint = "/user/{}/change-email-verification".format(user_id)
data = {"email": new_email}