Links

User

The IUser interface represents the User object defining the properties and their types that can be associated with a user. User information is stored in the users collection on MongoDB.
Main Interface
The main interface of a User object.
interface IUser {
_id: string;
createdAt: Date;
roles: IRole['_id'][];
type: string;
active: boolean;
username?: string;
nickname?: string;
name?: string;
services?: IUserServices;
emails?: IUserEmail[];
status?: UserStatus;
statusConnection?: string;
lastLogin?: Date;
bio?: string;
avatarOrigin?: string;
avatarETag?: string;
avatarUrl?: string;
utcOffset?: number;
language?: string;
statusDefault?: UserStatus;
statusText?: string;
oauth?: {
authorizedClients: string[];
};
_updatedAt: Date;
e2e?: {
private_key: string;
public_key: string;
};
requirePasswordChange?: boolean;
customFields?: {
[key: string]: any;
};
settings?: IUserSettings;
defaultRoom?: string;
ldap?: boolean;
extension?: string;
inviteToken?: string;
canViewAllInfo?: boolean;
phone?: string;
reason?: string;
federated?: boolean;
federation?: {
avatarUrl?: string;
searchedServerNames?: string[];
};
banners?: {
[key: string]: {
id: string;
priority: number;
title: string;
text: string;
textArguments?: string[];
modifiers: ('large' | 'danger')[];
link: string;
read?: boolean;
};
};
importIds?: string[];
}
For more information and details on the Interface and sub-Interfaces, see the code here

User Object

Example Object
{
"_id": "gzvcvpov9G4TxbGFS",
"createdAt": {
"$date": "2023-03-02T17:59:43.415Z"
},
"services": {
"password": {
"bcrypt": "$2b$10$u..."
},
"email2fa": {
"enabled": true,
"changedAt": {
"$date": "2023-03-02T17:59:43.415Z"
}
},
"resume": {
"loginTokens": []
}
},
"username": "demouser",
"emails": [
{
"address": "[email protected]",
"verified": true
}
],
"type": "user",
"status": "offline",
"active": true,
"_updatedAt": {
"$date": "2023-03-02T18:47:15.205Z"
},
"__rooms": [
"GENERAL"
],
"roles": [
"user"
],
"name": "demouser",
"requirePasswordChange": false,
"settings": {},
"lastLogin": {
"$date": "2023-03-02T18:14:28.122Z"
},
"statusConnection": "offline",
"e2e": {
"private_key": "{\"$binary\":\"m4E7yE/...==\"}",
"public_key": "{\"alg\":\"RSA-OAEP-256\",\"e\":\"AQAB\",\"ext\":true,\"key_ops\":[\"encrypt\"],\"kty\":\"RSA\",\"n\":\"0pbPAF67...w\"}"
},
"utcOffset": 1
}

Fields

The User object has these fields with the following data types.
_id
string
The unique identifier for the user.
createdAt
Date
The date and time when the user was created.
roles
Array of strings
An array of role IDs associated with the user. Eg "user", "admin", “livechat-agent”
type
string
The type of user. E.g. “user”, “app” or “bot”
active
boolean
Indicates whether the user is active or not.
username
string
The username of the user.
nickname
string
The nickname of the user.
name
string
The name of the user.
services
object
Additional services associated with the user.
emails
Array of objects
An array of email objects associated with the user.
status
string
The status of the user.
statusConnection
string
The status connection of the user.
lastLogin
Date
The date and time of the user's last login.
bio
string
The biography or description of the user.
avatarOrigin
string
The origin of the user's avatar.
avatarETag
string
The ETag of the user's avatar.
avatarUrl
string
The URL of the user's avatar.
utcOffset
number
The UTC offset of the user's timezone.
language
string
The language preference of the user.
statusDefault
string
The default status of the user.
statusText
string
The custom status text of the user.
oauth
object
OAuth information associated with the user.
_updatedAt
Date
The date and time when the user object was last updated.
e2e
object
End-to-end encryption information associated with the user.
requirePasswordChange
boolean
Indicates whether the user needs to change their password.
customFields
object
Additional custom fields associated with the user.
settings
object
User-specific settings.
defaultRoom
string
The ID of the user's default room.
ldap
boolean
Indicates whether the user is an LDAP user.
extension
string
The extension associated with the user.
inviteToken
string
The token for inviting the user.
canViewAllInfo
boolean
Indicates whether the user can view all information.
phone
string
The phone number associated with the user.
reason
string
The reason associated with the user.
federated
boolean
Indicates whether the user is a federated user.
federation
object
Federation information associated with the user.
banners
object
Banner information associated with the user.
importIds
Array of strings
An array of import IDs associated with the user.
Last modified 5mo ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.