Skip to content

Latest commit

 

History

History
852 lines (473 loc) · 18.6 KB

class.UsersService.md

File metadata and controls

852 lines (473 loc) · 18.6 KB

directus-monorepo ( Readme | API )


directus-monorepo > UsersService

Class: UsersService

Extends

Constructors

constructor()

new UsersService(options): UsersService

Parameters

Parameter Type
options AbstractServiceOptions

Returns

UsersService

Overrides

ItemsService.constructor

Source

api/src/services/users.ts:22

Properties

accountability

accountability: any

Source

api/src/services/items.ts:43

Inherited from

ItemsService.accountability


cache

cache: null | Keyv< any, Record< string, unknown > >

Source

api/src/services/items.ts:46

Inherited from

ItemsService.cache


collection

collection: string

Source

api/src/services/items.ts:41

Inherited from

ItemsService.collection


eventScope

eventScope: string

Source

api/src/services/items.ts:44

Inherited from

ItemsService.eventScope


knex

knex: Knex< any, any[] >

Source

api/src/services/items.ts:42

Inherited from

ItemsService.knex


schema

schema: SchemaOverview

Source

api/src/services/items.ts:45

Inherited from

ItemsService.schema

Methods

acceptInvite()

acceptInvite(token, password): Promise< void >

Parameters

Parameter Type
token string
password string

Returns

Promise< void >

Source

api/src/services/users.ts:410


checkPasswordPolicy()

private checkPasswordPolicy(passwords): Promise< void >

Check if the provided password matches the strictness as configured in directus_settings.auth_password_policy

Parameters

Parameter Type
passwords string[]

Returns

Promise< void >

Source

api/src/services/users.ts:69


checkRemainingActiveAdmin()

private checkRemainingActiveAdmin(excludeKeys): Promise< void >

Make sure there's at least one active admin user when updating user status

Parameters

Parameter Type
excludeKeys PrimaryKey[]

Returns

Promise< void >

Source

api/src/services/users.ts:122


checkRemainingAdminExistence()

private checkRemainingAdminExistence(excludeKeys): Promise< void >

Parameters

Parameter Type
excludeKeys PrimaryKey[]

Returns

Promise< void >

Source

api/src/services/users.ts:102


checkUniqueEmails()

private checkUniqueEmails(emails, excludeKey?): Promise< void >

User email has to be unique case-insensitive. This is an additional check to make sure that the email is unique regardless of casing

Parameters

Parameter Type
emails string[]
excludeKey? PrimaryKey

Returns

Promise< void >

Source

api/src/services/users.ts:34


createMany()

createMany(data, opts?): Promise< PrimaryKey[] >

Create multiple new users

Parameters

Parameter Type
data Partial< Item >[]
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.createMany

Source

api/src/services/users.ts:194


createMutationTracker()

createMutationTracker(initialCount = 0): MutationTracker

Parameters

Parameter Type Default value
initialCount number 0

Returns

MutationTracker

Inherited from

ItemsService.createMutationTracker

Source

api/src/services/items.ts:59


createOne()

createOne(data, opts?): Promise< PrimaryKey >

Create a new user

Parameters

Parameter Type
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Overrides

ItemsService.createOne

Source

api/src/services/users.ts:186


deleteByQuery()

deleteByQuery(query, opts?): Promise< PrimaryKey[] >

Delete multiple items by query

Parameters

Parameter Type
query Query
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.deleteByQuery

Source

api/src/services/users.ts:341


deleteMany()

deleteMany(keys, opts?): Promise< PrimaryKey[] >

Delete multiple users by primary key

Parameters

Parameter Type
keys PrimaryKey[]
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.deleteMany

Source

api/src/services/users.ts:326


deleteOne()

deleteOne(key, opts?): Promise< PrimaryKey >

Delete a single user by primary key

Parameters

Parameter Type
key PrimaryKey
opts? MutationOptions

Returns

Promise< PrimaryKey >

Overrides

ItemsService.deleteOne

Source

api/src/services/users.ts:318


getKeysByQuery()

getKeysByQuery(query): Promise< PrimaryKey[] >

Parameters

Parameter Type
query Query

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.getKeysByQuery

Source

api/src/services/items.ts:76


getUserByEmail()

private getUserByEmail(email): Promise< {id: string; password: string; role: string; status: string;} >

Get basic information of user identified by email

Parameters

Parameter Type
email string

Returns

Promise< {id: string; password: string; role: string; status: string;} >

Source

api/src/services/users.ts:142


inviteUrl()

private inviteUrl(email, url): string

Create url for inviting users

Parameters

Parameter Type
email string
url null | string

Returns

string

Source

api/src/services/users.ts:153


inviteUser()

inviteUser( email, role, url, subject?): Promise< void >

Parameters

Parameter Type
email string | string[]
role string
url null | string
subject? null | string

Returns

Promise< void >

Source

api/src/services/users.ts:360


readByQuery()

readByQuery(query, opts?): Promise< Item[] >

Get items by query

Parameters

Parameter Type
query Query
opts? QueryOptions

Returns

Promise< Item[] >

Inherited from

ItemsService.readByQuery

Source

api/src/services/items.ts:395


readMany()

readMany( keys, query = {}, opts?): Promise< Item[] >

Get multiple items by primary keys

Parameters

Parameter Type
keys PrimaryKey[]
query Query
opts? QueryOptions

Returns

Promise< Item[] >

Inherited from

ItemsService.readMany

Source

api/src/services/items.ts:501


readOne()

readOne( key, query = {}, opts?): Promise< Item >

Get single item by primary key

Parameters

Parameter Type
key PrimaryKey
query Query
opts? QueryOptions

Returns

Promise< Item >

Inherited from

ItemsService.readOne

Source

api/src/services/items.ts:482


readSingleton()

readSingleton(query, opts?): Promise< Partial< Item > >

Read/treat collection as singleton

Parameters

Parameter Type
query Query
opts? QueryOptions

Returns

Promise< Partial< Item > >

Inherited from

ItemsService.readSingleton

Source

api/src/services/items.ts:982


requestPasswordReset()

requestPasswordReset( email, url, subject?): Promise< void >

Parameters

Parameter Type
email string
url null | string
subject? null | string

Returns

Promise< void >

Source

api/src/services/users.ts:433


resetPassword()

resetPassword(token, password): Promise< void >

Parameters

Parameter Type
token string
password string

Returns

Promise< void >

Source

api/src/services/users.ts:478


updateBatch()

updateBatch(data, opts = {}): Promise< PrimaryKey[] >

Update multiple items in a single transaction

Parameters

Parameter Type
data Partial< Item >[]
opts MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.updateBatch

Source

api/src/services/users.ts:230


updateByQuery()

updateByQuery( query, data, opts?): Promise< PrimaryKey[] >

Update many users by query

Parameters

Parameter Type
query Query
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.updateByQuery

Source

api/src/services/users.ts:217


updateMany()

updateMany( keys, data, opts?): Promise< PrimaryKey[] >

Update many users by primary key

Parameters

Parameter Type
keys PrimaryKey[]
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey[] >

Overrides

ItemsService.updateMany

Source

api/src/services/users.ts:256


updateOne()

updateOne( key, data, opts?): Promise< PrimaryKey >

Update a single user by primary key

Parameters

Parameter Type
key PrimaryKey
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Overrides

ItemsService.updateOne

Source

api/src/services/users.ts:225


upsertMany()

upsertMany(payloads, opts = {}): Promise< PrimaryKey[] >

Upsert many items

Parameters

Parameter Type
payloads Partial< Item >[]
opts MutationOptions

Returns

Promise< PrimaryKey[] >

Inherited from

ItemsService.upsertMany

Source

api/src/services/items.ts:829


upsertOne()

upsertOne(payload, opts?): Promise< PrimaryKey >

Upsert a single item

Parameters

Parameter Type
payload Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.upsertOne

Source

api/src/services/items.ts:803


upsertSingleton()

upsertSingleton(data, opts?): Promise< PrimaryKey >

Upsert/treat collection as singleton

Parameters

Parameter Type
data Partial< Item >
opts? MutationOptions

Returns

Promise< PrimaryKey >

Inherited from

ItemsService.upsertSingleton

Source

api/src/services/items.ts:1018


validateEmail()

private validateEmail(input): void

Validate array of emails. Intended to be used with create/update users

Parameters

Parameter Type
input string | string[]

Returns

void

Source

api/src/services/users.ts:166


Generated using TypeDoc and typedoc-plugin-markdown