ЕСОЗ - публічна документація
Create User
Specification
Apiary | |
POST | mithril/api/users |
Scope |
Purpose
Modification existing WS: Create a user:
- Add `is_blocked`, `block_reason` column in user entity
- Add new fields into `priv_settings`
- Add new attribute `2fa_enable` to WS request
- Add logic for create 2FA item for new user
Request parameters
Add new parameters:
- 2fa_enable (boolean, optional)
Logic WS
Create user with this structure in `users.priv_settings`:
{ "login_error_counter": 0, "otp_error_counter": 0 }
and this values for new columns:
- is_blocked = FALSE
- block_reason = NULL
- After insert new user in `users`
- Analyze $.2fa_enable
- If $.2fa_enable = FALSE - break
- If $.2fa_enable = TRUE
- Insert new record in `authentication_factors` with logical status = RESET
- user_id = $.user_id
- type = `SMS`
- factor = NULL
- is_active = TRUE
- update_at = now()
- Insert new record in `authentication_factors` with logical status = RESET
- If $.2fa_enable = NULL or empty
- Get config-param `USER_2FA_ENABLED`
- If `USER_2FA_ENABLED` = TRUE
- Insert new record in `authentication_factors` with logical status = RESET
- user_id = $.user_id
- type = `SMS`
- factor = NULL
- is_active = TRUE
- update_at = now()
- Insert new record in `authentication_factors` with logical status = RESET
Response
- 201 if user successful unblock + user_object_view
- 4xx in other case
ЕСОЗ - публічна документація