linotp.model.local_admin_user module

exception linotp.model.local_admin_user.DuplicateUserError(username: str, message: str = 'User {0} already exists')

Bases: Exception

class linotp.model.local_admin_user.LocalAdminResolver(app: LinOTPApp)

Bases: object

add_to_admin_realm() None

Checks whether the resolver is part of the admin realm and adds it if necessary. This may be needed if the user adds a different resolver to the admin realm and then removes this one. (This resolver cannot be deleted outright, but it can be removed from the admin realm.)

We assume that the admin realm itself exists already, or, more precisely, LinOTP doesn’t care if you add a resolver to a realm that doesn’t exist.

add_user(username: str, password: str, surname: str = '', givenname: str = '', phone: str = '', mobile: str = '', email: str = '') None

Create a new admin user in the local admin resolver

Args:
username (str):

username of the new user

password (str):

password of the new user

surname (str, optional):

surename of the new user. Defaults to “”.

givenname (str, optional):

givename of the new user. Defaults to “”.

phone (str, optional):

phone number of the new user. Defaults to “”.

mobile (str, optional):

mobile number of the new user. Defaults to “”.

email (str, optional):

email of the new user. Defaults to “”.

Raises:
DuplicateUserError:

raises if a user should be created which already exists

get_user_info(username: str) Dict[str, str]
list_users() List[Dict[str, str]]

list all local admin users

Returns:
List[Dict[str, str]]:

returns a list of all local admin users

remove_user(username: str) None

removes a local admin user

Args:
username (str):

the name of the user which should get removed

set_user_password(username: str, password: str) None

set the password for a local admin user

Args:
username (str):

the name of the user which should get a new password

password (str):

the new password of the user

Raises:
UserNotExistException:

raises if a user which should get updated does not exist

update_user(username: str, surname: str = '', givenname: str = '', phone: str = '', mobile: str = '', email: str = '') None

Create a new admin user in the local admin resolver

Args:
username (str):

username of the new user

surname (str, optional):

surename of the new user. Defaults to “”.

givenname (str, optional):

givename of the new user. Defaults to “”.

phone (str, optional):

phone number of the new user. Defaults to “”.

mobile (str, optional):

mobile number of the new user. Defaults to “”.

email (str, optional):

email of the new user. Defaults to “”.

Raises:
NoSuchUserError:

raises if a user which should get updated does not exist

exception linotp.model.local_admin_user.NoSuchUserError(username: str, message: str = 'User {0} does not exist')

Bases: Exception