- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
- Object types
- Data types
-
Global constants
- Application
- ApplicationUserProfile
- ApplicationWithBatcher
- ApplicationWithParams
- BrandingSettings
- CompanyInfo
- Converter
- Directories
- Files
- HttpApiHandler
- HttpApiRequest
- ICache
- IStorage
- MailMessage
- Mailbox
- OrganisationStructure
- OrganisationStructureTree
- Portal
- PortalPageInfo
- PortalSettings
- Portals
- Process
- Processes
- ProductionSchedule
- Reminders
- Replacements
- Serial
- ServerCollection
- Service
- SignupUrlParams
- SystemCollections
- SystemCollectionsWithEvents
- SystemCollectionsWithFilterEvents
- Templater
- Translator
- UserGroups
- Users
- Watermarks
- Report
- Reports
- SR
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
User object
Used to search by user, create new users, get the current user, or request
password reset.
Hierarchy
Methods
addOAuth2Data
The method adds OAuth2 as an available authentication type for a user.
const user = await System.users.search().where(f => f.email. eq('mail@example.com')).first(); const oauth2Record: OAuth2Record = {externalId: 'someId', providerId: 'someId'}; await System.users. addOAuth2Data(user, oauth2Record);
Parameters
user: UserItemRef
oauth2Data: TOAuth2
Returns Promise<void>
create
The method is used to initialize a new user.
For new users,
email
is a mandatory parameter. When you enter the new user’s data, you need to save the user using the UserItem.save method.const newUser = System.users.create(); newUser.data.email = 'mail@example.com'; await newUser.save()
Returns UserItem
createWithAuthData
The allows initializing a new user in the Active status with filled out OAuth2 parameters.
For new users,
email
is a mandatory parameter. When you enter the new user’s data, you need to save the user using the UserItem.save method.const oauth2Record: OAuth2Record = {externalId: 'someId', providerId: 'someId'}; const authData: AuthData = {oauth2: [oauth2Record]}; const newUser = System.users.createWithAuthData(authData); newUser.data.email = 'mail@example.com'; await newUser.save()
Parameters
authData: AuthData
Returns UserItem
getCurrentUser
The method returns the current user.
const currentUser = await System.users.getCurrentUser();
Returns Promise<CurrentUserItem>
removeOAuth2Data
The method deletes OAuth2 as an available authentication type for a user.
const user = await System.users.search().where(f => f.email. eq('mail@example.com')).first(); const oauth2Record: OAuth2Record = {externalId: 'someId', providerId: 'someId'}; await System.users. removeOAuth2Data(user, oauth2Record);
Parameters
user: UserItemRef
oauth2Data: TOAuth2
Returns Promise<void>
requestPasswordRecovery
The method generates a new link to restore a user’s password.
and sends it to the email passed as the parameter.
Parameters
email: string
Returns Promise<void>
search
The method is used to search for users.
To search for items in the collection, use the Search object:
const users = await System.users.search() .where(f => f. email.eq('email@example.com')) .all();
Example of searching by a user’s status:
const users = await System.users.search() .where(u => u.__status.eq(UserStatus.Blocked)) .all();
Read more about using search in the Manage apps article.
Returns UserSearch
Methods