1.0.3 • Published 4 years ago

maxipublica-auth v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Valid Authorization and Token

Installation

  • Latest release:

    $ npm i maxipublica-auth

Overview

Initialize Module

const valid = require("maxipublica-auth").Validator;
const password = "Any password";
const dbConecction = require("../database");

const valid = new mxp_valid(password, dbConecction);

Creating Authorizations

valid
  .createAuthorization({
    sellerId: "1", //sellerId is required
    userId: "5", //userId is required
    type: "admin", //type is required
    rol: "admin", //rol is required
    request: {
      post: 30, //default is 1000
      put: 60, //default is 1000
      get: 100, //default is 1000
      path: 500 //default is 1000
    }
  })
  .then(authorization => {
    /*The promise return
     *  the new authorization
     */
    return authorization;
  })
  .catch(err => {
    /*The promise error return
     * status : Number
     * name : String
     * message : String
     * customMessage : String
     */
    return err;
  });

Valid authorizations

valid
  .authorization("Any authorization", "method") //if method is undefined or null for default is get
  .then(isValid => {
    /*The promise return
     * method : String
     * request : Object
     * sellerId : Number
     * userId : Number
     * type : String
     * rol : Strings
     */
    return true;
  })
  .catch(err => {
    /*The promise error return
     * status : Number
     * name : String
     * message : String
     * customMessage : String
     */
    return err;
  });

Valid token

valid
  .token("Any token", "method") //if method is undefined or null for default is get
  .then(isValid => {
    /*The promise return
     * method : String
     * request : Object
     * sellerId : Number
     * userId : Number
     * type : String
     * rol : Strings
     */
    return true;
  })
  .catch(err => {
    /*The promise error return
     * status : Number
     * name : String
     * message : String
     * customMessage : String
     */
    return err;
  });

Autores ✒️

Menciona a todos aquellos que ayudaron a levantar el proyecto desde sus inicios

  • Claudio Ivan - Trabajo Inicial - cdelacruz
  • Ubiraja Erthal - Trabajo Inicial - uerthal

Expresiones de Gratitud 🎁

  • Invita una cerveza 🍺 a alguien del equipo.
  • Da las gracias públicamente 🤓.
  • etc.

⌨️ con ❤️ por cdelacruz 😊

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago