Users
albert.resources.users
UserClass
The ACL class level of a user, setting a broad permission tier.
Attributes:
| Name | Type | Description |
|---|---|---|
GUEST |
str
|
Most limited access; typically external or temporary users. |
STANDARD |
str
|
Default access level for regular users. |
TRUSTED |
str
|
Elevated access above standard users. |
PRIVILEGED |
str
|
High access level below full administrators. |
ADMIN |
str
|
Full administrative access to the tenant. |
UserFilterType
User
Bases: BaseResource
An Albert user account: a person who can log in and act in the platform.
A user has a name and email, an optional home
Location, and a set of
Role objects that govern what they can do.
The user_class sets a broad permission tier
(UserClass). Users are grouped into teams
(Team), and are referenced across the
platform, for example as the assignee of a Task or in an entity's ACL.
Example
Show JSON schema:
{
"$defs": {
"AuditFields": {
"description": "The audit fields for a resource",
"properties": {
"by": {
"default": null,
"title": "By",
"type": "string"
},
"byName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Byname"
},
"at": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "At"
}
},
"title": "AuditFields",
"type": "object"
},
"EntityLink": {
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"category": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Category"
}
},
"required": [
"id"
],
"title": "EntityLink",
"type": "object"
},
"EntityLinkWithName": {
"description": "EntityLink that includes the name field in serialization.",
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"category": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Category"
}
},
"required": [
"id"
],
"title": "EntityLinkWithName",
"type": "object"
},
"Location": {
"description": "A physical lab or site location in Albert.\n\nLocations are referenced by Tasks and Inventory Items to record where an\nactivity is performed or where a material lives, and each Location can hold\none or more Storage Locations\n([`StorageLocation`][albert.resources.storage_locations.StorageLocation]). Managed\nthrough [`LocationCollection`][albert.collections.locations.LocationCollection].\n\n!!! example\n ```python\n from albert.resources.locations import Location\n location = Location(\n name=\"Boston Lab\",\n latitude=42.3601,\n longitude=-71.0589,\n address=\"1 Main St\",\n country=\"US\",\n )\n ```",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null,
"description": "The status of the resource, optional."
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the creation of the resource, optional."
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the update of the resource, optional."
},
"name": {
"description": "The human-readable name of the location.",
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert ID of the location. Assigned by Albert and populated once the location has been created or retrieved.",
"title": "Albertid"
},
"latitude": {
"description": "The latitude of the location, in decimal degrees.",
"title": "Latitude",
"type": "number"
},
"longitude": {
"description": "The longitude of the location, in decimal degrees.",
"title": "Longitude",
"type": "number"
},
"address": {
"description": "The street address of the location.",
"title": "Address",
"type": "string"
},
"country": {
"anyOf": [
{
"maxLength": 2,
"minLength": 2,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The two-letter country code of the location (for example, ``\"US\"``).",
"title": "Country"
}
},
"required": [
"name",
"latitude",
"longitude",
"address"
],
"title": "Location",
"type": "object"
},
"Role": {
"description": "A named set of access permissions within a tenant.\n\nA role bundles policies that determine what a holder is allowed to do. Roles\nare assigned to users ([`User`][albert.resources.users.User]) and referenced\nby entity ACLs. Roles are typically read from Albert rather than built by\nhand.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null,
"description": "The status of the resource, optional."
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the creation of the resource, optional."
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the update of the resource, optional."
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert ID of the role. Role IDs may contain ``#`` characters. Set once the role is retrieved from Albert.",
"title": "Albertid"
},
"name": {
"description": "The display name of the role.",
"title": "Name",
"type": "string"
},
"Policies": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "The policies (permission rules) associated with the role.",
"title": "Policies"
},
"tenant": {
"description": "The ID of the tenant the role belongs to.",
"title": "Tenant",
"type": "string"
},
"visibility": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Whether the role is visible in the platform's role listings.",
"title": "Visibility"
}
},
"required": [
"name",
"tenant"
],
"title": "Role",
"type": "object"
},
"Status": {
"description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n The resource is fully operational and visible in normal operations.\nINACTIVE : str\n The resource is hidden from normal operations and disabled from use.",
"enum": [
"active",
"inactive"
],
"title": "Status",
"type": "string"
},
"UserClass": {
"description": "The ACL class level of a user, setting a broad permission tier.\n\nAttributes\n----------\nGUEST : str\n Most limited access; typically external or temporary users.\nSTANDARD : str\n Default access level for regular users.\nTRUSTED : str\n Elevated access above standard users.\nPRIVILEGED : str\n High access level below full administrators.\nADMIN : str\n Full administrative access to the tenant.",
"enum": [
"guest",
"standard",
"trusted",
"privileged",
"admin"
],
"title": "UserClass",
"type": "string"
}
},
"description": "An Albert user account: a person who can log in and act in the platform.\n\nA user has a name and email, an optional home\n[`Location`][albert.resources.locations.Location], and a set of\n[`Role`][albert.resources.roles.Role] objects that govern what they can do.\nThe ``user_class`` sets a broad permission tier\n([`UserClass`][albert.resources.users.UserClass]). Users are grouped into teams\n([`Team`][albert.resources.teams.Team]), and are referenced across the\nplatform, for example as the assignee of a Task or in an entity's ACL.\n\n!!! example\n ```python\n from albert.resources.users import User, UserClass\n user = User(\n name=\"Ada Lovelace\",\n email=\"ada@example.com\",\n user_class=UserClass.STANDARD,\n )\n ```",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null,
"description": "The status of the resource, optional."
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the creation of the resource, optional."
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the update of the resource, optional."
},
"name": {
"description": "The display name of the user.",
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert User ID (format ``USR...``). Set once the user is registered in or retrieved from Albert.",
"title": "Albertid"
},
"Location": {
"anyOf": [
{
"$ref": "#/$defs/Location"
},
{
"$ref": "#/$defs/EntityLink"
},
{
"type": "null"
}
],
"default": null,
"description": "The user's home location.",
"title": "Location"
},
"email": {
"default": null,
"description": "The user's email address.",
"format": "email",
"title": "Email",
"type": "string"
},
"Roles": {
"description": "The roles the user holds, which determine their permissions.",
"items": {
"anyOf": [
{
"$ref": "#/$defs/Role"
},
{
"$ref": "#/$defs/EntityLink"
}
]
},
"maxItems": 1,
"title": "Roles",
"type": "array"
},
"userClass": {
"$ref": "#/$defs/UserClass",
"default": "standard",
"description": "The ACL class level of the user (broad permission tier)."
},
"witnesser": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Whether the user can act as a witness on tasks (only relevant when witnessing is enabled for the tenant).",
"title": "Witnesser"
},
"Metadata": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
},
{
"type": "string"
},
{
"$ref": "#/$defs/EntityLinkWithName"
},
{
"$ref": "#/$defs/EntityLink"
},
{
"items": {
"anyOf": [
{
"$ref": "#/$defs/EntityLinkWithName"
},
{
"$ref": "#/$defs/EntityLink"
}
]
},
"type": "array"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"description": "Custom metadata attached to the user.",
"title": "Metadata"
}
},
"required": [
"name"
],
"title": "User",
"type": "object"
}
Fields:
-
status(Status | None) -
created(AuditFields | None) -
updated(AuditFields | None) -
name(str) -
id(UserId | None) -
location(SerializeAsEntityLink[Location] | None) -
email(EmailStr) -
roles(list[SerializeAsEntityLink[Role]]) -
user_class(UserClass) -
witnesser(bool | None) -
metadata(dict[str, MetadataItem] | None)
id
id: UserId | None = None
The Albert User ID (format USR...). Set once the user is registered in or retrieved from Albert.
roles
The roles the user holds, which determine their permissions.
user_class
The ACL class level of the user (broad permission tier).
witnesser
witnesser: bool | None = None
Whether the user can act as a witness on tasks (only relevant when witnessing is enabled for the tenant).
UserSearchRoleItem
Bases: BaseAlbertModel
A role reference as returned within a user search result.
Show JSON schema:
{
"description": "A role reference as returned within a user search result.",
"properties": {
"roleId": {
"description": "The Albert ID of the role.",
"title": "Roleid",
"type": "string"
},
"roleName": {
"description": "The display name of the role.",
"title": "Rolename",
"type": "string"
}
},
"required": [
"roleId",
"roleName"
],
"title": "UserSearchRoleItem",
"type": "object"
}
Fields:
UserSearchItem
Bases: BaseAlbertModel, HydrationMixin[User]
A partial user as returned by search.
Search returns these lightweight items for speed. Call
hydrate() to fetch the full
User.
Show JSON schema:
{
"$defs": {
"UserClass": {
"description": "The ACL class level of a user, setting a broad permission tier.\n\nAttributes\n----------\nGUEST : str\n Most limited access; typically external or temporary users.\nSTANDARD : str\n Default access level for regular users.\nTRUSTED : str\n Elevated access above standard users.\nPRIVILEGED : str\n High access level below full administrators.\nADMIN : str\n Full administrative access to the tenant.",
"enum": [
"guest",
"standard",
"trusted",
"privileged",
"admin"
],
"title": "UserClass",
"type": "string"
},
"UserSearchRoleItem": {
"description": "A role reference as returned within a user search result.",
"properties": {
"roleId": {
"description": "The Albert ID of the role.",
"title": "Roleid",
"type": "string"
},
"roleName": {
"description": "The display name of the role.",
"title": "Rolename",
"type": "string"
}
},
"required": [
"roleId",
"roleName"
],
"title": "UserSearchRoleItem",
"type": "object"
}
},
"description": "A partial user as returned by [`search`][albert.collections.users.UserCollection.search].\n\nSearch returns these lightweight items for speed. Call\n`hydrate()` to fetch the full\n[`User`][albert.resources.users.User].",
"properties": {
"name": {
"description": "The display name of the user.",
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert User ID (format ``USR...``).",
"title": "Albertid"
},
"email": {
"anyOf": [
{
"format": "email",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The user's email address.",
"title": "Email"
},
"userClass": {
"$ref": "#/$defs/UserClass",
"default": "standard",
"description": "The ACL class level of the user (broad permission tier)."
},
"lastLoginTime": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "When the user most recently signed in.",
"title": "Lastlogintime"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The name of the user's home location.",
"title": "Location"
},
"locationId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The ID of the user's home location.",
"title": "Locationid"
},
"role": {
"description": "The roles the user holds.",
"items": {
"$ref": "#/$defs/UserSearchRoleItem"
},
"maxItems": 1,
"title": "Role",
"type": "array"
},
"subscription": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The user's subscription type.",
"title": "Subscription"
}
},
"required": [
"name"
],
"title": "UserSearchItem",
"type": "object"
}
Fields:
-
name(str) -
id(UserId | None) -
email(EmailStr | None) -
user_class(UserClass) -
last_login_time(datetime | None) -
location(str | None) -
location_id(str | None) -
roles(list[UserSearchRoleItem]) -
subscription(str | None)
user_class
The ACL class level of the user (broad permission tier).