whodb icon indicating copy to clipboard operation
whodb copied to clipboard

[FR] - Being able to limit options via environment variables

Open nicopace opened this issue 7 months ago • 1 comments

Is your feature request related to a problem? Please describe.

We are exploring the integration of whodb with Guardian Connector, an open source Indigenous Data Warehouse. Our users have tons of data stored in a hosted database that they would like to be able to access, but they don't have knowledge about SQL. We would like them to be able to access the data using natural language. Right now, whodb allows users to change settings that were defined through environment variables:

  • AI settings, even though you set them up over environment variables, you can change them through the UI.
  • datasources the same.

Describe the solution you'd like I would like for a way to prevent users from changing settings defined at deployment time.

Describe alternatives you've considered I can definitely ask the user not to do it, or change the frontend to remove the option, or even hide it with CSS.

nicopace avatar May 28 '25 22:05 nicopace

@nicopace would you like to get on a call? We are working with some other companies doing integrations for them, would love to see your use case and if we can directly help you out :)

modelorona avatar May 29 '25 23:05 modelorona

we've got availability at https://cal.com/clidey/30min!

modelorona avatar May 30 '25 02:05 modelorona

@claude can you look into this and see how to prevent users from changing settings that were defined at deployment time?

modelorona avatar Jun 13 '25 18:06 modelorona

Claude finished @modelorona's task —— View jobclaude/issue-498-20250613_182319Create PR ➔


Analyzing Issue #498 - Limiting options via environment variables ✅

I've successfully implemented a solution to prevent users from changing settings that were defined at deployment time via environment variables.

Todo List:

  • [x] Read repository guidelines (CLAUDE.md)
  • [x] Understand current settings architecture
  • [x] Find environment variable handling for AI settings
  • [x] Find environment variable handling for datasources
  • [x] Locate UI components for settings management
  • [x] Implement solution to lock environment-defined settings
  • [x] Test changes if possible
  • [x] Commit changes and provide PR link

✅ Implementation Complete

I've successfully implemented a comprehensive solution to prevent users from changing settings defined at deployment time:

Backend Changes:

  • Extended GraphQL schema to include IsEnvironmentDefined field for AIProvider and LoginProfile types
  • Updated resolvers to mark all environment-configured providers and profiles as IsEnvironmentDefined: true
  • Updated GraphQL models to include the new field

Frontend Changes:

  • Updated GraphQL queries to fetch the IsEnvironmentDefined field
  • Modified AI provider management to prevent deletion of environment-defined providers (delete button disabled)
  • Updated database profile management to prevent removal of environment-defined profiles
  • Added visual indicators (🔒 lock icon) for environment-defined profiles
  • Updated type definitions to include the new field
  • Added user-friendly error messages when attempting to modify protected settings

Key Features:

  1. AI Providers: Environment-defined providers cannot be deleted, but users can still add additional external models
  2. Database Profiles: Environment-defined profiles cannot be removed and are visually marked with a lock icon
  3. Backward Compatibility: Non-environment-defined settings continue to work normally
  4. User Experience: Clear visual feedback and error messages when attempting unauthorized actions

The solution maintains the flexibility requested - users can still add their own providers/profiles while preventing modification of deployment-defined configurations.

Changes committed in f578a13


claude[bot] avatar Jun 13 '25 18:06 claude[bot]

hey @nicopace , made some changes where if the profile or AI provider is defined via env, you can't remove it from the UI. Please let me know if you had something else in mind! :)

modelorona avatar Jun 16 '25 03:06 modelorona