Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Find the database for a user through project membership instead of data source membership

天舟69ad22dafa2c
diff --git a/frontend/src/miragejs/routes/database.js b/frontend/src/miragejs/routes/database.js
index d77d1c2667..4015bfa3f0 100644
--- a/frontend/src/miragejs/routes/database.js
+++ b/frontend/src/miragejs/routes/database.js
@@ -42,25 +42,19 @@ export default function configureDatabase(route) {
}
if (userId) {
- const dataSourceList = schema.dataSources.where({
- workspaceId: WORKSPACE_ID,
- databaseId: database.id,
- });
+ const project = schema.projects.find(database.projectId);
- let matchFound = false;
- for (const dataSource of dataSourceList.models) {
- if (
- dataSource.memberList.find((item) => {
- return item.principalId == userId;
- })
- ) {
- matchFound = true;
- break;
- }
- }
- if (!matchFound) {
+ if (!project) {
return false;
}
+
+ return (
+ schema.projectRoleMappings.findBy({
+ principalId: userId,
+ projectId: project.id,
+ workspaceId: WORKSPACE_ID,
+ }) != undefined
+ );
}
return true;