linotp.model.resolver module

class linotp.model.resolver.Resolver(name: str, type: ~linotp.model.resolver.ResolverType, spec: str, read_only: ~typing.Optional[bool], admin: bool, config: <module 'linotp.useridresolver.UserIdResolver' from '/usr/lib/python3/dist-packages/linotp/useridresolver/UserIdResolver.py'>)

Bases: object

Class to represent a resolver instance.

Developer notes: Currently there is no database table for storing resolver entries. All resolver information is loaded from the LinOTP Config. In the long run we would like to change this, and for now we can already define this interface to help us structure the remaining code.

as_dict()

Return a JSON-serializable dictionary with the attributes of the resolver. This requires returning the set of realms as a list, and the type’s value.

property configuration_instance: <module 'linotp.useridresolver.UserIdResolver' from '/usr/lib/python3/dist-packages/linotp/useridresolver/UserIdResolver.py'>
static from_dict(resolver_dict: dict)
get_users(search_dictionary: dict = {}) List[User]

List users of a resolver. Some resolvers might limit this result, so it is not always guaranteed that the list is complete.

The list of users can be restricted by supplying a search dictionary, where the key maps to a user’s attribute.

property is_admin: bool

Returns whether the resolver is storing administrator users.

property is_read_only: bool

Returns whether the resolver is read-only.

property name: str

User-assigned name, unique

property realms: Set[str]

Set of names of the realms the resolver is in

property spec: str

LinOTP-internal resolver type. It should be deprecated as soon as the type attribute is recognized everywhere, as it is a dot-separated string which gets split uselessly all over the place.

property type: ResolverType

The type of the resolver. Allowed values are defined in the enum ResolverType.

class linotp.model.resolver.ResolverType(value)

Bases: Enum

An enumeration.

HTTP = 'httpresolver'
LDAP = 'ldapresolver'
PW = 'passwdresolver'
SQL = 'sqlresolver'
class linotp.model.resolver.User(user_id: str, resolver_name: str, resolver_class: ResolverType, username: str, surname: Optional[str], given_name: Optional[str], phone: Optional[str], mobile: Optional[str], email: Optional[str])

Bases: object

Represents a user for the new API of the manage UI.

TODO: Ideally this should be fused with the User in lib.user, but that is a larger undertaking for which we do not have time now. Perhaps we can tidy up the User there and bring its functionality here.

as_dict() Dict[str, Optional[str]]
static from_dict(resolver_name: str, resolver_type: ResolverType, user_dictionary: dict)