Giter Club home page Giter Club logo

justine-api's Introduction

justine

Una API REST para acceder a la administración de usuarios y grupos en en Samba4

Desarrollo

apt install pipenv git curl jq
git clone [email protected]:VTacius/justine-api.git
cd justine-api
python setup.py develop
  • Creamos dos usuarios y un grupo que usaremos en las pruebas automatizadas
samba-tool group add http_access --nis-domain=DOMINIO.COM --gid-number=1001 --description "Grupos para acceso web"
samba-tool user create alortiz P.4ssw0rd --nis-domain=DOMINIO.COM --unix-home=/home/alortiz --uid-number=1002 --login-shell=/bin/false --gid-number=1001
samba-tool user create opineda P.4ssw0rd --nis-domain=DOMINIO.COM --unix-home=/home/opineda --uid-number=1003 --login-shell=/bin/false --gid-number=1001

Administración desde consola

  • Obtenemos el token con el que vamos a realizar todas las demás operaciones
curl -s -L -XPOST -H 'Content-Type: application/json' 127.0.0.1:6543/auth/tokenizador --user alortiz -d '{"direccion": "alortiz", "rol": "administrador"}' | jq '.token'

Usuarios

  • Listamos los usuarios disponibles en el directorio
curl -s -L XGET -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/usuarios | jq
  • Creamos un usuario
curl -s -L -XPOST -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/usuarios -d @datos.d/usuario_creacion.json | jq
  • Obtenemos los datos del usuario que acabamos de crear
curl -s -L -XGET -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/usuarios/kpenate  | jq
  • Cambiamos el apellido a su forma correcta
curl -s -L -XPUT -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/usuarios/kpenate -d @datos.d/usuario_modificacion.json
  • Borramos el usuario recién creado
curl -s -L -XDELETE -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/usuarios/kpenate | jq

Grupos

  • Listamos los grupos disponibles en el directorio
curl -s -L XGET -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/grupos | jq
  • Creamos un grupo
curl -s -L -XPOST -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/grupos -d @datos.d/grupo_creacion.json | jq
  • Obtenemos los datos del grupo recién creado
curl -s -L -XGET -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/grupos/unidad | jq
  • Cambiamos la lista de correo asociada a la unidad TODO: Falta implementar esto

  • Borramos el grupo recién creado

curl -s -L -XDELETE -H 'Content-Type: application/json' -H "www-authorization: $TOKEN" 127.0.0.1:6543/grupos/unidad

justine-api's People

Contributors

vtacius 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.