Overhaul sim component for permission management.

This commit is contained in:
Marek Wolan
2023-08-03 13:09:04 +01:00
parent 091b4a801d
commit 3a2840bed8
4 changed files with 182 additions and 50 deletions

View File

@@ -1,13 +1,54 @@
from typing import Set, TypeAlias
from typing import Dict, Final, List, TypeAlias
from primaite.simulator.core import SimComponent
from primaite.simulator.domain import Account
from primaite.simulator.domain import Account, AccountGroup, AccountType
__temp_node = TypeAlias() # placeholder while nodes don't exist
# placeholder while these objects don't yet exist
__temp_node = TypeAlias()
__temp_application = TypeAlias()
__temp_folder = TypeAlias()
__temp_file = TypeAlias()
class DomainController(SimComponent):
"""Main object for controlling the domain."""
nodes: Set(__temp_node) = set()
accounts: Set(Account) = set()
# owned objects
accounts: List(Account) = []
groups: Final[List[AccountGroup]] = list(AccountGroup)
group_membership: Dict[AccountGroup, List[Account]]
# references to non-owned objects
nodes: List(__temp_node) = []
applications: List(__temp_application) = []
folders: List(__temp_folder) = []
files: List(__temp_file) = []
def register_account(self, account: Account) -> None:
"""TODO."""
...
def deregister_account(self, account: Account) -> None:
"""TODO."""
...
def create_account(self, username: str, password: str, account_type: AccountType) -> Account:
"""TODO."""
...
def rotate_all_credentials(self) -> None:
"""TODO."""
...
def rotate_account_credentials(self, account: Account) -> None:
"""TODO."""
...
def add_account_to_group(self, account: Account, group: AccountGroup) -> None:
"""TODO."""
...
def remove_account_from_group(self, account: Account, group: AccountGroup) -> None:
"""TODO."""
...