selfprivacy-rest-api/selfprivacy_api/repositories/users/abstract_user_repository.py

36 lines
993 B
Python
Raw Normal View History

from abc import ABC, abstractmethod
from typing import Optional
from selfprivacy_api.models.user import UserDataUser
class AbstractUserRepository(ABC):
@staticmethod
@abstractmethod
def get_users(
exclude_primary: bool = False,
exclude_root: bool = False,
) -> list[UserDataUser]:
"""Retrieves a list of users with options to exclude specific user groups"""
@staticmethod
@abstractmethod
def create_user(username: str, hashed_password: str) -> None:
"""Creates a new user"""
@staticmethod
@abstractmethod
def delete_user(username: str) -> None:
"""Deletes an existing user"""
@staticmethod
@abstractmethod
def update_user(username: str, hashed_password: str) -> None:
"""Updates the password of an existing user"""
@staticmethod
@abstractmethod
def get_user_by_username(username: str) -> Optional[UserDataUser]:
"""Retrieves user data (UserDataUser) by username"""