Skip to content

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

feat: allow Workspace Owner and DBA to manage sheet (#3218)

Tianzhou (天舟)04f7b2202032
diff --git a/frontend/src/utils/sheet.ts b/frontend/src/utils/sheet.ts
index 2ee420475e..75ec21cb1f 100644
--- a/frontend/src/utils/sheet.ts
+++ b/frontend/src/utils/sheet.ts
@@ -1,10 +1,10 @@
import { Principal, Sheet, SheetPayload, TabMode } from "@/types";
-import { hasProjectPermission } from "../utils";
+import { hasProjectPermission, hasWorkspacePermission } from "../utils";
export const isSheetReadable = (sheet: Sheet, currentUser: Principal) => {
// readable to
// PRIVATE: the creator only
- // PROJECT: the creator and members in the project
+ // PROJECT: the creator and members in the project, workspace Owner and DBA
// PUBLIC: everyone
if (sheet.creator.id === currentUser.id) {
@@ -16,6 +16,15 @@ export const isSheetReadable = (sheet: Sheet, currentUser: Principal) => {
return false;
}
if (visibility === "PROJECT") {
+ if (
+ hasWorkspacePermission(
+ "bb.permission.workspace.manage-project",
+ currentUser.role
+ )
+ ) {
+ return true;
+ }
+
const projectMemberList = sheet.project.memberList;
return (
projectMemberList.findIndex(
@@ -30,7 +39,7 @@ export const isSheetReadable = (sheet: Sheet, currentUser: Principal) => {
export const isSheetWritable = (sheet: Sheet, currentUser: Principal) => {
// writable to
// PRIVATE: the creator only
- // PROJECT: the creator or project role can manage sheet
+ // PROJECT: the creator or project role can manage sheet, workspace Owner and DBA
// PUBLIC: the creator only
if (sheet.creator.id === currentUser.id) {
@@ -42,6 +51,15 @@ export const isSheetWritable = (sheet: Sheet, currentUser: Principal) => {
return false;
}
if (visibility === "PROJECT") {
+ if (
+ hasWorkspacePermission(
+ "bb.permission.workspace.manage-project",
+ currentUser.role
+ )
+ ) {
+ return true;
+ }
+
const isCurrentUserProjectOwner = () => {
const projectMemberList = sheet.project.memberList || [];
const memberInProject = projectMemberList.find((member) => {