Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: respect the inviter own project access

Andrej3e11cc8365ee
diff --git a/apps/api/src/workspace/controllers/get-my-project-access.ts b/apps/api/src/workspace/controllers/get-my-project-access.ts
new file mode 100644
index 000000000..cd1ab9150
--- /dev/null
+++ b/apps/api/src/workspace/controllers/get-my-project-access.ts
@@ -0,0 +1,11 @@
+import { getMemberProjectAccess } from "../../project-access/get-member-project-access";
+import { isProjectAccessRestricted } from "../../project-access/is-project-access-restricted";
+
+async function getMyProjectAccess(workspaceId: string, userId: string) {
+ if (!(await isProjectAccessRestricted(workspaceId, userId))) {
+ return { userId, projectAccess: "all" as const, projectIds: [] };
+ }
+ return getMemberProjectAccess(workspaceId, userId);
+}
+
+export default getMyProjectAccess;
diff --git a/apps/api/src/workspace/index.ts b/apps/api/src/workspace/index.ts
index 96e3a309f..185974b7f 100644
--- a/apps/api/src/workspace/index.ts
+++ b/apps/api/src/workspace/index.ts
@@ -8,6 +8,7 @@ import {
import { listWorkspaceProjectAccess } from "../project-access/list-workspace-project-access";
import { requireWorkspacePermission } from "../utils/require-workspace-permission";
import { workspaceAccess } from "../utils/workspace-access-middleware";
+import getMyProjectAccessCtrl from "./controllers/get-my-project-access";
import getWorkspaceMembersCtrl from "./controllers/get-workspace-members";
import updateMemberProjectAccessCtrl from "./controllers/update-member-project-access";
import {
@@ -65,6 +66,23 @@ const getWorkspaceProjectAccessRoute = createRoute({
},
});
+const getMyProjectAccessRoute = createRoute({
+ method: "get",
+ operationId: "getMyProjectAccess",
+ path: "/{workspaceId}/project-access/me",
+ tags: ["Workspaces"],
+ summary: "Get my project access",
+ description:
+ "Get the caller's own project access in the workspace: every project, or the selected projects they're limited to. Owners and instance admins always get every project.",
+ middleware: [workspaceAccess.fromParam("workspaceId")] as const,
+ request: { params: workspaceIdParam },
+ responses: {
+ 200: jsonResponse("The caller's project access", memberProjectAccessSchema),
+ 400: errorResponse("Workspace ID could not be determined"),
+ 403: errorResponse("No access to the workspace"),
+ },
+});
+
const updateMemberProjectAccessRoute = createRoute({
method: "put",
operationId: "updateMemberProjectAccess",
@@ -109,6 +127,12 @@ const workspace = apiRouter<BaseVariables & { workspaceId: string }>()
200,
),
)
+ .openapi(getMyProjectAccessRoute, async (c) =>
+ c.json(
+ await getMyProjectAccessCtrl(c.get("workspaceId"), c.get("userId")),
+ 200,
+ ),
+ )
.openapi(getWorkspaceProjectAccessRoute, async (c) =>
c.json(
await listWorkspaceProjectAccess(c.get("workspaceId"), c.get("userId")),
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index 27351f7cc..8e912b58d 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -18831,6 +18831,61 @@
}
}
},
+ "/workspace/{workspaceId}/project-access/me": {
+ "get": {
+ "operationId": "getMyProjectAccess",
+ "tags": [
+ "Workspaces"
+ ],
+ "summary": "Get my project access",
+ "description": "Get the caller's own project access in the workspace: every project, or the selected projects they're limited to. Owners and instance admins always get every project.",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "name": "workspaceId",
+ "in": "path"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The caller's project access",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MemberProjectAccess"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Workspace ID could not be determined",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Missing or invalid credentials"
+ },
+ "403": {
+ "description": "No access to the workspace",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/workspace/{workspaceId}/project-access": {
"get": {
"operationId": "getWorkspaceProjectAccess",
diff --git a/apps/web/src/components/team/invite-team-member-modal.tsx b/apps/web/src/components/team/invite-team-member-modal.tsx
index 6bcb52978..52b65c202 100644
--- a/apps/web/src/components/team/invite-team-member-modal.tsx
+++ b/apps/web/src/components/team/invite-team-member-modal.tsx
@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
import { z } from "zod/v4";
import useInviteWorkspaceUser from "@/hooks/mutations/workspace-user/use-invite-workspace-user";
import useGetProjects from "@/hooks/queries/project/use-get-projects";
+import useGetMyProjectAccess from "@/hooks/queries/workspace-users/use-get-my-project-access";
import useActiveWorkspace from "@/hooks/queries/workspace/use-active-workspace";
import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
import { toast } from "@/lib/toast";
@@ -32,6 +33,7 @@ import InvitationLinkField from "./invitation-link-field";
import {
ALL_PROJECTS_ACCESS,
type ProjectAccessValue,
+ SELECTED_PROJECTS_ACCESS,
} from "./project-access/project-access-value";
import { isProjectAccessComplete } from "./project-access/is-project-access-complete";
import { toProjectAccessRequest } from "./project-access/to-project-access-request";
@@ -60,8 +62,14 @@ function InviteTeamMemberModal({ open, onClose }: Props) {
id: string;
email: string;
} | null>(null);
- const [projectAccess, setProjectAccess] =
- useState<ProjectAccessValue>(ALL_PROJECTS_ACCESS);
+ const { data: myAccess } = useGetMyProjectAccess(workspaceId ?? "", open);
+ const inviterLimited = myAccess?.projectAccess === "selected";
+ const [chosenAccess, setProjectAccess] = useState<ProjectAccessValue | null>(
+ null,
+ );
+ const projectAccess =
+ chosenAccess ??
+ (inviterLimited ? SELECTED_PROJECTS_ACCESS : ALL_PROJECTS_ACCESS);
const [showProjectAccessError, setShowProjectAccessError] = useState(false);
const { data: projects, isLoading: isLoadingProjects } = useGetProjects({
workspaceId: workspaceId ?? "",
@@ -115,7 +123,7 @@ function InviteTeamMemberModal({ open, onClose }: Props) {
if (invitation?.id) {
setCreatedInvitation({ id: invitation.id, email });
form.reset();
- setProjectAccess(ALL_PROJECTS_ACCESS);
+ setProjectAccess(null);
return;
}
@@ -140,7 +148,7 @@ function InviteTeamMemberModal({ open, onClose }: Props) {
if (isOpen) return;
setCreatedInvitation(null);
form.reset();
- setProjectAccess(ALL_PROJECTS_ACCESS);
+ setProjectAccess(null);
setShowProjectAccessError(false);
};
@@ -199,6 +207,7 @@ function InviteTeamMemberModal({ open, onClose }: Props) {
)}
/>
<ProjectAccessFields
+ allowAll={!inviterLimited}
value={projectAccess}
onChange={(next) => {
setProjectAccess(next);
diff --git a/apps/web/src/components/team/member-project-access-dialog.tsx b/apps/web/src/components/team/member-project-access-dialog.tsx
index a19b7e032..d5791bd64 100644
--- a/apps/web/src/components/team/member-project-access-dialog.tsx
+++ b/apps/web/src/components/team/member-project-access-dialog.tsx
@@ -2,6 +2,7 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import useUpdateMemberProjectAccess from "@/hooks/mutations/workspace-user/use-update-member-project-access";
import useGetProjects from "@/hooks/queries/project/use-get-projects";
+import useGetMyProjectAccess from "@/hooks/queries/workspace-users/use-get-my-project-access";
import { toast } from "@/lib/toast";
import { Button } from "../ui/button";
import {
@@ -42,6 +43,7 @@ function MemberProjectAccessDialog({
workspaceId,
includeArchived: true,
});
+ const { data: myAccess } = useGetMyProjectAccess(workspaceId, open);
const { mutateAsync, isPending } = useUpdateMemberProjectAccess();
if (open !== wasOpen) {
@@ -88,6 +90,7 @@ function MemberProjectAccessDialog({
</DialogHeader>
<DialogPanel>
<ProjectAccessFields
+ allowAll={myAccess?.projectAccess !== "selected"}
value={value}
onChange={(next) => {
setValue(next);
diff --git a/apps/web/src/components/team/members-table.test.tsx b/apps/web/src/components/team/members-table.test.tsx
index 7e6e2752e..64223c63a 100644
--- a/apps/web/src/components/team/members-table.test.tsx
+++ b/apps/web/src/components/team/members-table.test.tsx
@@ -86,6 +86,15 @@ vi.mock(
}),
);
+const myProjectAccess = vi.fn(() => ({
+ projectAccess: "all",
+ projectIds: [] as string[],
+}));
+
+vi.mock("@/hooks/queries/workspace-users/use-get-my-project-access", () => ({
+ default: () => ({ data: myProjectAccess() }),
+}));
+
vi.mock("@/hooks/queries/project/use-get-projects", () => ({
default: () => ({
data: [
@@ -242,6 +251,26 @@ describe("MembersTable project access", () => {
).toBeGreaterThan(0);
});
+ it("lets a limited manager edit only limited members", () => {
+ myProjectAccess.mockReturnValue({
+ projectAccess: "selected",
+ projectIds: ["project-a"],
+ });
+
+ render(
+ <MembersTable
+ workspaceId="workspace-1"
+ invitations={[]}
+ users={members}
+ />,
+ );
+
+ expect(
+ screen.getAllByRole("button", { name: "team:projectAccess.editAria" }),
+ ).toHaveLength(1);
+ myProjectAccess.mockReturnValue({ projectAccess: "all", projectIds: [] });
+ });
+
it("saves selected projects for a member from the dialog", async () => {
updateProjectAccess.mockResolvedValue({});
diff --git a/apps/web/src/components/team/members-table.tsx b/apps/web/src/components/team/members-table.tsx
index bbfb741f9..eaab908fd 100644
--- a/apps/web/src/components/team/members-table.tsx
+++ b/apps/web/src/components/team/members-table.tsx
@@ -13,6 +13,7 @@ import useCancelInvitation from "@/hooks/mutations/workspace-user/use-cancel-inv
import useDeleteWorkspaceUser from "@/hooks/mutations/workspace-user/use-delete-workspace-user";
import useUpdateWorkspaceUserRole from "@/hooks/mutations/workspace-user/use-update-workspace-user-role";
import useWorkspaceRoles from "@/hooks/queries/workspace/use-workspace-roles";
+import useGetMyProjectAccess from "@/hooks/queries/workspace-users/use-get-my-project-access";
import useGetWorkspaceProjectAccess from "@/hooks/queries/workspace-users/use-get-workspace-project-access";
import { useCopyInvitationLink } from "@/hooks/use-copy-invitation-link";
import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
@@ -131,6 +132,11 @@ function MembersTable({ workspaceId, invitations, users }: Props) {
workspaceId,
canManageProjectAccess,
);
+ const { data: myAccess } = useGetMyProjectAccess(
+ workspaceId,
+ canManageProjectAccess,
+ );
+ const managerLimited = myAccess?.projectAccess === "selected";
const columnCount = canManageProjectAccess ? 5 : 4;
const describeAccess = (access: ProjectAccessValue) =>
@@ -240,12 +246,15 @@ function MembersTable({ workspaceId, invitations, users }: Props) {
const isSelf = currentUser?.id === member.userId;
const showRoleSelect =
canChangeRoles && !isSelf && member.role !== "owner";
- const showAccessEdit =
- canManageProjectAccess && !isSelf && member.role !== "owner";
const access =
member.role === "owner"
? ALL_PROJECTS_ACCESS
: findMemberProjectAccess(projectAccessEntries, member.userId);
+ const showAccessEdit =
+ canManageProjectAccess &&
+ !isSelf &&
+ member.role !== "owner" &&
+ !(managerLimited && access.projectAccess === "all");
const accessLabel = describeAccess(access);
const memberName = member.user.name || member.user.email;
const tone = toneFor(member.user.email);
diff --git a/apps/web/src/components/team/project-access-fields.tsx b/apps/web/src/components/team/project-access-fields.tsx
index acd849948..6237cbc0e 100644
--- a/apps/web/src/components/team/project-access-fields.tsx
+++ b/apps/web/src/components/team/project-access-fields.tsx
@@ -17,6 +17,7 @@ type Props = {
| undefined;
isLoadingProjects?: boolean;
disabled?: boolean;
+ allowAll?: boolean;
error?: string;
};
@@ -26,6 +27,7 @@ function ProjectAccessFields({
projects,
isLoadingProjects = false,
disabled = false,
+ allowAll = true,
error,
}: Props) {
const { t } = useTranslation();
@@ -56,11 +58,13 @@ function ProjectAccessFields({
</p>
</div>
<Label className="items-start gap-3">
- <Radio value="all" />
+ <Radio value="all" disabled={!allowAll} />
<span className="flex flex-col gap-0.5">
{t("team:projectAccess.allProjects")}
<span className="font-normal text-muted-foreground text-xs">
- {t("team:projectAccess.allProjectsDescription")}
+ {allowAll
+ ? t("team:projectAccess.allProjectsDescription")
+ : t("team:projectAccess.allProjectsUnavailable")}
</span>
</span>
</Label>
diff --git a/apps/web/src/components/team/project-access/project-access-value.ts b/apps/web/src/components/team/project-access/project-access-value.ts
index 29d24331a..20ecb122d 100644
--- a/apps/web/src/components/team/project-access/project-access-value.ts
+++ b/apps/web/src/components/team/project-access/project-access-value.ts
@@ -9,3 +9,8 @@ export const ALL_PROJECTS_ACCESS: ProjectAccessValue = {
projectAccess: "all",
projectIds: [],
};
+
+export const SELECTED_PROJECTS_ACCESS: ProjectAccessValue = {
+ projectAccess: "selected",
+ projectIds: [],
+};
diff --git a/apps/web/src/fetchers/workspace-user/get-my-project-access.ts b/apps/web/src/fetchers/workspace-user/get-my-project-access.ts
new file mode 100644
index 000000000..19cb90996
--- /dev/null
+++ b/apps/web/src/fetchers/workspace-user/get-my-project-access.ts
@@ -0,0 +1,16 @@
+import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
+
+async function getMyProjectAccess(workspaceId: string) {
+ const response = await client.workspace[":workspaceId"]["project-access"][
+ "me"
+ ].$get({ param: { workspaceId } });
+
+ if (!response.ok) {
+ throw new HttpError(response.status, await response.text());
+ }
+
+ return response.json();
+}
+
+export default getMyProjectAccess;
diff --git a/apps/web/src/hooks/queries/workspace-users/use-get-my-project-access.ts b/apps/web/src/hooks/queries/workspace-users/use-get-my-project-access.ts
new file mode 100644
index 000000000..ca65d8fdf
--- /dev/null
+++ b/apps/web/src/hooks/queries/workspace-users/use-get-my-project-access.ts
@@ -0,0 +1,13 @@
+import { useQuery } from "@tanstack/react-query";
+import getMyProjectAccess from "@/fetchers/workspace-user/get-my-project-access";
+
+function useGetMyProjectAccess(workspaceId: string, enabled = true) {
+ return useQuery({
+ queryKey: ["workspace-users", workspaceId, "project-access", "me"],
+ queryFn: () => getMyProjectAccess(workspaceId),
+ enabled: enabled && !!workspaceId,
+ refetchOnMount: "always",
+ });
+}
+
+export default useGetMyProjectAccess;
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index 9d528b55d..334d56835 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 663e748a4..f69cae657 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index d6bd5e3af..9037d308c 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 6a8f6be66..8ebb3082f 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -2922,6 +2922,7 @@
"description": "Choose which projects this person can see.",
"allProjects": "All projects",
"allProjectsDescription": "Access every project in this workspace, including new ones.",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects.",
"selectedProjects": "Selected projects",
"selectedProjectsDescription": "Only access the projects you choose.",
"projectsLabel": "Projects",
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index e83f6baec..fa425232b 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -2953,7 +2953,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index 4347b9883..b40740af1 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -2953,7 +2953,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index b181dcccc..284fc3fe7 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index 9d7f8d7c1..404ff9356 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index ed9785091..57dc33768 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -2953,7 +2953,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index 512934fae..8ea5f4a92 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index 44a54d70e..c5d6443d3 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index 52c71acaf..85cbf2934 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index 4c2b70f5c..42e429bbb 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index 7a9555a25..9618c0c0f 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -827,7 +827,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index 6929a25bd..feb27130e 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -2953,7 +2953,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 91c19f0bd..d8b441b84 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -3027,7 +3027,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index a0007774c..f9c76aa00 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -2935,7 +2935,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index cf57e6e07..3042e52f7 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -2971,7 +2971,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index a5723f680..0fb38d3ed 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index 4cb82d527..6cd3e242a 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/i18n/zh-TW.json b/i18n/zh-TW.json
index 7485858b0..9ef98ecaa 100644
--- a/i18n/zh-TW.json
+++ b/i18n/zh-TW.json
@@ -2917,7 +2917,8 @@
"selectedProjectsDescription": "Only access the projects you choose.",
"updateError": "Failed to update project access",
"updateSuccess": "Project access updated",
- "archived": "Archived"
+ "archived": "Archived",
+ "allProjectsUnavailable": "Your own access is limited, so you can only give access to selected projects."
}
},
"publicProject": {
diff --git a/tests/api-integration/project-access-management.test.ts b/tests/api-integration/project-access-management.test.ts
index 0e708eb84..877dd020b 100644
--- a/tests/api-integration/project-access-management.test.ts
+++ b/tests/api-integration/project-access-management.test.ts
@@ -85,6 +85,27 @@ describe("managing member project access", () => {
);
});
+ it("tells each member their own project access", async () => {
+ const ctx = await createRestrictedWorkspace();
+
+ mockAuthenticatedSession(ctx.restricted);
+ const restricted = await projectAccessApi()(
+ `/workspace/${ctx.workspace.id}/project-access/me`,
+ );
+ expect(restricted.status).toBe(200);
+ expect(await restricted.json()).toEqual({
+ userId: ctx.restricted.id,
+ projectAccess: "selected",
+ projectIds: [ctx.alpha.id],
+ });
+
+ mockAuthenticatedSession(ctx.owner);
+ const owner = await projectAccessApi()(
+ `/workspace/${ctx.workspace.id}/project-access/me`,
+ );
+ expect(await owner.json()).toMatchObject({ projectAccess: "all" });
+ });
+
it("refuses to restrict owners or yourself", async () => {
const ctx = await createRestrictedWorkspace();
const admin = await addWorkspaceMember(ctx.workspace.id, "admin");