-
Notifications
You must be signed in to change notification settings - Fork 2k
Feature/pro user role #5223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/pro user role #5223
Conversation
… model selection and default model UI to Admin and Pro User; keep Basic unchanged
Someone is attempting to deploy a commit to the Danswer Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR introduces a new PRO_USER
role to implement a tiered user system with role-based access control for premium features. The changes span both backend and frontend components to create a middle tier between basic users and administrators.
Backend Changes:
- Adds
UserRole.PRO_USER = "pro_user"
to the authentication schemas and user management system - Introduces a new environment variable
DEFAULT_NEW_USER_ROLE
that allows administrators to configure whether new users default tobasic
orpro_user
roles - Modifies user creation logic in both password signup and OAuth flows to use the configured default role while preserving existing admin elevation rules (first user and users in
get_default_admin_user_emails()
still become admins) - Implements proper fallback handling that defaults to
BASIC
role when the environment variable is unset or contains invalid values
Frontend Changes:
- Adds
PRO_USER
to theUserRole
enum and corresponding display labels in the type definitions - Implements role-based gating for premium features, specifically restricting LLM model selection capabilities to users with
ADMIN
orPRO_USER
roles - Updates multiple UI components including
ChatInputBar
,RegenerateOption
, andUserSettingsModal
to conditionally render model selection features based on user role - Uses conditional rendering to completely hide restricted features from basic users rather than just disabling them
The implementation follows the existing codebase patterns for role-based access control and maintains backward compatibility. The PRO_USER
role provides access to premium features like model selection without granting administrative capabilities, creating a clear value differentiation between user tiers. No database migration is required since roles are stored as strings and native enums were already removed from the system.
Confidence score: 4/5
- This PR introduces new functionality with proper role-based gating but has some areas that could be refined
- Score reflects well-structured implementation with comprehensive testing coverage but includes broad exception handling that could be more specific
- Pay close attention to exception handling in
app_configs.py
and ensure OAuth flow role assignment logic is thoroughly tested
8 files reviewed, 1 comment
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 8 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
Description
Adds the new pro_user role (aligned with Sportradar naming) and wires it through backend and frontend:
UserRole.PRO_USER = "pro_user"
.DEFAULT_NEW_USER_ROLE
to choose the default role for newly created users (basic
orpro_user
). Falls back tobasic
when unset/invalid.get_default_admin_user_emails()
are still created asadmin
.PRO_USER
toUserRole
and labels.admin
andpro_user
.basic
remains restricted.Notes:
pro_user
; it only unlocks premium features (e.g., model selection).How Has This Been Tested?
DEFAULT_NEW_USER_ROLE
set, created users default tobasic
(unless first/seeded admin).DEFAULT_NEW_USER_ROLE=pro_user
.pro_user
.admin
.basic
: LLM popover and default-model selector are hidden.pro_user
: LLM popover and default-model selector are visible and functional.admin
: unchanged behavior; controls visible and functional.pro_user
.Backporting (check the box to trigger backport action)
Summary by cubic
Adds a new pro_user role and connects it across backend and frontend. Lets you default new signups to pro_user and unlock model selection for admin and pro_user.
New Features
Migration