hook.identitylocal¶
- class immp.hook.identitylocal.IdentityGroup(**kwargs: Any)¶
Bases:
Model
Representation of a single identity.
- links¶
All links contained by this group.
- Type:
.IdentityLink iterable
- class immp.hook.identitylocal.IdentityLink(**kwargs: Any)¶
Bases:
Model
Single link between an identity and a user.
- group¶
Containing group instance.
- Type:
.IdentityGroup
- class immp.hook.identitylocal.IdentityRole(**kwargs: Any)¶
Bases:
Model
Assignment of a role to an identity.
- group¶
Containing group instance.
- Type:
.IdentityGroup
- class immp.hook.identitylocal.LocalIdentityHook(name, config, host, virtual=False)¶
Bases:
Hook
,AccessPredicate
,IdentityProvider
Hook for managing physical users with multiple logical links across different plugs. This effectively provides self-service identities, as opposed to being provided externally.
- on_load()¶
Perform any additional one-time setup that requires other plugs or hooks to be loaded.
- async start()¶
Perform any underlying operations needed to ready this resource for use, such as opening connections to an external network or API.
If using an event-driven framework that yields and runs in the background, you should use a signal of some form (e.g.
asyncio.Condition
) to block this method until the framework is ready for use.
- async get(name)¶
Retrieve the identity group using the given name.
- Parameters:
name (str) – Existing name to query.
- Returns:
Linked identity, or
None
if not linked.- Return type:
.IdentityGroup
- async find(user)¶
Retrieve the identity that contains the given user, if one exists.
- Parameters:
user (.User) – Existing user to query.
- Returns:
Linked identity, or
None
if not linked.- Return type:
.IdentityGroup
- async channel_access(channel, user)¶
Verify if a user is allowed access to a channel.
- Parameters:
channel (.Channel) – Target channel.
user (.User) – User to be verified.
- Returns:
True
to grant access for this user to the given channel,False
to deny access, orNone
to abstain from a decision.- Return type:
- async 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
- async 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