Skip to content

store_session

mlte/store/user/store.py

MLTE user store interface implementation.

GroupMapper

Bases: ResourceMapper

A interface for mapping CRUD actions to store groups.

Source code in mlte/store/user/store_session.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class GroupMapper(ResourceMapper):
    """A interface for mapping CRUD actions to store groups."""

    def create(self, new_group: Group, context: Any = None) -> Group:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def edit(self, updated_group: Group, context: Any = None) -> Group:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def read(self, group_id: str, context: Any = None) -> Group:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def list(self, context: Any = None) -> List[str]:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def delete(self, group_id: str, context: Any = None) -> Group:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

ManagedUserSession

Bases: ManagedSession

A simple context manager for store sessions.

Source code in mlte/store/user/store_session.py
32
33
34
35
36
class ManagedUserSession(ManagedSession):
    """A simple context manager for store sessions."""

    def __enter__(self) -> UserStoreSession:
        return cast(UserStoreSession, self.session)

PermissionMapper

Bases: ResourceMapper

A interface for mapping CRUD actions to store permissions.

Source code in mlte/store/user/store_session.py
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
class PermissionMapper(ResourceMapper):
    """A interface for mapping CRUD actions to store permissions."""

    def create(
        self, new_permission: Permission, context: Any = None
    ) -> Permission:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def edit(
        self, updated_permission: Permission, context: Any = None
    ) -> Permission:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def read(self, permission: str, context: Any = None) -> Permission:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def list(self, context: Any = None) -> List[str]:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def delete(self, permission: str, context: Any = None) -> Permission:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

UserMapper

Bases: ResourceMapper

An interface for mapping CRUD actions to store users.

Source code in mlte/store/user/store_session.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class UserMapper(ResourceMapper):
    """An interface for mapping CRUD actions to store users."""

    def create(self, new_user: UserWithPassword, context: Any = None) -> User:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def edit(
        self,
        updated_user: Union[UserWithPassword, BasicUser],
        context: Any = None,
    ) -> User:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def read(self, user_id: str, context: Any = None) -> User:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def list(self, context: Any = None) -> List[str]:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

    def delete(self, user_id: str, context: Any = None) -> User:
        raise NotImplementedError(self.NOT_IMPLEMENTED_ERROR_MSG)

UserStoreSession

Bases: StoreSession

The base class for all implementations of the MLTE user store session.

Source code in mlte/store/user/store_session.py
19
20
21
22
23
24
25
26
27
28
29
class UserStoreSession(StoreSession):
    """The base class for all implementations of the MLTE user store session."""

    user_mapper: UserMapper
    """Mapper for the user resource."""

    group_mapper: GroupMapper
    """Mapper for the group resource."""

    permission_mapper: PermissionMapper
    """Mapper for the permission resource."""

group_mapper instance-attribute

Mapper for the group resource.

permission_mapper instance-attribute

Mapper for the permission resource.

user_mapper instance-attribute

Mapper for the user resource.