Skip to content

user

User service module

Attributes

S module-attribute

S = TypeVar('S')

Classes

UserService

UserService(
    sa_session: SASession, neo4j_session: NJSession
)

Bases: BaseService

User service layer

Attributes

activity_session_dao instance-attribute
activity_session_dao = ActivitySessionDao(
    session=sa_session
)
activity_session_participant_dao instance-attribute
activity_session_participant_dao = (
    ActivitySessionParticipantDao(session=sa_session)
)
namespace_service instance-attribute
namespace_service = NamespaceService(
    sa_session=sa_session, neo4j_session=neo4j_session
)
participant_dao instance-attribute
participant_dao = ParticipantDao(session=sa_session)
user_dao instance-attribute
user_dao = UserDao(session=sa_session)

Functions

create_user
create_user(
    *,
    namespace: str,
    name: str,
    enabled: bool = True,
    settings: Optional[UserResourceSettings] = None,
    managed: bool = False,
    description: Optional[str] = None,
    db_transact: bool = True
) -> User

Creates a new user in the specified namespace.

Parameters:

  • namespace_pkid (str) –

    The primary key ID of the namespace.

  • name (str) –

    The name of the user.

  • enabled (bool, default: True ) –

    Whether the user is enabled. Defaults to True.

  • description (str, default: None ) –

    The description of the user. Defaults to None.

  • db_transact (bool, default: True ) –

    Flag indicating whether to commit the transaction. Defaults to True.

Returns:

  • User

    orm.User: The newly created user object.

Raises:

get_user
get_user(
    *,
    namespace: str,
    user: str,
    error_deleted: bool = True,
    error_disabled: bool = True
) -> User
hard_delete_user
hard_delete_user(
    namespace: str,
    user: str,
    dry_run: bool = True,
    db_transact: bool = True,
    raise_on_missing: bool = True,
) -> None
soft_delete_user
soft_delete_user(
    *, namespace: str, user: str, db_transact: bool = True
)

Deletes the user(s) with the given primary key(s).

Parameters:

  • user_pkids (Union[str, List[str]]) –

    The primary key(s) of the user(s) to be deleted.

Raises:

  • ServiceError

    If an error occurs during the deletion process.

undelete_user
undelete_user(
    *, namespace: str, user: str, db_transact: bool = True
)

Undeletes a user by setting the ‘deleted’ flag to False.

Parameters:

  • user_pkids (Union[str, List[str]]) –

    The primary key ID(s) of the user(s) to undelete.

Raises:

  • ServiceError

    If the user is not deleted or if an error occurs during the operation.

update_user
update_user(
    *,
    namespace: str,
    user: str,
    name: Optional[str] = None,
    description: Optional[str] = None,
    settings: Optional[UserResourceSettings] = None,
    managed: Optional[bool] = None,
    enabled: Optional[bool] = None,
    db_transact: bool = True
) -> User