Open d02ev opened 1 week ago
This pull request introduces several changes across the backend and frontend components of the application. Key modifications include the addition of a new permission for admin roles in the settings configuration, the introduction of new database columns for storing API keys and server URLs, and the implementation of a new controller function to manage these settings. Additionally, new routes and service methods are created to handle the configuration updates, along with corresponding updates in the frontend to facilitate user input and validation.
File | Change Summary |
---|---|
backend/config/settings.js |
Added serverUrlAndApiKey permission for userRole.ADMIN . |
backend/migrations/20241115084356-api_key_server_url_cols_teams_rel.js |
Introduced apiKey and serverUrl columns to teams table; added up and down methods for migration. |
backend/src/controllers/team.controller.js |
Added setConfig function for setting server URL and API key; updated exports to include setConfig . |
backend/src/models/Team.js |
Added apiKey and serverUrl fields to Team model. |
backend/src/routes/team.routes.js |
Added PUT endpoint /set-config for setting configuration; integrated setConfig function. |
backend/src/service/team.service.js |
Added addServerUrlAndApiKey method; updated updateTeam and updateUserRole methods to include transaction context. |
frontend/src/scenes/settings/CodeTab/CodeTab.jsx |
Introduced onSave function for saving server URL and API key; updated button functionality. |
frontend/src/services/teamServices.js |
Added setConfig function to send PUT request for configuration updates. |
frontend/src/utils/constants.js |
Modified export of API_BASE_URL for different environments, disabling local URL export and enabling staging URL export. |
backend/.env |
Added API_KEY_ENCRYPTION_KEY environment variable. |
backend/.env.production |
Added API_KEY_ENCRYPTION_KEY for production environment. |
backend/.env.test |
Added API_KEY_ENCRYPTION_KEY for test environment. |
backend/src/utils/team.helper.js |
Introduced encryptApiKey and decryptApiKey functions for API key management. |
serverUrlAndApiKey
for the userRole.ADMIN
, while this PR introduces a new permission setOrg
, also restricted to userRole.ADMIN
, indicating a related focus on permissions management.permissions
object in settings.js
, and this PR implements role-based access control (RBAC) for the Settings page, which includes checks for user roles, directly connecting to the changes in permissions.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Note: This PR is similar to #345, which I had to close due to some rebasing issues.
serverUrl
andapiKey
columns to theteams
table./set-config
BE route to storeserverUrl
andapiKey
.