67 lines
2.0 KiB
Python

from abc import ABC, abstractmethod
from typing import List, Optional
from app.core.models import GroupSummary, UserSummary
class SystemProvider(ABC):
@abstractmethod
def create_user(self, username: str, password_hash: str, home_dir: Optional[str], linked_home_dir: Optional[str], shell: str, primary_group: Optional[str], groups: List[str]) -> None:
raise NotImplementedError
@abstractmethod
def delete_user(self, username: str) -> None:
raise NotImplementedError
@abstractmethod
def change_user_password(self, username: str, password_hash: str) -> None:
raise NotImplementedError
@abstractmethod
def list_users(self) -> List[UserSummary]:
raise NotImplementedError
@abstractmethod
def get_user(self, username: str) -> UserSummary:
raise NotImplementedError
@abstractmethod
def create_group(self, groupname: str) -> None:
raise NotImplementedError
@abstractmethod
def delete_group(self, groupname: str) -> None:
raise NotImplementedError
@abstractmethod
def list_groups(self) -> List[GroupSummary]:
raise NotImplementedError
@abstractmethod
def get_group(self, groupname: str) -> GroupSummary:
raise NotImplementedError
@abstractmethod
def add_user_groups(self, username: str, groups: List[str], replace: bool) -> None:
raise NotImplementedError
@abstractmethod
def remove_user_groups(self, username: str, groups: List[str]) -> None:
raise NotImplementedError
@abstractmethod
def get_user_groups(self, username: str) -> List[str]:
raise NotImplementedError
@abstractmethod
def read_user_environment(self, username: str) -> str:
raise NotImplementedError
@abstractmethod
def write_default_user_environment(self, username: str, content: str) -> None:
raise NotImplementedError
@abstractmethod
def write_managed_user_environment(self, username: str, content: str) -> None:
raise NotImplementedError