Skip to main content

Role Management

NextGenPoll uses a four-level role system. Roles control which UI sections a user can access and which API endpoints they can call.


Role Reference

role_idRoleGranted by
1AdminAzure Entra ID App Role (Admin claim in JWT)
2InstructorAdmin Panel → Users → set role, or auto-promoted on space add
3StudentAuto-assigned on first space join via join code
nullNo roleDefault for all new sign-ups

Role Assignment Flow


How to Grant Admin Access

Admin access is controlled entirely through Azure Entra ID App Roles — no database changes are needed.

  1. In the Azure Portal, go to Microsoft Entra IDEnterprise applications → select NextGenPoll.
  2. Click Users and groupsAdd user/group.
  3. Select the target user and assign them the Admin app role.
  4. Click Assign.
  5. The user must sign out and sign back in — the roles claim is embedded in the JWT at login time.

On the user's next login, the backend automatically sets role_id = 1. The Admin Panel link appears in their dashboard sidebar and /admin becomes accessible.

Verify admin access

After the user re-logs in, call GET /api/me — the response should contain "roleId": 1.

Admin Panel security

/admin performs a server-side role check on every load. Non-admin users are immediately redirected to /dashboard — the admin UI is never rendered for them.


How to Promote a User to Instructor

Instructors are managed in the database via the Admin Panel — no Azure portal changes are needed.

  1. Sign in as an Admin and open the Admin Panel (/admin).
  2. Go to the Spaces tab.
  3. Edit a space and add the user with role ORGANIZER or MODERATOR.
  4. The system automatically promotes their global role_id to 2 (Instructor).

The change takes effect immediately — no sign-out required.

Manual Promotion

  1. Open the Admin PanelUsers tab.
  2. Find the user by name or email.
  3. Set their role to Instructor (role_id = 2).

How Participants Get the Student Role

Participants self-enroll using a join code set by an organiser on a space.

Setting Up a Join Code (Admin/Organiser)

  1. Open the Admin PanelSpaces tab.
  2. Edit the target space.
  3. Set a join code and toggle Join code active to On.

Joining with a Code (Participant)

  1. Sign in and go to the Dashboard.
  2. Navigate to the My Spaces tab.
  3. Click Join a Space and enter the 6-character join code.

On success, a memberships row is created with role = ATTENDEE. If the participant had no role yet (role_id = null), they are automatically promoted to Student (role_id = 3).


Home Page Role-Aware UI

The home page renders different UI elements depending on the user's role:

StateUI Elements shown
All statesUser Menu (top-right) + Theme Toggle
Not signed inSign In + Join a Poll
Admin (role_id = 1)Admin Panel + Dashboard + Join a Poll
Instructor (role_id = 2)Dashboard + Join a Poll
Student or no role (role_id = 3 / null)My Spaces + Join a Poll

Supported Identity Providers

Account typeSign-in method
Harvard organizational (@harvard.edu, @g.harvard.edu)SSO via Entra
Google personal (@gmail.com)Google OAuth SSO
Personal Microsoft (@live.com, @outlook.com, @hotmail.com)Email one-time passcode (OTP)
Any email (no IdP account)Email one-time passcode (OTP)