users()
#
Available since 2.14.0
Loads users into the app.
This method is idempotent. If a user is defined multiple times before the app starts with the same kuid, only the last one will be retained.
This method can only be used before the application is started.
users(
users: JSONObject,
options?: {
onExistingUsers?: 'overwrite' | 'skip'
}
): void
Argument | Type | Description |
---|---|---|
users | JSONObject | Object containing users and their definitions. |
onExistingUsers | [ | Default to skip . Strategy to adopt when trying to import an already existing user. |
onExistingUsers
option applies globally for every user import even when not given in this specific call.
Usage #
app.import.users({
kuidA: {
content: {
profileIds: ['profileA', 'profileB'],
name: 'foo'
},
credentials: {
local: { username: 'bar', password: 'foobar' }
}
},
kuidB: {
content: {
profileIds: ['profileA'],
name: 'bar'
},
credentials: {
local: { username: 'foo', password: 'barfoo' }
}
},
})
Users definition and especially their credentials are sensitive data that should not be hardcoded directly in the app.
Edit this page on Github (opens new window)