Giter Site home page Giter Site logo

liateamproject's Introduction

LiaTeam

About

Lia company employment project :

It is a project in which the possibility of registering, login and editing users and controlling the access level of users has been implemented. In this project, by passport scope, three types of roles are envisaged(superAdmin,admin,basic), and each of which has a specific level of access. Therefore, each token that is created has a specific access level.

How can I run it?

#1 Execute composer install command.

composer install

#2 Create a database in your machin and set configs in .env file and run below commands .

php artisan key:generate
php artisan config:cache

#3 Run migrate command for create the tables.

php artisan migrate

#4 You should execute the passport:install Artisan command. This command will create the encryption keys needed to generate secure access tokens .

composer require laravel/passport
php artisan passport:install

#5 Run below command for create sample user.

php artisan db:seed

#6 Run below command for start the app.

php artisan serve

#7 Make sure everything is OK! ๐Ÿ˜‰

How can I dive into?

#1 Authentication section

Do Register

curl -X POST "http://localhost/api/v1/auth/register" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"name": "your name", "email": "your email", "password": "your password", "password_confirmation": "your password"}'
Result sample
{
  "message": "User creation is successful!",
  "user": {
   "id": ?,
    "name": "Your name",
    "email": "Your email",
    "created_at": "create datetime",
    "updated_at": "update dateTime"
  },
  "token": "eyJ0eXAiO.........."
}

Do login

curl -X POST "http://localhost/api/v1/auth/login" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"email": "your email", "password": "your password"}'
Result sample
{
  "message": "Successful login!",
  "user": {
    "name": "your name",
    "email": "your email"
  },
  "token": "eyJ0eXAiO.........."
}

#2 user section

get all users list (Note: Any type of user has access to this data.)

curl -X GET "http://localhost:8000/api/v1/user/usersList" -H "Accept: application/json" -H "Authorization: Bearer token"
Result sample
{
    "message": "Successful get user info",
    "data": [
        {
            "id": ?,
            "name": "User name",
            "email": "User email address",
            "created_at": "create datetime",
            "updated_at": "update dateTime"
        },
        .
        .
        .
    ]
}

Get a user by id (Note: Any type of user has access to this data.)

curl -X GET "http://localhost:8000/api/v1/user/getUser/?" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer token"
Result sample
{
  "message": "Successful get user info",
    "data": {
        "id": ?,
        "name": "User name",
        "email": "User email address",
        "created_at": "create datetime",
        "updated_at": "update dateTime"
    }
  ]
}

update user name and password (Note: superAdmin and admin has access to this action.)

curl -X GET "localhost:8000/api/v1/user/update/?" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer token" -d '{"name": "Your name", "password": "your password"}'
Result sample
{
  {
     "message": "Successfull update info."
  }
}

Delete user (Note: only superAdmin has access to this action.)

curl -X DELETE "http://localhost/api/v1/user/delete/?" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer token"
Result sample
{
  {
    "message": "Successfull delete user"
  }
}

#3 Message section

change user role (Note: only superAdmin has access to this action.)

curl -X GET "http://localhost:8000/api/v1/role/change/3" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer token" -d '{"role": "admin"}'
Result sample
{
  "message": "Successfull update role."
}

liateamproject's People

Contributors

mehrdad199511 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.