Giter VIP home page Giter VIP logo

Comments (1)

nikochiko avatar nikochiko commented on July 30, 2024

pipalacademy/engage#62

I think we would need an endpoint that would allow us to create users for the above task in Engage. We could hackily add data to Engage and users.txt by hand but having an endpoint will let us automate the entire process.

Approach:

Authentication
Since this endpoint will create new users, this needs to have authentication. We don't have to implement our own, and we can use HubAuth to use the same authentication as the jupyterhub server. We can create a jupyterhub token as an admin user from the UI and set that as configuration in Engage. Once done, we only need to check whether the user making the request is an admin or not.

API
Create user

Successful request:

POST /services/dashboard/users
{
    "username": "alice",
    "password": "alice42"
}
---
201 CREATED
{
    "username": "alice"
}

Failed request:

POST /services/dashboard/users
{
    "username": "alice",
    "password": "hello:world"
}
---
400 BAD REQUEST
Content-Type: application/json
{
    "message": "Password is invalid"
}

Other error messages:

Username is invalid

Invalid request body

Implementation
Dashboard service should:

  1. Validate the username/password strings - all characters should be in [ascii_letters + digits] only. (because punctuation/whitespace might not work well with the format of users.txt)
  2. Write username:password\n to users.txt
  3. Run add-users.py script (stored at /opt/jhub/add-users.py)
  4. Return response

from pipalhub.

Related Issues (12)

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.