hook.identity

class immp.hook.identity.Identity(name, provider=None, links=(), roles=())

Bases: object

Basic representation of an external identity.

name

str – Common name used across any linked platforms.

provider

.IdentityProvider – Service hook where the identity information was acquired from.

User list – Physical platform users assigned to this identity.

roles

str list – Optional set of role names, if applicable to the backend.

classmethod gather(*tasks)

Helper for fetching users from plugs, filtering out calls with no matches:

>>> await Identity.gather(plug1.user_from_id(id1), plug2.user_from_id(id2))
[<Plug1User: '123' 'User'>]
Parameters
tasks (coroutine list) – Non-awaited coroutines or tasks.
Returns
Gathered results of those tasks.
Return type
list
class immp.hook.identity.IdentityProvider

Bases: object

Interface for hooks to provide identity information from a backing source.

identity_from_name(name)

Look up an identity by the external provider’s username for them.

Parameters
name (str) – External name to query.
Returns
Matching identity from the provider, or None if not found.
Return type
Identity
identity_from_user(user)

Look up an identity by a linked network user.

Parameters
user (User) – Plug user referenced by the identity.
Returns
Matching identity from the provider, or None if not found.
Return type
Identity
class immp.hook.identity.WhoIsHook(name, config, host, virtual=False)

Bases: immp.core.hook.Hook

Hook to provide generic lookup of user profiles across one or more identity providers.