Skip to content

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

fix(review): show the workspace rules link on the policy read alone

rebelice25a18c864e75
diff --git a/frontend/src/routes/project/ProjectSQLReviewPage.test.tsx b/frontend/src/routes/project/ProjectSQLReviewPage.test.tsx
index d7b29d7fa8..54110d1034 100644
--- a/frontend/src/routes/project/ProjectSQLReviewPage.test.tsx
+++ b/frontend/src/routes/project/ProjectSQLReviewPage.test.tsx
@@ -475,6 +475,11 @@ describe("ProjectSQLReviewPage", () => {
expect(
screen.queryByText("sql-review.standard-rules.on")
).not.toBeInTheDocument();
+ expect(
+ screen.queryByText(
+ "sql-review.standard-rules.customize.view-workspace-rules"
+ )
+ ).not.toBeInTheDocument();
// Customizing starts from every rule, as nothing else is known.
fireEvent.click(customize);
@@ -485,6 +490,17 @@ describe("ProjectSQLReviewPage", () => {
);
});
+ test("the workspace rules link needs only the workspace policy read", async () => {
+ mocks.workspacePermissions = { "bb.reviewConfigs.list": false };
+ await renderLoaded();
+
+ expect(
+ screen.getByText(
+ "sql-review.standard-rules.customize.view-workspace-rules"
+ )
+ ).toBeInTheDocument();
+ });
+
test("undoing an unsaved switch needs no permission", async () => {
mocks.permissions = { "bb.policies.delete": false };
const customize = await renderLoaded();
diff --git a/frontend/src/routes/project/ProjectSQLReviewPage.tsx b/frontend/src/routes/project/ProjectSQLReviewPage.tsx
index 1c979fa23a..3dbdf28b38 100644
--- a/frontend/src/routes/project/ProjectSQLReviewPage.tsx
+++ b/frontend/src/routes/project/ProjectSQLReviewPage.tsx
@@ -220,9 +220,8 @@ export function ProjectSQLReviewPage({ projectId }: { projectId: string }) {
const customizeLocked = standardRules.customized
? standardRules.storedCustomized && !can("bb.policies.delete")
: !standardRules.storedCustomized && !canSave;
- const canViewWorkspaceRules =
- hasWorkspacePermissionV2("bb.reviewConfigs.list") &&
- hasWorkspacePermissionV2("bb.policies.get");
+ // The V2 workspace route needs only the policy read.
+ const canViewWorkspaceRules = hasWorkspacePermissionV2("bb.policies.get");
return (
<ProjectPageLayout>