2024-10-26 18:22:31 +00:00
|
|
|
class UserNotFound(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to get a user that does not exist"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "User not found"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UserIsProtected(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to delete a user that is protected"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
2024-12-11 09:27:58 +00:00
|
|
|
return "User is protected and cannot be deleted or modified"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UsernameForbidden(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to create a user with a forbidden username"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "Username is forbidden"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UserAlreadyExists(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to create a user that already exists"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "User already exists"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UsernameNotAlphanumeric(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to create a user with a non-alphanumeric username"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "Username not alphanumeric"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UsernameTooLong(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""
|
|
|
|
Attempted to create a user with a too long username. Username must be less than 32 characters
|
|
|
|
"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "Username is too long. Must be less than 32 characters"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PasswordIsEmpty(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""Attempted to create a user with an empty password"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "Password cannot be empty"
|
2024-10-26 18:22:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidConfiguration(Exception):
|
|
|
|
"""The userdata is broken"""
|
2024-12-03 22:54:24 +00:00
|
|
|
|
2024-12-05 23:05:28 +00:00
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "Invalid configuration, userdata is broken"
|
|
|
|
|
2024-12-03 22:54:24 +00:00
|
|
|
|
|
|
|
class SelfPrivacyAppIsOutdate(Exception):
|
2024-12-05 23:05:28 +00:00
|
|
|
"""
|
|
|
|
SelfPrivacy app is out of date, please update. Some important functions are not working at the moment.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "SelfPrivacy app is out of date, please update"
|
2024-12-09 08:37:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class NoPasswordResetLinkFoundInResponse(Exception):
|
|
|
|
"""No password reset link was found in the Kanidm response."""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_error_message() -> str:
|
|
|
|
return "The Kanidm response does not contain a password reset link."
|