Skip to content

Hestabit/UserManagement

Repository files navigation

Introduction

The User Management module is a pre-built and maintained module that provides all the necessary functionality for user manangement in a Laravel project. The module includes features such as user create, users list, fetch user by id, udpate user information, delete user, fetch roles assigned to user, assign roles to user and remove role assign to user. By using this module, developers can save time and effort in implementing these common user management features in their projects, while promoting consistency and standardization in module design and implementation.for this module we are using the JWT Authentication

Requirement

  1. Laravel freamwork
  2. nWidart/laravel-modules package
  3. JWT authentication

Steps to use this module

Step 1:- Install Module Package Libraray

 composer require nwidart/laravel-modules

Step 1.1: Create Modules folder on root laravel project also register in composer.json

    {
    "autoload": {
        "psr-4": {
        "App\\": "app/",
        "Modules\\": "Modules/"
        }
    }
    }

Tip: don't forget to run composer dump-autoload afterwards

Step 1.2: clone the code in Modules folder

if don't have Modules folder on laravel root then create manually.

git clone https://github.com/Hestabit/UserManagement

Tip: don't forget to run php artisan module:enable UserManagement afterwards

Step 2:- Run php artisan migrate

Features

  1. User List
  2. Create User
  3. Fecth User Details By Id
  4. Update User
  5. Delete User
  6. Fetch The Roles Assign To User
  7. Assign Role To User
  8. Audit Logs

EndPoints

1. UserList

URL:- /api/users

Method:- GET

Request Body:-

Parameter Type Required Description
token string Yes JWT Token

2. CreateUser

URL:- /api/users/store

Method:- POST

Request Body:-

Parameter Type Required Description
name string Yes Name of the user
email email Yes Email of the user
password string Yes Password of the user
password_confirmation string Yes Confirm Pasword
token string Yes JWT Token

3. UserDetails

URL:- /api/users/{id}

Method:- GET

Request Body:-

Parameter Type Required Description
token string Yes JWT Token

4. UpdateUser

URL:- /api/users/update

Method:- PUT

Request Body:-

Parameter Type Required Description
token string Yes JWT Token
name string Yes Name of the user
email email Yes Email of the user

5. DeleteUser

URL:- /api/users/{id}
Method:- DELETE

Request Body:-

Parameter Type Required Description
token string Yes JWT Token

6. FetchTheRolesAssignToUser

URL:- /api/user/{id}/roles

Method:- GET

Request Body:-

Parameter Type Required Description
token string Yes JWT Token

7. AssignRole

URL:- /api/user/{id}/role
Method:- POST

Request Body:-

Parameter Type Required Description
token string Yes JWT Token
role_id integer Yes Role Id

8. DeleteRole

URL:- /api/user/{id}/role/{role_id}
Method:- DELETE
Parameter Type Required Description
token string Yes JWT Token

NOTE:- For testing the api you can run the following command

php artisan test Modules/UserManagement/Tests/Unit/UsersControllerTest.php

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published