Giter Site home page Giter Site logo

Comments (2)

raisedadead avatar raisedadead commented on August 17, 2024

From #73 (comment)

NextAuth (or whatever providers it is configured with) only has the job of verifying and telling you who a user is.

It's the application's job to look at the user (email, user-id, etc.), compare that against a table (with a pre-existing entry for the user's role), and send them to the correct area in the application.

Now, in our case, the sign-up and sign-in pages are technically the same (because of NextAuth), but because we are making an invite-only style application, we have the ability to do some cool things.

  1. First, we have the /login page, which is already good to go.

  2. Next, let's suppose we create a super-admin user.

    This super-admin (user-id) has God mod access across the app. We set its email-id hardwired in the DB (say as a seeding step). And only the person managing the Classroom app (hosting) has access to this email inbox.

    The super-admin uses the same /login page. But because we know who the user is, we can take them to a special "dashboard" page. More on this in a bit.

  3. Next, we create a special page for teachers (/teacher-signup?) to sign-up (with the same NextAuth implementation). When they do, they get onboarded via the verification, etc. we already have in place, but critically we add an "on-hold" flag against their user entry in the DB. The teacher sees a message that they should wait for the admins to approve them.

  4. Next, the super-admin can log in and go to the special "dashboard" where all teachers who signed up recently and are "on-hold" are listed. The admin can flick a checkbox to approve the request(s). This triggers a change in the user's role and assigns them the "teacher" role.

  5. For regular students who join via the invite, we can assign them the "student" role by default. They do not need to go through the approval step.

How does this sound about implementing RBAC? If this sounds reasonable, I can guide you further on how best to proceed with a concrete implementation.

from classroom.

utsab avatar utsab commented on August 17, 2024

We discussed two possibilities for the login / signup workflow:

  1. Two buttons: one for sign-up-as-a-teacher, one for login
  2. One button: Sign in

Our detailed discussion notes are here.

from classroom.

Related Issues (20)

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.