Add load_all_users
This commit is contained in:
parent
46f7b54556
commit
6d0aa3eb34
@ -1,9 +1,11 @@
|
||||
from amanuensis.user.manage import load_all_users
|
||||
from amanuensis.user.signup import (
|
||||
create_user,
|
||||
valid_username,
|
||||
valid_email)
|
||||
|
||||
__all__ = [member.__name__ for member in [
|
||||
load_all_users,
|
||||
create_user,
|
||||
valid_username,
|
||||
valid_email,
|
||||
|
19
amanuensis/user/manage.py
Normal file
19
amanuensis/user/manage.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
General functions for managing users
|
||||
"""
|
||||
from typing import Iterable
|
||||
|
||||
from amanuensis.config import RootConfigDirectoryContext
|
||||
from amanuensis.models import ModelFactory, UserModel
|
||||
|
||||
|
||||
def load_all_users(
|
||||
root: RootConfigDirectoryContext) -> Iterable[UserModel]:
|
||||
"""
|
||||
Iterably loads every lexicon in the config store
|
||||
"""
|
||||
model_factory: ModelFactory = ModelFactory(root)
|
||||
with root.user.read_index() as index:
|
||||
for uid in index.values():
|
||||
user: UserModel = model_factory.user(uid)
|
||||
yield user
|
Loading…
Reference in New Issue
Block a user