atoti_plus.user_service_client.roles.individual_roles module#
- class atoti_plus.IndividualRoles#
The roles given to users on top of the ones that can be added by authentication providers.
Users without the ROLE_USER will not be able to access the session.
Example
>>> from atoti_plus import UserServiceClient >>> session = tt.Session(authentication=tt.BasicAuthenticationConfig()) >>> user_service_client = UserServiceClient.from_session(session) >>> elon = user_service_client.basic.create_user("John", password="X Æ A-12") >>> user_service_client.individual_roles[elon.username] {'ROLE_USER'} >>> user_service_client.individual_roles[elon.username].add("ROLE_USA") >>> sorted(user_service_client.individual_roles[elon.username]) ['ROLE_USA', 'ROLE_USER'] >>> user_service_client.individual_roles[elon.username].remove("ROLE_USA") >>> user_service_client.individual_roles[elon.username] {'ROLE_USER'} >>> # Removing all the roles will prevent the user from accessing the session: >>> del user_service_client.individual_roles[elon.username] >>> elon.username in user_service_client.individual_roles False
- update(__m: SupportsKeysAndGetItem[str, _UserRolesDescription], **kwargs: Union[Iterable[str], _UserRoles]) None #
- update(__m: Iterable[Tuple[str, Union[Iterable[str], _UserRoles]]], **kwargs: Union[Iterable[str], _UserRoles]) None
- update(**kwargs: Union[Iterable[str], _UserRoles]) None
Update the mapping.