Skip to content

# User

## user : `object`

Access data about employees.

Kind: global namespace

- user : `object`
  - .User
    - new User(id, name, password, barcode, enabled)
  - .getUser() ⇒ `User`
  - .getUserID() ⇒ `number`
  - .getUserByID() ⇒ `Promise.<User>`
  - .listUsers([managerMode]) ⇒ `Promise.<Array.<User>>`

### user.User

Kind: static class of `user`
Properties

Name | Type | Description
--- | --- | ---
id | `number` |
name | `string` |
pass | `string` |
barcode | `string` |
enabled | `boolean` |
hasPassword() | `function` | Returns true if the user has a password set, else false.
checkPassword(string) | `function` | Returns true if the provided password matches the user's password, or if there is no password set.
icon(number) | `function` | Returns a SVG data URI with a procedurally-generated icon for the user. Size defaults to 50px if not specified.

#### new User(id, name, password, barcode, enabled)

A User object.

Param | Type
--- | ---
id | `number`
name | `string`
password | `string`
barcode | `string`
enabled | `boolean`

### user.getUser() ⇒ `User`

Get the user currently logged in.

Kind: static method of `user`

### user.getUserID() ⇒ `number`

Get the current user's ID number.

Kind: static method of `user`

### user.getUserByID() ⇒ `Promise.<User>`

Look up the User for an ID number.

Kind: static method of `user`

### user.listUsers([managerMode]) ⇒ `Promise.<Array.<User>>`

Get a list of all users in the system.

Kind: static method of `user`

Param | Type | Default | Description
--- | --- | --- | ---
[managerMode] | `boolean` | `false` | If false, list only active/enabled users, and if no users, return a default user account (user ID -1). If true, return all users in the database, and don't return a default account if the list is empty (return an empty list instead).