Users Management Project

Overview

This is a project designed to implement user management features, including:

  • Register / Login
  • Reset password
  • Integrate social login API
  • Assign permissions by roles, capabilities and departments.
  • Back-end uses PHP, Go and Node.js
  • Front-end uses ReactJS
  • Database uses MySQL
  • Server uses Amazon EC2 T2 + Ubuntu to run code, Amazon RDS + MySQL to run database.

Demo

  • Updating…

Design Database

The database includes the following tables:

  1. users
  2. social_accounts
  3. password_resets
  4. roles
  5. capabilities
  6. departments
  7. user_roles
  8. role_capabilities
  9. user_departments

Table users

ColumnTypeDescription
idBIGINT (PK)Primary Key
emailVARCHAR(255)User email, unique
password_hashVARCHAR(255)Password encoding
nameVARCHAR(255)Display name
is_activeBOOLEANStatus
created_atDATETIMEDate created
updated_atDATETIMEDate updated

Table social_accounts

ColumnTypeDescription
idBIGINT (PK)Primary Key
user_idBIGINT (FK)Links to users
providerVARCHAR(50)google, facebook, github
provider_user_idVARCHAR(255)User ID from provider
created_atDATETIMETime of link

Table password_resets

ColumnTypeDescription
idBIGINT (PK)Primary Key
user_idBIGINT (FK)Links to users
tokenVARCHAR(255)Authentication Token
expires_atDATETIMEExpiration date
created_atDATETIMEDate created

Table roles

ColumnTypeDescription
idINT (PK)Primary Key
nameVARCHAR(100)Role name, e.g.: admin, editor, viewer

Table capabilities

ColumnTypeDescription
idINT (PK)Primary Key
nameVARCHAR(100)E.g.: edit_post, delete_user, view_report

Table departments

ColumnTypeDescription
idINT (PK)Primary Key
nameVARCHAR(100)Deparment name, e.g.: IT, Sales, HR

Table user_roles

ColumnTypeDescription
user_idBIGINT (FK)Links to users
role_idINT (FK)Links to roles

Table role_capabilities

ColumnTypeDescription
role_idINT (FK)Role
capability_idINT (FK)Capability

Table user_departments

ColumnTypeDescription
user_idBIGINT (FK)User
department_idINT (FK)Department

Set up server

Implement Back-end code