ЕСОЗ - публічна документація

Auth.Add role to users

Get users by party_id

Search users in auth.users by {party_id} and {legal_entity_id}

WHERE AUTH.users.party_id = :party_id
  AND AUTH.user_roles.client_id = :client_id
  AND AUTH.users.id = AUTH.user_roles.user_id

If no users found - return error USERS_NOT_FOUND

Add role to user

Check user role

Search user roles in auth.user_roles

WHERE AUTH.user_roles.id = :user_id
  AND AUTH.user_roles.role_id = (role_by_name(:employee_type))
  AND AUTH.user_roles.client_id = :client_id

If no roles found - Add role to user

If role found - return success response

Add role to user

Insert entity into auth.user_roles

Parameter

Source

AUTH.user_roles.id

:user_id

AUTH.user_roles.role_id

role_by_name(:employee_type)

AUTH.user_roles.client_id

:client_id

If role_by_name(:employee_type) returns empty result - return error INVALID_ROLE

ЕСОЗ - публічна документація