mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
Merge pull request #38 from yusufipk/fix/public-project-hides-workspace-admin-actions
fix(auth): keep workspace admin permissions on public projects
This commit is contained in:
+7
-3
@@ -281,9 +281,13 @@ export async function checkProjectAccess(
|
|||||||
const isProjectMember = !!projectMember;
|
const isProjectMember = !!projectMember;
|
||||||
const isProjectAdmin = projectMember?.role === ProjectMemberRole.ADMIN;
|
const isProjectAdmin = projectMember?.role === ProjectMemberRole.ADMIN;
|
||||||
|
|
||||||
const needsWorkspaceForAccess = !!userId && !isOwner && !isProjectMember && !isPublic;
|
// The workspace role decides `canEdit`/`isWorkspaceMember`, not just whether the viewer
|
||||||
const needsWorkspaceForActions = !!userId && !isOwner && intent !== 'view';
|
// gets in at all, so it has to be resolved for every signed-in non-owner. Skipping it
|
||||||
const shouldLoadWorkspaceRole = needsWorkspaceForAccess || needsWorkspaceForActions;
|
// once access was already granted some other way (public project, or an existing project
|
||||||
|
// membership) silently downgraded workspace admins to read-only on `intent: 'view'` —
|
||||||
|
// the intent pages and GET routes use to decide which actions to render.
|
||||||
|
// Owners pass every check on their own; resolve their role only when they mutate.
|
||||||
|
const shouldLoadWorkspaceRole = !!userId && (!isOwner || intent !== 'view');
|
||||||
|
|
||||||
// Check workspace membership/role
|
// Check workspace membership/role
|
||||||
let workspaceRole: WorkspaceMemberRole | 'OWNER' | null = null;
|
let workspaceRole: WorkspaceMemberRole | 'OWNER' | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user