Identity Module
Experimental
The Identity service lives under unique_toolkit.experimental.identity.
Its public API, method names, argument shapes, and return types may change
without notice and are not covered by the toolkit's normal stability
guarantees. Pin your toolkit version if you depend on a specific shape.
Import it via:
from unique_toolkit.experimental.identity import Identity
# or, with sub-services:
from unique_toolkit.experimental.identity import Identity, Users, Groups
Identity is a thin facade — it wires two CRUD-style sub-services,
Users and Groups, behind
identity.users and identity.groups respectively. Constructors are
keyword-only, so callers always write Identity(user_id=..., company_id=...).
Service¶
unique_toolkit.experimental.resources.facades.identity.service
¶
The :class:Identity facade — users + groups in one place.
.. warning::
**Experimental.** Lives under :mod:`unique_toolkit.experimental`. The
public API, method names, and return shapes may change without notice
and are not covered by the toolkit's normal stability guarantees.
:class:Identity is a client: it owns no CRUD logic of its own and simply
composes two resource services:
- :attr:
Identity.users— an instance of :class:~unique_toolkit.experimental.resources.user.Users. - :attr:
Identity.groups— an instance of :class:~unique_toolkit.experimental.resources.group.Groups.
Both sub-services share the same (user_id, company_id) pair, so
instantiating :class:Identity is equivalent to building both sub-services
manually.
Acting user — every API call is made on behalf of user_id. That user
needs the usual directory permissions; most reads are open to any
authenticated user, group mutations require admin-equivalent rights.
Identity
¶
Unified users + groups facade for a (user_id, company_id) context.
.. warning::
**Experimental.** Import path is
:mod:`unique_toolkit.experimental.resources.facades.identity`. The API may
change without notice.
:class:Identity owns two sub-services:
- :attr:
users— an instance of :class:~unique_toolkit.experimental.resources.user.Users. - :attr:
groups— an instance of :class:~unique_toolkit.experimental.resources.group.Groups.
Identity itself is stateless beyond the credentials it holds; the
actual CRUD surface lives on the sub-services so callers write
identity.users.list() or identity.groups.add_members(...).
Source code in unique_toolkit/unique_toolkit/experimental/resources/facades/identity/service.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
from_context(context)
classmethod
¶
Create from a :class:UniqueContext (preferred constructor).
Source code in unique_toolkit/unique_toolkit/experimental/resources/facades/identity/service.py
67 68 69 70 71 72 73 | |
from_settings(settings=None)
classmethod
¶
Create from :class:UniqueSettings — standalone convenience only.
Mirrors :meth:KnowledgeBaseService.from_settings so callers can write
Identity.from_settings() in standalone scripts:
settings=Noneauto-loads fromunique.envvia :meth:UniqueSettings.from_env_auto_with_sdk_init.settings="my.env"loads from the given env file name.settings=<UniqueSettings>uses the provided instance as-is.
.. note::
:class:`Identity` is **not** registered with
:class:`UniqueServiceFactory`; experimental services are
constructed directly so the experimental dependency stays visible
at every call site.
Source code in unique_toolkit/unique_toolkit/experimental/resources/facades/identity/service.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
Schemas¶
unique_toolkit.experimental.resources.user.schemas
¶
Pydantic schemas for the :mod:unique_toolkit.experimental.resources.user resource.
Mirrors :mod:unique_sdk.User responses with field-level documentation and
camelCase aliases so SDK wire payloads validate directly via
:func:BaseModel.model_validate. :class:UserGroupMembership is the response
shape of GET /users/{id}/groups and lives here — not in
:mod:..group.schemas — because the endpoint is rooted on the user.
UserInfo
¶
Bases: BaseModel
Directory record for a single user (GET /users/{id}).
The id field is the canonical user id used everywhere in the platform
(equivalent to uid on a Linux box). The external_id is the upstream
identity-provider id (SSO / SCIM), present on provisioned users, absent on
users created via the admin UI.
Source code in unique_toolkit/unique_toolkit/experimental/resources/user/schemas.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
UserWithConfiguration
¶
Bases: UserInfo
A :class:UserInfo plus the free-form user_configuration blob.
The configuration blob is an opaque JSON object used by apps and the frontend to store per-user preferences. The platform does not interpret it; the contract between writer and reader is entirely application-defined.
Source code in unique_toolkit/unique_toolkit/experimental/resources/user/schemas.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
UserGroupMembership
¶
Bases: BaseModel
One of the groups a user is a member of (GET /users/{id}/groups).
This is the response shape of a user endpoint — a subset of
:class:~unique_toolkit.experimental.resources.group.schemas.GroupInfo
with no members or configuration field — and therefore lives with
the users resource, not the groups resource.
Source code in unique_toolkit/unique_toolkit/experimental/resources/user/schemas.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
unique_toolkit.experimental.resources.group.schemas
¶
Pydantic schemas for the :mod:unique_toolkit.experimental.resources.group resource.
Mirrors :mod:unique_sdk.Group responses with field-level documentation and
camelCase aliases so SDK wire payloads validate directly via
:func:BaseModel.model_validate.
GroupMember
¶
Bases: BaseModel
A single member entry as returned on :class:GroupInfo.members.
Source code in unique_toolkit/unique_toolkit/experimental/resources/group/schemas.py
22 23 24 25 26 27 28 29 30 31 32 | |
GroupInfo
¶
Bases: BaseModel
Directory record for a group (GET /groups).
A group is the Unique equivalent of a POSIX group: an addressable set of
users that can be granted permissions collectively (see the folder ACL
model). Groups may be nested via :attr:parent_id.
Source code in unique_toolkit/unique_toolkit/experimental/resources/group/schemas.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
GroupWithConfiguration
¶
Bases: GroupInfo
A :class:GroupInfo plus the free-form configuration blob.
Source code in unique_toolkit/unique_toolkit/experimental/resources/group/schemas.py
69 70 71 72 73 74 75 76 77 78 79 | |
GroupMembership
¶
Bases: BaseModel
Relationship row between a user (entity_id) and a group (group_id).
Source code in unique_toolkit/unique_toolkit/experimental/resources/group/schemas.py
82 83 84 85 86 87 88 89 | |
GroupDeleted
¶
Bases: BaseModel
Response from delete_group — echoes the deleted group's id.
Source code in unique_toolkit/unique_toolkit/experimental/resources/group/schemas.py
92 93 94 95 96 97 | |