User Management Service

The User Management Service provides comprehensive functionality for managing users, organizations, and user groups within your application. This service handles org and user profile management, allowing for seamless user administration across your organization.

Architecture Overview

The User Management Service is built on a Node.js backend with MongoDB for data persistence. It utilizes an Inversify container for dependency injection and includes several key components:

  1. User Management - Core functionality for managing user accounts
  2. Organization Management - Controls organization-level settings and configurations
  3. User Groups Management - Manages permissions and access control through user groups

The service integrates with other components such as:

  • Auth Service - Handles authentication methods and user credentials
  • IAM Service - Manages permissions and authorization
  • Mail Service - Sends notifications and invitations
  • Configuration Manager - Manages application settings

Data Models

Organizations

Organizations represent the top-level entity that contains users and groups:

  • Organization metadata (name, domain, contact information)
  • Organization settings and configurations
  • Onboarding status tracking

Users

Users represent individual accounts within an organization:

  • Profile information (name, email, contact details)
  • Organization membership
  • Authentication status

User Groups

User Groups provide role-based access control within organizations:

  • Group types (admin, standard, everyone, custom)
  • User memberships
  • Access permissions

Organization API

The Organization API enables managing organization-level settings and configurations.

Check Organization Existence

Checks if any organization exists in the system.

GET /api/v1/org/exists

Create Organization

Creates a new organization in the system.

POST /api/v1/org

Get Organization

Retrieves the authenticated user’s organization details.

GET /api/v1/org

Update Organization

Updates organization details.

PATCH /api/v1/org

Get Onboarding Status

Retrieves the current onboarding status of the organization.

GET /api/v1/org/onboarding-status

Update Onboarding Status

Updates the organization’s onboarding status.

PUT /api/v1/org/onboarding-status

Uploads a logo for the organization.

PUT /api/v1/org/logo

Retrieves the organization’s logo.

GET /api/v1/org/logo

Removes the organization’s logo.

DELETE /api/v1/org/logo

Users API

The Users API provides endpoints for managing users within an organization.

Get All Users

Retrieves all users in the authenticated user’s organization.

GET /api/v1/users

Get All Users With Groups

Retrieves all users along with their associated groups.

GET /api/v1/users/fetch/with-groups

Get User by ID

Retrieves a specific user by their ID.

GET /api/v1/users/:id

Create User

Creates a new user in the organization.

POST /api/v1/users

Update User

Updates a user’s information.

PUT /api/v1/users/:id

Update User Specific Fields

The following endpoints update specific user fields:

Update Full Name

PATCH /api/v1/users/:id/fullname

Update First Name

PATCH /api/v1/users/:id/firstName

Update Last Name

PATCH /api/v1/users/:id/lastName

Update Designation

PATCH /api/v1/users/:id/designation

Update Email

PATCH /api/v1/users/:id/email

Bulk Invite Users

Invites multiple users to the organization by email.

POST /api/v1/users/bulk/invite

Resend User Invite

Resends an invitation to a specific user.

POST /api/v1/users/:id/resend-invite

Delete User

Soft-deletes a user from the organization.

DELETE /api/v1/users/:id

Upload User Display Picture

Uploads a profile picture for the authenticated user.

PUT /api/v1/users/dp

Get User Display Picture

Retrieves the authenticated user’s profile picture.

GET /api/v1/users/dp

Delete User Display Picture

Removes the authenticated user’s profile picture.

DELETE /api/v1/users/dp

User Groups API

The User Groups API manages group-based access control within organizations.

Create User Group

Creates a new user group in the organization.

POST /api/v1/userGroups

Get All User Groups

Retrieves all user groups in the organization.

GET /api/v1/userGroups

Get User Group By ID

Retrieves a specific user group by its ID.

GET /api/v1/userGroups/:groupId

Update User Group

Updates a user group’s information.

PUT /api/v1/userGroups/:groupId

Delete User Group

Soft-deletes a user group.

DELETE /api/v1/userGroups/:groupId

Add Users to Groups

Adds multiple users to multiple groups.

POST /api/v1/userGroups/add-users

Remove Users from Groups

Removes multiple users from multiple groups.

POST /api/v1/userGroups/remove-users

Get Users in Group

Retrieves all users in a specific group.

GET /api/v1/userGroups/:groupId/users

Get Groups for User

Retrieves all groups that a specific user belongs to.

GET /api/v1/userGroups/users/:userId

Get Group Statistics

Retrieves statistics about all groups in the organization.

GET /api/v1/userGroups/stats/list

Schema Definitions