fix(permissions): keep create permissions grantable and stop silent escalation
The matrix could not represent board-create, app-create, integration-create, search-engine-create or media-upload, and savePermissions force-bundled every create key with its modify/full parent. Together that meant a group with board-create was silently upgraded to board-full-all on the next save, and the common "members may create their own boards" setup became unreachable. - permissionMatrix models create/upload as an orthogonal capability next to the ordered access levels, so all 20 permission keys round-trip losslessly - savePermissions stores exactly what was selected - the matrix UI gets a per-category create checkbox, auto-checked and disabled when the chosen level already implies it - a management section is reachable when the user can do at least one thing in it; nav, pages and stat cards now share one access helper
This commit is contained in:
12 files changed
+534
-177
No files matched your search
@@ -0,0 +1,78 @@
|
|||||||
|
import type { Session } from "@homarr/auth";
|
||||||
|
|
||||||
|
import { api } from "@homarr/api/server";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access rules for the management sections, shared by the navigation and the pages themselves so
|
||||||
|
* the two can never drift apart. The rule is always the same: a section is reachable when the user
|
||||||
|
* can do at least one thing in it, and the section only ever lists what the user is allowed to see.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface AppsSectionAccess {
|
||||||
|
/** May see and edit every app */
|
||||||
|
canManageAll: boolean;
|
||||||
|
/** May add new apps */
|
||||||
|
canCreate: boolean;
|
||||||
|
/** May delete apps */
|
||||||
|
canDelete: boolean;
|
||||||
|
/** May open /manage/apps at all */
|
||||||
|
canAccess: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAppsSectionAccess = (session: Session | null): AppsSectionAccess => {
|
||||||
|
const permissions = session?.user.permissions ?? [];
|
||||||
|
const canManageAll = permissions.includes("app-modify-all");
|
||||||
|
const canCreate = permissions.includes("app-create");
|
||||||
|
|
||||||
|
return {
|
||||||
|
canManageAll,
|
||||||
|
canCreate,
|
||||||
|
canDelete: permissions.includes("app-full-all"),
|
||||||
|
canAccess: canManageAll || canCreate,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface IntegrationsSectionAccess {
|
||||||
|
/** May manage every integration */
|
||||||
|
canManageAll: boolean;
|
||||||
|
/** May add new integrations */
|
||||||
|
canCreate: boolean;
|
||||||
|
/** May manage at least one specific integration through a delegated grant */
|
||||||
|
hasDelegatedAccess: boolean;
|
||||||
|
/** May open /manage/integrations at all */
|
||||||
|
canAccess: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pure variant for callers that already fetched the integrations the user can see, so the page and
|
||||||
|
* the navigation never disagree and the list is only queried once per request.
|
||||||
|
*/
|
||||||
|
export const getIntegrationsSectionAccess = (
|
||||||
|
session: Session | null,
|
||||||
|
visibleIntegrations: { permissions: { hasFullAccess: boolean } }[],
|
||||||
|
): IntegrationsSectionAccess => {
|
||||||
|
const permissions = session?.user.permissions ?? [];
|
||||||
|
const canManageAll = permissions.includes("integration-full-all");
|
||||||
|
const canCreate = permissions.includes("integration-create");
|
||||||
|
const hasDelegatedAccess =
|
||||||
|
!canManageAll && visibleIntegrations.some((integration) => integration.permissions.hasFullAccess);
|
||||||
|
|
||||||
|
return {
|
||||||
|
canManageAll,
|
||||||
|
canCreate,
|
||||||
|
hasDelegatedAccess,
|
||||||
|
canAccess: canManageAll || canCreate || hasDelegatedAccess,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getIntegrationsSectionAccessAsync = async (
|
||||||
|
session: Session | null,
|
||||||
|
): Promise<IntegrationsSectionAccess> => {
|
||||||
|
const permissions = session?.user.permissions ?? [];
|
||||||
|
|
||||||
|
// Only pay for the lookup when the answer is not already known from the global permissions.
|
||||||
|
const needsDelegatedLookup =
|
||||||
|
session !== null && !permissions.includes("integration-full-all") && !permissions.includes("integration-create");
|
||||||
|
|
||||||
|
return getIntegrationsSectionAccess(session, needsDelegatedLookup ? await api.integration.all() : []);
|
||||||
|
};
|
||||||
@@ -16,6 +16,7 @@ import { TourTarget } from "~/components/layout/header/tour-target";
|
|||||||
import { ManageCollectionItem, ManageCollectionPage } from "~/components/manage/manage-collection";
|
import { ManageCollectionItem, ManageCollectionPage } from "~/components/manage/manage-collection";
|
||||||
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
|
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
|
||||||
import { NoResults } from "~/components/no-results";
|
import { NoResults } from "~/components/no-results";
|
||||||
|
import { getAppsSectionAccess } from "../_access";
|
||||||
import { AppDeleteButton } from "./_app-delete-button";
|
import { AppDeleteButton } from "./_app-delete-button";
|
||||||
|
|
||||||
const searchParamsSchema = z.object({
|
const searchParamsSchema = z.object({
|
||||||
@@ -41,16 +42,26 @@ interface AppsPageProps {
|
|||||||
export default async function AppsPage(props: AppsPageProps) {
|
export default async function AppsPage(props: AppsPageProps) {
|
||||||
const session = await auth();
|
const session = await auth();
|
||||||
if (!session) redirect("/auth/login");
|
if (!session) redirect("/auth/login");
|
||||||
if (!session.user.permissions.includes("app-modify-all")) notFound();
|
const { canManageAll, canCreate, canDelete, canAccess } = getAppsSectionAccess(session);
|
||||||
|
if (!canAccess) notFound();
|
||||||
|
|
||||||
const searchParams = searchParamsSchema.parse(await props.searchParams);
|
const searchParams = searchParamsSchema.parse(await props.searchParams);
|
||||||
const { items: apps, totalCount } = await api.app.getPaginated(searchParams);
|
// Without app-modify-all the user may add apps but not browse the ones they cannot manage,
|
||||||
|
// so the list stays empty instead of leaking every app name and URL.
|
||||||
|
const { items: apps, totalCount } = canManageAll
|
||||||
|
? await api.app.getPaginated(searchParams)
|
||||||
|
: { items: [], totalCount: 0 };
|
||||||
const t = await getScopedI18n("app");
|
const t = await getScopedI18n("app");
|
||||||
const canCreate = session.user.permissions.includes("app-create");
|
const hasSearch = canManageAll && Boolean(searchParams.search?.trim());
|
||||||
const canDelete = session.user.permissions.includes("app-full-all");
|
|
||||||
const hasSearch = Boolean(searchParams.search?.trim());
|
|
||||||
|
|
||||||
const emptyState = hasSearch ? (
|
const emptyState = !canManageAll ? (
|
||||||
|
<NoResults
|
||||||
|
icon={IconBox}
|
||||||
|
title={t("page.list.noResults.createOnlyTitle")}
|
||||||
|
description={t("page.list.noResults.createOnlyDescription")}
|
||||||
|
action={{ label: t("page.list.noResults.action"), href: "/manage/apps/new" }}
|
||||||
|
/>
|
||||||
|
) : hasSearch ? (
|
||||||
<NoResults
|
<NoResults
|
||||||
icon={IconBox}
|
icon={IconBox}
|
||||||
title={t("page.list.noResults.filteredTitle")}
|
title={t("page.list.noResults.filteredTitle")}
|
||||||
@@ -82,12 +93,14 @@ export default async function AppsPage(props: AppsPageProps) {
|
|||||||
) : undefined
|
) : undefined
|
||||||
}
|
}
|
||||||
toolbar={
|
toolbar={
|
||||||
<SearchInput
|
canManageAll ? (
|
||||||
placeholder={`${t("search")}...`}
|
<SearchInput
|
||||||
ariaLabel={t("search")}
|
placeholder={`${t("search")}...`}
|
||||||
defaultValue={searchParams.search}
|
ariaLabel={t("search")}
|
||||||
flexExpand
|
defaultValue={searchParams.search}
|
||||||
/>
|
flexExpand
|
||||||
|
/>
|
||||||
|
) : undefined
|
||||||
}
|
}
|
||||||
footer={
|
footer={
|
||||||
totalCount > searchParams.pageSize ? (
|
totalCount > searchParams.pageSize ? (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { redirect } from "next/navigation";
|
import { notFound, redirect } from "next/navigation";
|
||||||
import { ActionIcon, ActionIconGroup, Anchor, Badge, Stack, Text } from "@mantine/core";
|
import { ActionIcon, ActionIconGroup, Anchor, Badge, Stack, Text } from "@mantine/core";
|
||||||
import { IconPencil, IconPlugX } from "@tabler/icons-react";
|
import { IconPencil, IconPlugX } from "@tabler/icons-react";
|
||||||
import { z } from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
@@ -15,6 +15,7 @@ import { TourTarget } from "~/components/layout/header/tour-target";
|
|||||||
import { ManageCollectionItem, ManageCollectionPage } from "~/components/manage/manage-collection";
|
import { ManageCollectionItem, ManageCollectionPage } from "~/components/manage/manage-collection";
|
||||||
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
|
import { MobileAffixButton } from "~/components/manage/mobile-affix-button";
|
||||||
import { NoResults } from "~/components/no-results";
|
import { NoResults } from "~/components/no-results";
|
||||||
|
import { getIntegrationsSectionAccess } from "../_access";
|
||||||
import { DeleteIntegrationActionButton } from "./_integration-buttons";
|
import { DeleteIntegrationActionButton } from "./_integration-buttons";
|
||||||
|
|
||||||
const searchParamsSchema = z.object({ search: z.string().optional() });
|
const searchParamsSchema = z.object({ search: z.string().optional() });
|
||||||
@@ -29,14 +30,22 @@ export default async function IntegrationsPage(props: IntegrationsPageProps) {
|
|||||||
|
|
||||||
const searchParams = searchParamsSchema.parse(await props.searchParams);
|
const searchParams = searchParamsSchema.parse(await props.searchParams);
|
||||||
const integrations = await api.integration.all();
|
const integrations = await api.integration.all();
|
||||||
|
const {
|
||||||
|
canManageAll: hasGlobalFullAccess,
|
||||||
|
canCreate,
|
||||||
|
canAccess,
|
||||||
|
} = getIntegrationsSectionAccess(session, integrations);
|
||||||
|
if (!canAccess) notFound();
|
||||||
|
|
||||||
const t = await getScopedI18n("integration");
|
const t = await getScopedI18n("integration");
|
||||||
const canCreate = session.user.permissions.includes("integration-create");
|
// Without integration-full-all only the integrations that were explicitly delegated to the user
|
||||||
const hasGlobalFullAccess = session.user.permissions.includes("integration-full-all");
|
// are manageable, so the list never shows an integration they cannot open.
|
||||||
const canSee = hasGlobalFullAccess || integrations.some((integration) => integration.permissions.hasFullAccess);
|
const manageableIntegrations = integrations.filter(
|
||||||
|
(integration) => hasGlobalFullAccess || integration.permissions.hasFullAccess,
|
||||||
|
);
|
||||||
|
|
||||||
const query = searchParams.search?.trim().toLocaleLowerCase() ?? "";
|
const query = searchParams.search?.trim().toLocaleLowerCase() ?? "";
|
||||||
const filteredIntegrations = integrations
|
const filteredIntegrations = manageableIntegrations
|
||||||
.filter((integration) => hasGlobalFullAccess || integration.permissions.hasFullAccess)
|
|
||||||
.filter((integration) => {
|
.filter((integration) => {
|
||||||
if (!query) return true;
|
if (!query) return true;
|
||||||
return [integration.name, getIntegrationName(integration.kind), integration.url].some((value) =>
|
return [integration.name, getIntegrationName(integration.kind), integration.url].some((value) =>
|
||||||
@@ -56,11 +65,12 @@ export default async function IntegrationsPage(props: IntegrationsPageProps) {
|
|||||||
ariaLabel={t("page.list.ariaLabel")}
|
ariaLabel={t("page.list.ariaLabel")}
|
||||||
itemCount={filteredIntegrations.length}
|
itemCount={filteredIntegrations.length}
|
||||||
emptyState={
|
emptyState={
|
||||||
!canSee ? (
|
manageableIntegrations.length === 0 && !hasGlobalFullAccess ? (
|
||||||
<NoResults
|
<NoResults
|
||||||
icon={IconPlugX}
|
icon={IconPlugX}
|
||||||
title={t("page.list.noResults.noPermissionTitle")}
|
title={t("page.list.noResults.createOnlyTitle")}
|
||||||
description={t("page.list.noResults.noPermissionDescription")}
|
description={t("page.list.noResults.createOnlyDescription")}
|
||||||
|
action={{ label: t("page.list.noResults.action"), href: "/manage/integrations/new" }}
|
||||||
/>
|
/>
|
||||||
) : hasSearch ? (
|
) : hasSearch ? (
|
||||||
<NoResults
|
<NoResults
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import {
|
|||||||
IconUsersGroup,
|
IconUsersGroup,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
|
|
||||||
import { api } from "@homarr/api/server";
|
|
||||||
import { getRscUserSettingsAsync } from "@homarr/api/user-server";
|
import { getRscUserSettingsAsync } from "@homarr/api/user-server";
|
||||||
import { auth } from "@homarr/auth/next";
|
import { auth } from "@homarr/auth/next";
|
||||||
import { isProviderEnabled } from "@homarr/auth/server";
|
import { isProviderEnabled } from "@homarr/auth/server";
|
||||||
@@ -45,6 +44,7 @@ import { MainNavigation } from "~/components/layout/navigation";
|
|||||||
import { ClientShell } from "~/components/layout/shell";
|
import { ClientShell } from "~/components/layout/shell";
|
||||||
import { ManageTourGate } from "~/components/onboarding/manage-tour-gate";
|
import { ManageTourGate } from "~/components/onboarding/manage-tour-gate";
|
||||||
import { env as nextEnv } from "~/env";
|
import { env as nextEnv } from "~/env";
|
||||||
|
import { getAppsSectionAccess, getIntegrationsSectionAccessAsync } from "./_access";
|
||||||
|
|
||||||
const logger = createLogger({ module: "manageLayout" });
|
const logger = createLogger({ module: "manageLayout" });
|
||||||
|
|
||||||
@@ -66,12 +66,8 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
|
|||||||
sessionPromise,
|
sessionPromise,
|
||||||
shouldRunManageTourPromise,
|
shouldRunManageTourPromise,
|
||||||
]);
|
]);
|
||||||
const hasGlobalIntegrationFullAccess = session?.user.permissions.includes("integration-full-all") ?? false;
|
const appsAccess = getAppsSectionAccess(session);
|
||||||
const hasDelegatedIntegrationFullAccess =
|
const integrationsAccess = await getIntegrationsSectionAccessAsync(session);
|
||||||
!hasGlobalIntegrationFullAccess && session
|
|
||||||
? (await api.integration.all()).some((integration) => integration.permissions.hasFullAccess)
|
|
||||||
: false;
|
|
||||||
const canManageIntegrations = hasGlobalIntegrationFullAccess || hasDelegatedIntegrationFullAccess;
|
|
||||||
const navigationLinks: NavigationLink[] = [
|
const navigationLinks: NavigationLink[] = [
|
||||||
{
|
{
|
||||||
label: t("items.home"),
|
label: t("items.home"),
|
||||||
@@ -89,7 +85,7 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
|
|||||||
icon: IconBox,
|
icon: IconBox,
|
||||||
href: "/manage/apps",
|
href: "/manage/apps",
|
||||||
label: t("items.apps"),
|
label: t("items.apps"),
|
||||||
hidden: !session?.user.permissions.includes("app-modify-all"),
|
hidden: !appsAccess.canAccess,
|
||||||
iconProps: {
|
iconProps: {
|
||||||
strokeWidth: 2.5,
|
strokeWidth: 2.5,
|
||||||
},
|
},
|
||||||
@@ -99,7 +95,7 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
|
|||||||
icon: IconAffiliateFilled,
|
icon: IconAffiliateFilled,
|
||||||
href: "/manage/integrations",
|
href: "/manage/integrations",
|
||||||
label: t("items.integrations"),
|
label: t("items.integrations"),
|
||||||
hidden: !canManageIntegrations,
|
hidden: !integrationsAccess.canAccess,
|
||||||
"data-onboarding-tour-id": "manage-integrations",
|
"data-onboarding-tour-id": "manage-integrations",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+141
-44
@@ -1,16 +1,19 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { PropsWithChildren } from "react";
|
import type { PropsWithChildren } from "react";
|
||||||
import { useCallback } from "react";
|
import { useCallback, useId } from "react";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
|
Checkbox,
|
||||||
Collapse,
|
Collapse,
|
||||||
|
Divider,
|
||||||
Group,
|
Group,
|
||||||
SegmentedControl,
|
SegmentedControl,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
|
Tooltip,
|
||||||
Transition,
|
Transition,
|
||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
@@ -23,6 +26,7 @@ import type { GroupPermissionKey, PermissionMatrixCategory, PermissionMatrixStat
|
|||||||
import {
|
import {
|
||||||
getPermissionsWithChildren,
|
getPermissionsWithChildren,
|
||||||
groupPermissionKeys,
|
groupPermissionKeys,
|
||||||
|
isCreateImpliedByLevel,
|
||||||
matrixStateToPermissions,
|
matrixStateToPermissions,
|
||||||
permissionMatrix,
|
permissionMatrix,
|
||||||
permissionsToMatrixState,
|
permissionsToMatrixState,
|
||||||
@@ -72,34 +76,57 @@ type MatrixForm = ReturnType<typeof useFormContext>;
|
|||||||
|
|
||||||
const emptyMatrixState = (): PermissionMatrixState =>
|
const emptyMatrixState = (): PermissionMatrixState =>
|
||||||
objectKeys(permissionMatrix).reduce((acc, category) => {
|
objectKeys(permissionMatrix).reduce((acc, category) => {
|
||||||
acc[category] = { level: 0 };
|
acc[category] = { level: 0, create: false };
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as PermissionMatrixState);
|
}, {} as PermissionMatrixState);
|
||||||
|
|
||||||
export const getMatrixLevel = (values: FormType, category: PermissionMatrixCategory): number => {
|
const matrixStateOf = (values: FormType) => permissionsToMatrixState(groupPermissionKeys.filter((key) => values[key]));
|
||||||
const checkedKeys = groupPermissionKeys.filter((key) => values[key]);
|
|
||||||
return permissionsToMatrixState(checkedKeys)[category].level;
|
export const getMatrixLevel = (values: FormType, category: PermissionMatrixCategory): number =>
|
||||||
};
|
matrixStateOf(values)[category].level;
|
||||||
|
|
||||||
|
export const hasMatrixCreate = (values: FormType, category: PermissionMatrixCategory): boolean =>
|
||||||
|
matrixStateOf(values)[category].create;
|
||||||
|
|
||||||
export const applyMatrixLevel = (form: MatrixForm, category: PermissionMatrixCategory, level: number) => {
|
export const applyMatrixLevel = (form: MatrixForm, category: PermissionMatrixCategory, level: number) => {
|
||||||
const targetKeys = new Set(matrixStateToPermissions({ ...emptyMatrixState(), [category]: { level } }));
|
const targetKeys = new Set(matrixStateToPermissions({ ...emptyMatrixState(), [category]: { level, create: false } }));
|
||||||
permissionMatrix[category].levels.forEach((key) => {
|
permissionMatrix[category].levels.forEach((key) => {
|
||||||
form.setFieldValue(key, targetKeys.has(key));
|
form.setFieldValue(key, targetKeys.has(key));
|
||||||
});
|
});
|
||||||
|
// The create key is deliberately left untouched: a level that implies creating already covers it,
|
||||||
|
// and an explicitly granted create must survive lowering the level again.
|
||||||
|
};
|
||||||
|
|
||||||
|
export const applyMatrixCreate = (form: MatrixForm, category: PermissionMatrixCategory, create: boolean) => {
|
||||||
|
const createKey = permissionMatrix[category].create;
|
||||||
|
if (createKey !== null) {
|
||||||
|
form.setFieldValue(createKey, create);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const presets = {
|
const presets = {
|
||||||
viewer: { board: 1, app: 1, integration: 1, media: 1 },
|
viewer: {
|
||||||
editor: { board: 2, app: 2, integration: 2, "search-engine": 1, media: 1 },
|
board: { level: 1, create: false },
|
||||||
admin: { admin: 1 },
|
app: { level: 1, create: false },
|
||||||
} satisfies Record<string, Partial<Record<PermissionMatrixCategory, number>>>;
|
integration: { level: 1, create: false },
|
||||||
|
media: { level: 1, create: false },
|
||||||
|
},
|
||||||
|
editor: {
|
||||||
|
board: { level: 2, create: true },
|
||||||
|
app: { level: 2, create: true },
|
||||||
|
integration: { level: 2, create: true },
|
||||||
|
"search-engine": { level: 1, create: true },
|
||||||
|
media: { level: 1, create: true },
|
||||||
|
},
|
||||||
|
admin: { admin: { level: 1, create: false } },
|
||||||
|
} satisfies Record<string, Partial<PermissionMatrixState>>;
|
||||||
|
|
||||||
export type PermissionPreset = keyof typeof presets;
|
export type PermissionPreset = keyof typeof presets;
|
||||||
|
|
||||||
const presetToFormState = (preset: PermissionPreset): FormType => {
|
const presetToFormState = (preset: PermissionPreset): FormType => {
|
||||||
const levels: Partial<Record<PermissionMatrixCategory, number>> = presets[preset];
|
const presetState: Partial<PermissionMatrixState> = presets[preset];
|
||||||
const state = objectKeys(permissionMatrix).reduce((acc, category) => {
|
const state = objectKeys(permissionMatrix).reduce((acc, category) => {
|
||||||
acc[category] = { level: levels[category] ?? 0 };
|
acc[category] = presetState[category] ?? { level: 0, create: false };
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as PermissionMatrixState);
|
}, {} as PermissionMatrixState);
|
||||||
const enabledKeys = new Set(matrixStateToPermissions(state));
|
const enabledKeys = new Set(matrixStateToPermissions(state));
|
||||||
@@ -123,6 +150,19 @@ export const getActivePreset = (values: FormType): PermissionPreset | null => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Short, scannable label for a level. Categories with a single level use their permission label
|
||||||
|
* instead, so the control reads "No access | View logs" rather than "No access | Enabled".
|
||||||
|
*/
|
||||||
|
const levelLabelKey = (key: GroupPermissionKey) => {
|
||||||
|
if (key.endsWith("-view-all")) return "view" as const;
|
||||||
|
if (key.endsWith("-use-all")) return "use" as const;
|
||||||
|
if (key.endsWith("-interact-all")) return "interact" as const;
|
||||||
|
if (key.endsWith("-modify-all")) return "modify" as const;
|
||||||
|
if (key.endsWith("-full-all")) return "full" as const;
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
interface MatrixImpliedHintProps {
|
interface MatrixImpliedHintProps {
|
||||||
category: PermissionMatrixCategory;
|
category: PermissionMatrixCategory;
|
||||||
permissionLabels: PermissionLabels;
|
permissionLabels: PermissionLabels;
|
||||||
@@ -155,9 +195,10 @@ export const MatrixImpliedHint = ({ category, permissionLabels }: MatrixImpliedH
|
|||||||
interface MatrixRowProps {
|
interface MatrixRowProps {
|
||||||
category: PermissionMatrixCategory;
|
category: PermissionMatrixCategory;
|
||||||
permissionLabels: PermissionLabels;
|
permissionLabels: PermissionLabels;
|
||||||
|
permissionDescriptions: PermissionLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MatrixRow = ({ category, permissionLabels }: MatrixRowProps) => {
|
export const MatrixRow = ({ category, permissionLabels, permissionDescriptions }: MatrixRowProps) => {
|
||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const tPermissions = useScopedI18n("group.permission");
|
const tPermissions = useScopedI18n("group.permission");
|
||||||
|
|
||||||
@@ -165,61 +206,116 @@ export const MatrixRow = ({ category, permissionLabels }: MatrixRowProps) => {
|
|||||||
const level = getMatrixLevel(values, category);
|
const level = getMatrixLevel(values, category);
|
||||||
const isDanger = category === "admin";
|
const isDanger = category === "admin";
|
||||||
const disabledByAdmin = !isDanger && getMatrixLevel(values, "admin") > 0;
|
const disabledByAdmin = !isDanger && getMatrixLevel(values, "admin") > 0;
|
||||||
|
const { levels, create: createKey } = permissionMatrix[category];
|
||||||
|
const hasSingleLevel = levels.length === 1;
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{ value: "0", label: tPermissions("matrix.none") },
|
{ value: "0", label: tPermissions("matrix.none") },
|
||||||
...permissionMatrix[category].levels.map((key, index) => ({
|
...levels.map((key, index) => {
|
||||||
value: String(index + 1),
|
const shortKey = hasSingleLevel ? null : levelLabelKey(key);
|
||||||
label: permissionLabels[key] ?? key,
|
return {
|
||||||
})),
|
value: String(index + 1),
|
||||||
|
label: shortKey === null ? (permissionLabels[key] ?? key) : tPermissions(`matrix.level.${shortKey}`),
|
||||||
|
};
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const selectedKey = level === 0 ? undefined : levels[level - 1];
|
||||||
|
const description =
|
||||||
|
selectedKey === undefined ? tPermissions("matrix.noneDescription") : (permissionDescriptions[selectedKey] ?? "");
|
||||||
|
|
||||||
|
const createImplied = isCreateImpliedByLevel(category, level);
|
||||||
|
const createChecked = hasMatrixCreate(values, category);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={4}>
|
<Stack gap={6}>
|
||||||
<Group gap="sm" wrap="wrap" align="center">
|
<Group gap="sm" wrap="wrap" align="center" justify="space-between">
|
||||||
<Group gap={6} wrap="nowrap">
|
<Group gap={6} wrap="nowrap">
|
||||||
{isDanger && <IconShieldExclamation size={18} color="var(--mantine-color-red-8)" />}
|
{isDanger && <IconShieldExclamation size={18} color="var(--mantine-color-red-8)" />}
|
||||||
<Text fw={500} c={isDanger ? "red.8" : undefined}>
|
<Text fw={500} c={isDanger ? "red.8" : undefined}>
|
||||||
{tPermissions(`${category}.title`)}
|
{tPermissions(`${category}.title`)}
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<SegmentedControl
|
<Group gap="sm" wrap="wrap" align="center">
|
||||||
size="sm"
|
<SegmentedControl
|
||||||
data={data}
|
size="sm"
|
||||||
value={String(level)}
|
data={data}
|
||||||
disabled={disabledByAdmin}
|
value={String(level)}
|
||||||
onChange={(value) => applyMatrixLevel(form, category, Number(value))}
|
disabled={disabledByAdmin}
|
||||||
/>
|
aria-label={tPermissions(`${category}.title`)}
|
||||||
{disabledByAdmin && (
|
onChange={(value) => applyMatrixLevel(form, category, Number(value))}
|
||||||
<Text size="xs" c="dimmed">
|
/>
|
||||||
{tPermissions("matrix.grantedViaAdmin")}
|
{createKey !== null && (
|
||||||
</Text>
|
<Tooltip
|
||||||
)}
|
label={tPermissions("matrix.createIncluded", { level: data[level]?.label ?? "" })}
|
||||||
|
disabled={!createImplied}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
size="sm"
|
||||||
|
label={permissionLabels[createKey] ?? createKey}
|
||||||
|
checked={createChecked}
|
||||||
|
disabled={disabledByAdmin || createImplied}
|
||||||
|
onChange={(event) => applyMatrixCreate(form, category, event.currentTarget.checked)}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Text size="xs" c="dimmed">
|
||||||
|
{description}
|
||||||
|
</Text>
|
||||||
|
{disabledByAdmin && (
|
||||||
|
<Text size="xs" c="dimmed">
|
||||||
|
{tPermissions("matrix.grantedViaAdmin")}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
<MatrixImpliedHint category={category} permissionLabels={permissionLabels} />
|
<MatrixImpliedHint category={category} permissionLabels={permissionLabels} />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface PermissionMatrixProps {
|
||||||
|
permissionLabels: PermissionLabels;
|
||||||
|
permissionDescriptions: PermissionLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PermissionMatrix = ({ permissionLabels, permissionDescriptions }: PermissionMatrixProps) => (
|
||||||
|
<Card withBorder p="md">
|
||||||
|
<Stack gap="md">
|
||||||
|
{objectKeys(permissionMatrix).map((category, index) => (
|
||||||
|
<Stack key={category} gap="md">
|
||||||
|
{index > 0 && <Divider />}
|
||||||
|
<MatrixRow
|
||||||
|
category={category}
|
||||||
|
permissionLabels={permissionLabels}
|
||||||
|
permissionDescriptions={permissionDescriptions}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
|
||||||
export const PresetButtons = () => {
|
export const PresetButtons = () => {
|
||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const tPermissions = useScopedI18n("group.permission");
|
const tPermissions = useScopedI18n("group.permission");
|
||||||
const activePreset = getActivePreset(form.getValues());
|
const activePreset = getActivePreset(form.getValues());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group gap="xs">
|
<Group gap="xs" wrap="wrap">
|
||||||
<Text size="sm" fw={500}>
|
<Text size="sm" fw={500}>
|
||||||
{tPermissions("matrix.preset.label")}
|
{tPermissions("matrix.preset.label")}
|
||||||
</Text>
|
</Text>
|
||||||
{(["viewer", "editor", "admin"] as const).map((preset) => (
|
{(["viewer", "editor", "admin"] as const).map((preset) => (
|
||||||
<Button
|
<Tooltip key={preset} label={tPermissions(`matrix.preset.${preset}Description`)}>
|
||||||
key={preset}
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
variant={activePreset === preset ? "filled" : "default"}
|
variant={activePreset === preset ? "filled" : "default"}
|
||||||
onClick={() => applyPreset(form, preset)}
|
onClick={() => applyPreset(form, preset)}
|
||||||
>
|
>
|
||||||
{tPermissions(`matrix.preset.${preset}`)}
|
{tPermissions(`matrix.preset.${preset}`)}
|
||||||
</Button>
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
))}
|
))}
|
||||||
{activePreset === null && <Badge variant="light">{tPermissions("matrix.preset.custom")}</Badge>}
|
{activePreset === null && <Badge variant="light">{tPermissions("matrix.preset.custom")}</Badge>}
|
||||||
</Group>
|
</Group>
|
||||||
@@ -234,6 +330,7 @@ export const EffectivePermissionPreview = ({ permissionLabels }: EffectivePermis
|
|||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const tPermissions = useScopedI18n("group.permission");
|
const tPermissions = useScopedI18n("group.permission");
|
||||||
const [opened, { toggle }] = useDisclosure(false);
|
const [opened, { toggle }] = useDisclosure(false);
|
||||||
|
const panelId = useId();
|
||||||
|
|
||||||
const values = form.getValues();
|
const values = form.getValues();
|
||||||
const checkedKeys = groupPermissionKeys.filter((key) => values[key]);
|
const checkedKeys = groupPermissionKeys.filter((key) => values[key]);
|
||||||
@@ -248,7 +345,7 @@ export const EffectivePermissionPreview = ({ permissionLabels }: EffectivePermis
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card withBorder p="md">
|
<Card withBorder p="md">
|
||||||
<UnstyledButton onClick={toggle} w="100%" aria-expanded={opened}>
|
<UnstyledButton onClick={toggle} w="100%" aria-expanded={opened} aria-controls={panelId}>
|
||||||
<Group justify="space-between" wrap="nowrap">
|
<Group justify="space-between" wrap="nowrap">
|
||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<Text fw={500}>{tPermissions("matrix.effective.title")}</Text>
|
<Text fw={500}>{tPermissions("matrix.effective.title")}</Text>
|
||||||
@@ -259,7 +356,7 @@ export const EffectivePermissionPreview = ({ permissionLabels }: EffectivePermis
|
|||||||
<Badge variant="light">{effective.length}</Badge>
|
<Badge variant="light">{effective.length}</Badge>
|
||||||
</Group>
|
</Group>
|
||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
<Collapse expanded={opened}>
|
<Collapse id={panelId} expanded={opened}>
|
||||||
<Stack gap="xs" mt="sm">
|
<Stack gap="xs" mt="sm">
|
||||||
{grouped.length === 0 ? (
|
{grouped.length === 0 ? (
|
||||||
<Text size="sm" c="dimmed">
|
<Text size="sm" c="dimmed">
|
||||||
@@ -267,7 +364,7 @@ export const EffectivePermissionPreview = ({ permissionLabels }: EffectivePermis
|
|||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
grouped.map(({ category, keys }) => (
|
grouped.map(({ category, keys }) => (
|
||||||
<Group key={category} gap="xs" wrap="nowrap" align="flex-start">
|
<Group key={category} gap="xs" wrap="wrap" align="flex-start">
|
||||||
<Text size="sm" fw={500}>
|
<Text size="sm" fw={500}>
|
||||||
{tPermissions(`${category}.title`)}
|
{tPermissions(`${category}.title`)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import { api } from "@homarr/api/server";
|
|||||||
import { auth } from "@homarr/auth/next";
|
import { auth } from "@homarr/auth/next";
|
||||||
import { objectKeys } from "@homarr/common";
|
import { objectKeys } from "@homarr/common";
|
||||||
import type { GroupPermissionKey } from "@homarr/definitions";
|
import type { GroupPermissionKey } from "@homarr/definitions";
|
||||||
import { groupPermissions, permissionMatrix } from "@homarr/definitions";
|
import { groupPermissions } from "@homarr/definitions";
|
||||||
import { getI18n, getScopedI18n } from "@homarr/translation/server";
|
import { getI18n, getScopedI18n } from "@homarr/translation/server";
|
||||||
|
|
||||||
import type { PermissionLabels } from "./_group-permission-form";
|
import type { PermissionLabels } from "./_group-permission-form";
|
||||||
import {
|
import {
|
||||||
EffectivePermissionPreview,
|
EffectivePermissionPreview,
|
||||||
MatrixRow,
|
|
||||||
PermissionForm,
|
PermissionForm,
|
||||||
|
PermissionMatrix,
|
||||||
PresetButtons,
|
PresetButtons,
|
||||||
SaveAffix,
|
SaveAffix,
|
||||||
} from "./_group-permission-form";
|
} from "./_group-permission-form";
|
||||||
@@ -34,7 +34,7 @@ export default async function GroupPermissionsPage(props: GroupPermissionsPagePr
|
|||||||
const group = await api.group.getById({ id: params.id });
|
const group = await api.group.getById({ id: params.id });
|
||||||
const t = await getI18n();
|
const t = await getI18n();
|
||||||
|
|
||||||
const permissionLabels = await buildPermissionLabels();
|
const { permissionLabels, permissionDescriptions } = await buildPermissionTextsAsync();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
@@ -44,11 +44,7 @@ export default async function GroupPermissionsPage(props: GroupPermissionsPagePr
|
|||||||
<Stack pos="relative">
|
<Stack pos="relative">
|
||||||
<PresetButtons />
|
<PresetButtons />
|
||||||
|
|
||||||
<Stack gap="md">
|
<PermissionMatrix permissionLabels={permissionLabels} permissionDescriptions={permissionDescriptions} />
|
||||||
{objectKeys(permissionMatrix).map((category) => (
|
|
||||||
<MatrixRow key={category} category={category} permissionLabels={permissionLabels} />
|
|
||||||
))}
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<EffectivePermissionPreview permissionLabels={permissionLabels} />
|
<EffectivePermissionPreview permissionLabels={permissionLabels} />
|
||||||
|
|
||||||
@@ -59,8 +55,9 @@ export default async function GroupPermissionsPage(props: GroupPermissionsPagePr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildPermissionLabels = async (): Promise<PermissionLabels> => {
|
const buildPermissionTextsAsync = async () => {
|
||||||
const permissionLabels: PermissionLabels = {};
|
const permissionLabels: PermissionLabels = {};
|
||||||
|
const permissionDescriptions: PermissionLabels = {};
|
||||||
|
|
||||||
for (const category of objectKeys(groupPermissions)) {
|
for (const category of objectKeys(groupPermissions)) {
|
||||||
const tItem = await getScopedI18n(`group.permission.${category}.item`);
|
const tItem = await getScopedI18n(`group.permission.${category}.item`);
|
||||||
@@ -70,8 +67,9 @@ const buildPermissionLabels = async (): Promise<PermissionLabels> => {
|
|||||||
suffixes.forEach((suffix) => {
|
suffixes.forEach((suffix) => {
|
||||||
const key = (typeof item !== "boolean" ? `${category}-${suffix}` : "admin") as GroupPermissionKey;
|
const key = (typeof item !== "boolean" ? `${category}-${suffix}` : "admin") as GroupPermissionKey;
|
||||||
permissionLabels[key] = tItem(`${suffix}.label`);
|
permissionLabels[key] = tItem(`${suffix}.label`);
|
||||||
|
permissionDescriptions[key] = tItem(`${suffix}.description`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return permissionLabels;
|
return { permissionLabels, permissionDescriptions };
|
||||||
};
|
};
|
||||||
@@ -9,7 +9,6 @@ import type { Database } from "@homarr/db";
|
|||||||
import { and, eq, handleTransactionsAsync, like, not } from "@homarr/db";
|
import { and, eq, handleTransactionsAsync, like, not } from "@homarr/db";
|
||||||
import { getMaxGroupPositionAsync } from "@homarr/db/queries";
|
import { getMaxGroupPositionAsync } from "@homarr/db/queries";
|
||||||
import { groupMembers, groupPermissions, groups, onboarding, users } from "@homarr/db/schema";
|
import { groupMembers, groupPermissions, groups, onboarding, users } from "@homarr/db/schema";
|
||||||
import type { GroupPermissionKey } from "@homarr/definitions";
|
|
||||||
import { everyoneGroup } from "@homarr/definitions";
|
import { everyoneGroup } from "@homarr/definitions";
|
||||||
import { byIdSchema, paginatedSchema } from "@homarr/validation/common";
|
import { byIdSchema, paginatedSchema } from "@homarr/validation/common";
|
||||||
import {
|
import {
|
||||||
@@ -23,13 +22,6 @@ import {
|
|||||||
|
|
||||||
import { createTRPCRouter, onboardingProcedure, permissionRequiredProcedure, protectedProcedure } from "../trpc";
|
import { createTRPCRouter, onboardingProcedure, permissionRequiredProcedure, protectedProcedure } from "../trpc";
|
||||||
|
|
||||||
const createPermissionParents = new Map<GroupPermissionKey, GroupPermissionKey>([
|
|
||||||
["app-create", "app-modify-all"],
|
|
||||||
["integration-create", "integration-full-all"],
|
|
||||||
["board-create", "board-full-all"],
|
|
||||||
["search-engine-create", "search-engine-modify-all"],
|
|
||||||
]);
|
|
||||||
|
|
||||||
export const groupRouter = createTRPCRouter({
|
export const groupRouter = createTRPCRouter({
|
||||||
getAll: permissionRequiredProcedure.requiresPermission("admin").query(async ({ ctx }) => {
|
getAll: permissionRequiredProcedure.requiresPermission("admin").query(async ({ ctx }) => {
|
||||||
const dbGroups = await ctx.db.query.groups.findMany({
|
const dbGroups = await ctx.db.query.groups.findMany({
|
||||||
@@ -310,14 +302,9 @@ export const groupRouter = createTRPCRouter({
|
|||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
await throwIfGroupNotFoundAsync(ctx.db, input.groupId);
|
await throwIfGroupNotFoundAsync(ctx.db, input.groupId);
|
||||||
|
|
||||||
const permissions = [
|
// Stored exactly as selected - implied permissions are resolved at read time through
|
||||||
...new Set(
|
// getPermissionsWithChildren, so nothing is silently escalated here.
|
||||||
input.permissions.flatMap((permission) => {
|
const permissions = [...new Set(input.permissions)];
|
||||||
const parent = createPermissionParents.get(permission);
|
|
||||||
return parent ? [permission, parent] : [permission];
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
await handleTransactionsAsync(ctx.db, {
|
await handleTransactionsAsync(ctx.db, {
|
||||||
async handleAsync(db, schema) {
|
async handleAsync(db, schema) {
|
||||||
|
|||||||
@@ -123,12 +123,15 @@ export const homeRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These mirror the access rules of /manage/integrations and /manage/apps exactly: a card is only
|
||||||
|
// shown when the page behind it is reachable, and it counts only what the user is allowed to see.
|
||||||
const hasGlobalFullIntegrationAccess = ctx.session?.user.permissions.includes("integration-full-all") ?? false;
|
const hasGlobalFullIntegrationAccess = ctx.session?.user.permissions.includes("integration-full-all") ?? false;
|
||||||
|
const canCreateIntegrations = ctx.session?.user.permissions.includes("integration-create") ?? false;
|
||||||
const fullAccessIntegrationIds =
|
const fullAccessIntegrationIds =
|
||||||
hasGlobalFullIntegrationAccess || !ctx.session?.user
|
hasGlobalFullIntegrationAccess || !ctx.session?.user
|
||||||
? []
|
? []
|
||||||
: await getFullAccessIntegrationIdsAsync(ctx.db, ctx.session.user.id);
|
: await getFullAccessIntegrationIdsAsync(ctx.db, ctx.session.user.id);
|
||||||
if (hasGlobalFullIntegrationAccess || fullAccessIntegrationIds.length > 0) {
|
if (hasGlobalFullIntegrationAccess || canCreateIntegrations || fullAccessIntegrationIds.length > 0) {
|
||||||
statistics.push({
|
statistics.push({
|
||||||
titleKey: "integration",
|
titleKey: "integration",
|
||||||
subtitleKey: "resources",
|
subtitleKey: "resources",
|
||||||
@@ -137,11 +140,12 @@ export const homeRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.session?.user.permissions.includes("app-modify-all")) {
|
const canManageAllApps = ctx.session?.user.permissions.includes("app-modify-all") ?? false;
|
||||||
|
if (canManageAllApps || (ctx.session?.user.permissions.includes("app-create") ?? false)) {
|
||||||
statistics.push({
|
statistics.push({
|
||||||
titleKey: "app",
|
titleKey: "app",
|
||||||
subtitleKey: "resources",
|
subtitleKey: "resources",
|
||||||
count: await db.$count(apps),
|
count: canManageAllApps ? await db.$count(apps) : 0,
|
||||||
path: "/manage/apps",
|
path: "/manage/apps",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ describe("savePermissions should save permissions for group", () => {
|
|||||||
expect(permissions.map(({ permission }) => permission)).toEqual(["integration-use-all", "board-full-all"]);
|
expect(permissions.map(({ permission }) => permission)).toEqual(["integration-use-all", "board-full-all"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("with a create permission it should also persist its parent permission", async () => {
|
test("with a standalone create permission it should not escalate to its parent permission", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const db = createDb();
|
const db = createDb();
|
||||||
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
||||||
@@ -464,7 +464,7 @@ describe("savePermissions should save permissions for group", () => {
|
|||||||
// Act
|
// Act
|
||||||
await caller.savePermissions({
|
await caller.savePermissions({
|
||||||
groupId,
|
groupId,
|
||||||
permissions: ["app-create"],
|
permissions: ["board-create"],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -472,37 +472,34 @@ describe("savePermissions should save permissions for group", () => {
|
|||||||
where: eq(groupPermissions.groupId, groupId),
|
where: eq(groupPermissions.groupId, groupId),
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual(["app-create", "app-modify-all"]);
|
expect(permissions.map(({ permission }) => permission)).toEqual(["board-create"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("with an integration create permission it should persist its parent permission", async () => {
|
test.each([["app-create"], ["integration-create"], ["search-engine-create"], ["media-upload"]] as const)(
|
||||||
// Arrange
|
"with %s alone it should persist exactly that permission",
|
||||||
const db = createDb();
|
async (permission) => {
|
||||||
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
// Arrange
|
||||||
|
const db = createDb();
|
||||||
|
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
||||||
|
|
||||||
const groupId = createId();
|
const groupId = createId();
|
||||||
await db.insert(groups).values({
|
await db.insert(groups).values({
|
||||||
id: groupId,
|
id: groupId,
|
||||||
name: "Group",
|
name: "Group",
|
||||||
position: 1,
|
position: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await caller.savePermissions({
|
await caller.savePermissions({ groupId, permissions: [permission] });
|
||||||
groupId,
|
|
||||||
permissions: ["integration-create"],
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const permissions = await db.query.groupPermissions.findMany({
|
const permissions = await db.query.groupPermissions.findMany({
|
||||||
where: eq(groupPermissions.groupId, groupId),
|
where: eq(groupPermissions.groupId, groupId),
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual([
|
expect(permissions.map(({ permission: key }) => key)).toEqual([permission]);
|
||||||
"integration-create",
|
},
|
||||||
"integration-full-all",
|
);
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("with a create permission and its parent it should persist exactly two rows", async () => {
|
test("with a create permission and its parent it should persist exactly two rows", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
@@ -531,6 +528,56 @@ describe("savePermissions should save permissions for group", () => {
|
|||||||
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual(["app-create", "app-modify-all"]);
|
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual(["app-create", "app-modify-all"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("with duplicate permissions it should persist each permission only once", async () => {
|
||||||
|
// Arrange
|
||||||
|
const db = createDb();
|
||||||
|
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
||||||
|
|
||||||
|
const groupId = createId();
|
||||||
|
await db.insert(groups).values({
|
||||||
|
id: groupId,
|
||||||
|
name: "Group",
|
||||||
|
position: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await caller.savePermissions({
|
||||||
|
groupId,
|
||||||
|
permissions: ["board-view-all", "board-view-all", "board-modify-all"],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const permissions = await db.query.groupPermissions.findMany({
|
||||||
|
where: eq(groupPermissions.groupId, groupId),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual(["board-modify-all", "board-view-all"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("saving the same permissions twice should be idempotent", async () => {
|
||||||
|
// Arrange
|
||||||
|
const db = createDb();
|
||||||
|
const caller = groupRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
||||||
|
|
||||||
|
const groupId = createId();
|
||||||
|
await db.insert(groups).values({
|
||||||
|
id: groupId,
|
||||||
|
name: "Group",
|
||||||
|
position: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await caller.savePermissions({ groupId, permissions: ["board-create", "media-upload"] });
|
||||||
|
await caller.savePermissions({ groupId, permissions: ["board-create", "media-upload"] });
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const permissions = await db.query.groupPermissions.findMany({
|
||||||
|
where: eq(groupPermissions.groupId, groupId),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(permissions.map(({ permission }) => permission).toSorted()).toEqual(["board-create", "media-upload"]);
|
||||||
|
});
|
||||||
|
|
||||||
test("with an empty permission list it should clear all existing permissions", async () => {
|
test("with an empty permission list it should clear all existing permissions", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const db = createDb();
|
const db = createDb();
|
||||||
|
|||||||
@@ -119,23 +119,53 @@ export const groupPermissionKeys = objectKeys(groupPermissions).reduce((acc, key
|
|||||||
}, [] as GroupPermissionKey[]);
|
}, [] as GroupPermissionKey[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ordered access levels per category used by the group permission matrix UI.
|
* Describes how each permission category is presented in the group permission matrix UI.
|
||||||
* Each level entry is a full {@link GroupPermissionKey}; higher levels imply the lower ones
|
*
|
||||||
* through {@link groupPermissionParents}.
|
* `levels` is an ordered escalation of access: picking level N grants every key up to N.
|
||||||
|
* `create` is orthogonal to `levels` - it is the "may add new resources" capability and can be
|
||||||
|
* granted on its own (e.g. "members may create their own boards but not see anyone else's").
|
||||||
|
* Some levels already imply the create key through {@link groupPermissionParents}; use
|
||||||
|
* {@link isCreateImpliedByLevel} to detect that instead of hard-coding it.
|
||||||
|
*
|
||||||
|
* Together, `levels` and `create` cover every key in {@link groupPermissionKeys}, so the matrix
|
||||||
|
* is a lossless representation of a group's permissions.
|
||||||
*/
|
*/
|
||||||
export const permissionMatrix = {
|
export const permissionMatrix = {
|
||||||
board: { levels: ["board-view-all", "board-modify-all", "board-full-all"] },
|
board: { levels: ["board-view-all", "board-modify-all", "board-full-all"], create: "board-create" },
|
||||||
app: { levels: ["app-use-all", "app-modify-all", "app-full-all"] },
|
app: { levels: ["app-use-all", "app-modify-all", "app-full-all"], create: "app-create" },
|
||||||
integration: { levels: ["integration-use-all", "integration-interact-all", "integration-full-all"] },
|
integration: {
|
||||||
"search-engine": { levels: ["search-engine-modify-all", "search-engine-full-all"] },
|
levels: ["integration-use-all", "integration-interact-all", "integration-full-all"],
|
||||||
media: { levels: ["media-view-all", "media-full-all"] },
|
create: "integration-create",
|
||||||
other: { levels: ["other-view-logs"] },
|
},
|
||||||
admin: { levels: ["admin"] },
|
"search-engine": { levels: ["search-engine-modify-all", "search-engine-full-all"], create: "search-engine-create" },
|
||||||
} as const satisfies Record<string, { levels: readonly GroupPermissionKey[] }>;
|
media: { levels: ["media-view-all", "media-full-all"], create: "media-upload" },
|
||||||
|
other: { levels: ["other-view-logs"], create: null },
|
||||||
|
admin: { levels: ["admin"], create: null },
|
||||||
|
} as const satisfies Record<string, { levels: readonly GroupPermissionKey[]; create: GroupPermissionKey | null }>;
|
||||||
|
|
||||||
export type PermissionMatrixCategory = keyof typeof permissionMatrix;
|
export type PermissionMatrixCategory = keyof typeof permissionMatrix;
|
||||||
|
|
||||||
export type PermissionMatrixState = Record<PermissionMatrixCategory, { level: number }>;
|
export interface PermissionMatrixCategoryState {
|
||||||
|
/** 0 = no access, N = every key up to `permissionMatrix[category].levels[N - 1]` */
|
||||||
|
level: number;
|
||||||
|
/** Whether the category's create/upload key is granted */
|
||||||
|
create: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PermissionMatrixState = Record<PermissionMatrixCategory, PermissionMatrixCategoryState>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the given level already grants the category's create key through permission inheritance.
|
||||||
|
* For example board level 3 (`board-full-all`) implies `board-create`.
|
||||||
|
*/
|
||||||
|
export const isCreateImpliedByLevel = (category: PermissionMatrixCategory, level: number) => {
|
||||||
|
const createKey = permissionMatrix[category].create;
|
||||||
|
if (createKey === null || level <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getPermissionsWithChildren([...permissionMatrix[category].levels.slice(0, level)]).includes(createKey);
|
||||||
|
};
|
||||||
|
|
||||||
export const permissionsToMatrixState = (permissions: GroupPermissionKey[]): PermissionMatrixState => {
|
export const permissionsToMatrixState = (permissions: GroupPermissionKey[]): PermissionMatrixState => {
|
||||||
const permissionSet = new Set(permissions);
|
const permissionSet = new Set(permissions);
|
||||||
@@ -147,7 +177,11 @@ export const permissionsToMatrixState = (permissions: GroupPermissionKey[]): Per
|
|||||||
level = index + 1;
|
level = index + 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
acc[category] = { level };
|
const createKey = permissionMatrix[category].create;
|
||||||
|
acc[category] = {
|
||||||
|
level,
|
||||||
|
create: createKey !== null && (permissionSet.has(createKey) || isCreateImpliedByLevel(category, level)),
|
||||||
|
};
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as PermissionMatrixState);
|
}, {} as PermissionMatrixState);
|
||||||
};
|
};
|
||||||
@@ -155,6 +189,12 @@ export const permissionsToMatrixState = (permissions: GroupPermissionKey[]): Per
|
|||||||
export const matrixStateToPermissions = (state: PermissionMatrixState): GroupPermissionKey[] => {
|
export const matrixStateToPermissions = (state: PermissionMatrixState): GroupPermissionKey[] => {
|
||||||
return objectKeys(permissionMatrix).reduce((acc, category) => {
|
return objectKeys(permissionMatrix).reduce((acc, category) => {
|
||||||
acc.push(...permissionMatrix[category].levels.slice(0, state[category].level));
|
acc.push(...permissionMatrix[category].levels.slice(0, state[category].level));
|
||||||
|
// Skip the create key when the chosen level already implies it, so the stored permissions
|
||||||
|
// stay minimal and a state -> permissions -> state round-trip is exact.
|
||||||
|
const createKey = permissionMatrix[category].create;
|
||||||
|
if (createKey !== null && state[category].create && !isCreateImpliedByLevel(category, state[category].level)) {
|
||||||
|
acc.push(createKey);
|
||||||
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as GroupPermissionKey[]);
|
}, [] as GroupPermissionKey[]);
|
||||||
};
|
};
|
||||||
@@ -1,13 +1,27 @@
|
|||||||
import { describe, expect, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
|
|
||||||
import type { GroupPermissionKey } from "../permissions";
|
import type { GroupPermissionKey, PermissionMatrixState } from "../permissions";
|
||||||
import {
|
import {
|
||||||
getPermissionsWithChildren,
|
getPermissionsWithChildren,
|
||||||
getPermissionsWithParents,
|
getPermissionsWithParents,
|
||||||
|
groupPermissionKeys,
|
||||||
|
isCreateImpliedByLevel,
|
||||||
matrixStateToPermissions,
|
matrixStateToPermissions,
|
||||||
|
permissionMatrix,
|
||||||
permissionsToMatrixState,
|
permissionsToMatrixState,
|
||||||
} from "../permissions";
|
} from "../permissions";
|
||||||
|
|
||||||
|
const emptyState = (overrides: Partial<PermissionMatrixState> = {}): PermissionMatrixState => ({
|
||||||
|
board: { level: 0, create: false },
|
||||||
|
app: { level: 0, create: false },
|
||||||
|
integration: { level: 0, create: false },
|
||||||
|
"search-engine": { level: 0, create: false },
|
||||||
|
media: { level: 0, create: false },
|
||||||
|
other: { level: 0, create: false },
|
||||||
|
admin: { level: 0, create: false },
|
||||||
|
...overrides,
|
||||||
|
});
|
||||||
|
|
||||||
describe("getPermissionsWithParents should return the correct permissions", () => {
|
describe("getPermissionsWithParents should return the correct permissions", () => {
|
||||||
test.each([
|
test.each([
|
||||||
[["board-view-all"], ["board-view-all", "board-modify-all", "board-full-all", "admin"]],
|
[["board-view-all"], ["board-view-all", "board-modify-all", "board-full-all", "admin"]],
|
||||||
@@ -51,10 +65,23 @@ describe("getPermissionsWithChildren should return the correct permissions", ()
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("the matrix must be able to represent every permission", () => {
|
||||||
|
test("every group permission key is covered by exactly one category", () => {
|
||||||
|
const covered = Object.values(permissionMatrix).flatMap(({ levels, create }) => [
|
||||||
|
...levels,
|
||||||
|
...(create === null ? [] : [create]),
|
||||||
|
]);
|
||||||
|
expect(covered.toSorted()).toEqual(groupPermissionKeys.toSorted());
|
||||||
|
});
|
||||||
|
|
||||||
|
test.each(groupPermissionKeys.map((key) => [key]))("expect %s to survive a round-trip on its own", (key) => {
|
||||||
|
expect(matrixStateToPermissions(permissionsToMatrixState([key]))).toContain(key);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("permissionsToMatrixState should resolve the highest present level per category", () => {
|
describe("permissionsToMatrixState should resolve the highest present level per category", () => {
|
||||||
test("resolves the highest present level key", () => {
|
test("resolves the highest present level key", () => {
|
||||||
const state = permissionsToMatrixState(["board-view-all", "board-modify-all"]);
|
expect(permissionsToMatrixState(["board-view-all", "board-modify-all"]).board.level).toBe(2);
|
||||||
expect(state.board.level).toBe(2);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("resolves the admin category", () => {
|
test("resolves the admin category", () => {
|
||||||
@@ -63,35 +90,74 @@ describe("permissionsToMatrixState should resolve the highest present level per
|
|||||||
|
|
||||||
test("resolves an empty selection to all zero", () => {
|
test("resolves an empty selection to all zero", () => {
|
||||||
const state = permissionsToMatrixState([]);
|
const state = permissionsToMatrixState([]);
|
||||||
expect(Object.values(state).every(({ level }) => level === 0)).toBe(true);
|
expect(Object.values(state).every(({ level, create }) => level === 0 && !create)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("resolves a standalone create key without granting any level", () => {
|
||||||
|
expect(permissionsToMatrixState(["board-create"]).board).toEqual({ level: 0, create: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
test("marks create as granted when the level implies it", () => {
|
||||||
|
expect(permissionsToMatrixState(["board-full-all"]).board.create).toBe(true);
|
||||||
|
expect(permissionsToMatrixState(["app-modify-all"]).app.create).toBe(true);
|
||||||
|
expect(permissionsToMatrixState(["media-full-all"]).media.create).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("does not mark create as granted for a level that does not imply it", () => {
|
||||||
|
expect(permissionsToMatrixState(["board-modify-all"]).board.create).toBe(false);
|
||||||
|
expect(permissionsToMatrixState(["integration-interact-all"]).integration.create).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("isCreateImpliedByLevel", () => {
|
||||||
|
test.each([
|
||||||
|
["board", 0, false],
|
||||||
|
["board", 1, false],
|
||||||
|
["board", 2, false],
|
||||||
|
["board", 3, true],
|
||||||
|
["app", 1, false],
|
||||||
|
["app", 2, true],
|
||||||
|
["integration", 2, false],
|
||||||
|
["integration", 3, true],
|
||||||
|
["search-engine", 1, true],
|
||||||
|
["media", 1, false],
|
||||||
|
["media", 2, true],
|
||||||
|
["other", 1, false],
|
||||||
|
["admin", 1, false],
|
||||||
|
] satisfies [keyof typeof permissionMatrix, number, boolean][])(
|
||||||
|
"expect %s at level %i to imply create: %s",
|
||||||
|
(category, level, expected) => {
|
||||||
|
expect(isCreateImpliedByLevel(category, level)).toBe(expected);
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("matrixStateToPermissions should expand levels into permission keys", () => {
|
describe("matrixStateToPermissions should expand levels into permission keys", () => {
|
||||||
test("expands a level into the ordered level keys", () => {
|
test("expands a level into the ordered level keys", () => {
|
||||||
const permissions = matrixStateToPermissions({
|
expect(matrixStateToPermissions(emptyState({ board: { level: 2, create: false } }))).toEqual([
|
||||||
board: { level: 2 },
|
"board-view-all",
|
||||||
app: { level: 0 },
|
"board-modify-all",
|
||||||
integration: { level: 0 },
|
]);
|
||||||
"search-engine": { level: 0 },
|
|
||||||
media: { level: 0 },
|
|
||||||
other: { level: 0 },
|
|
||||||
admin: { level: 0 },
|
|
||||||
});
|
|
||||||
expect(permissions).toEqual(["board-view-all", "board-modify-all"]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("expands the admin category into the admin key", () => {
|
test("expands the admin category into the admin key", () => {
|
||||||
const permissions = matrixStateToPermissions({
|
expect(matrixStateToPermissions(emptyState({ admin: { level: 1, create: false } }))).toEqual(["admin"]);
|
||||||
board: { level: 0 },
|
});
|
||||||
app: { level: 0 },
|
|
||||||
integration: { level: 0 },
|
test("emits a standalone create key without any level", () => {
|
||||||
"search-engine": { level: 0 },
|
expect(matrixStateToPermissions(emptyState({ board: { level: 0, create: true } }))).toEqual(["board-create"]);
|
||||||
media: { level: 0 },
|
});
|
||||||
other: { level: 0 },
|
|
||||||
admin: { level: 1 },
|
test("emits media-upload as the create key of the media category", () => {
|
||||||
});
|
expect(matrixStateToPermissions(emptyState({ media: { level: 0, create: true } }))).toEqual(["media-upload"]);
|
||||||
expect(permissions).toEqual(["admin"]);
|
});
|
||||||
|
|
||||||
|
test("omits a create key that the chosen level already implies", () => {
|
||||||
|
expect(matrixStateToPermissions(emptyState({ board: { level: 3, create: true } }))).toEqual([
|
||||||
|
"board-view-all",
|
||||||
|
"board-modify-all",
|
||||||
|
"board-full-all",
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,6 +177,10 @@ describe("matrix helpers should round-trip stably", () => {
|
|||||||
"other-view-logs",
|
"other-view-logs",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[["board-create"]],
|
||||||
|
[["media-upload"]],
|
||||||
|
[["board-create", "app-create", "integration-create", "search-engine-create", "media-upload"]],
|
||||||
|
[["board-create", "board-view-all"]],
|
||||||
] satisfies [GroupPermissionKey[]][])("expect %s to round-trip", (permissions) => {
|
] satisfies [GroupPermissionKey[]][])("expect %s to round-trip", (permissions) => {
|
||||||
const roundTripped = matrixStateToPermissions(permissionsToMatrixState(permissions));
|
const roundTripped = matrixStateToPermissions(permissionsToMatrixState(permissions));
|
||||||
expect(roundTripped).toEqual(expect.arrayContaining(permissions));
|
expect(roundTripped).toEqual(expect.arrayContaining(permissions));
|
||||||
@@ -118,7 +188,10 @@ describe("matrix helpers should round-trip stably", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("expect a single higher-level key to expand to its full set on round-trip", () => {
|
test("expect a single higher-level key to expand to its full set on round-trip", () => {
|
||||||
const roundTripped = matrixStateToPermissions(permissionsToMatrixState(["board-full-all"]));
|
expect(matrixStateToPermissions(permissionsToMatrixState(["board-full-all"]))).toEqual([
|
||||||
expect(roundTripped).toEqual(["board-view-all", "board-modify-all", "board-full-all"]);
|
"board-view-all",
|
||||||
|
"board-modify-all",
|
||||||
|
"board-full-all",
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -655,20 +655,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"matrix": {
|
"matrix": {
|
||||||
"none": "None",
|
"none": "No access",
|
||||||
"impliedHint": "also grants: {permissions}",
|
"impliedHint": "Also grants: {permissions}",
|
||||||
"grantedViaAdmin": "Granted via Administrator",
|
"grantedViaAdmin": "Administrators already have this. Set Admin to “No access” to configure it separately.",
|
||||||
"preset": {
|
"preset": {
|
||||||
"label": "Presets",
|
"label": "Presets",
|
||||||
"viewer": "Viewer",
|
"viewer": "Viewer",
|
||||||
|
"viewerDescription": "Read-only: view boards and medias, use apps and integrations that already exist.",
|
||||||
"editor": "Editor",
|
"editor": "Editor",
|
||||||
|
"editorDescription": "Day-to-day management: create and edit boards, apps, integrations and search engines.",
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
|
"adminDescription": "Unrestricted access to every feature and setting, including user management.",
|
||||||
"custom": "Custom"
|
"custom": "Custom"
|
||||||
},
|
},
|
||||||
"effective": {
|
"effective": {
|
||||||
"title": "Effective permissions",
|
"title": "Effective permissions",
|
||||||
"description": "Everything members of this group will be able to do, including implied permissions",
|
"description": "The full, de-duplicated set of actions members of this group can perform, including permissions granted indirectly.",
|
||||||
"empty": "No permissions selected"
|
"empty": "No permissions selected"
|
||||||
|
},
|
||||||
|
"noneDescription": "Members get no access to this area.",
|
||||||
|
"createIncluded": "Already included in “{level}”",
|
||||||
|
"level": {
|
||||||
|
"view": "View",
|
||||||
|
"use": "Use",
|
||||||
|
"interact": "Interact",
|
||||||
|
"modify": "Modify",
|
||||||
|
"full": "Full"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -796,7 +808,9 @@
|
|||||||
"action": "Create your first app",
|
"action": "Create your first app",
|
||||||
"filteredTitle": "No apps match your search",
|
"filteredTitle": "No apps match your search",
|
||||||
"filteredDescription": "No apps match \"{search}\". Try another name or URL.",
|
"filteredDescription": "No apps match \"{search}\". Try another name or URL.",
|
||||||
"clearSearch": "Clear search"
|
"clearSearch": "Clear search",
|
||||||
|
"createOnlyTitle": "You can only add apps",
|
||||||
|
"createOnlyDescription": "Your permissions let you create apps but not browse existing ones. Ask an administrator for app management access to see the full list."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
@@ -1598,7 +1612,7 @@
|
|||||||
"title": "Integrations",
|
"title": "Integrations",
|
||||||
"ariaLabel": "Configured integrations",
|
"ariaLabel": "Configured integrations",
|
||||||
"search": "Search integrations",
|
"search": "Search integrations",
|
||||||
"scopedNote": "Showing only integrations you have full access to",
|
"scopedNote": "Showing only the integrations you are allowed to manage.",
|
||||||
"action": {
|
"action": {
|
||||||
"edit": "Edit {name}",
|
"edit": "Edit {name}",
|
||||||
"delete": "Delete {name}"
|
"delete": "Delete {name}"
|
||||||
@@ -1610,8 +1624,8 @@
|
|||||||
"filteredTitle": "No integrations match your search",
|
"filteredTitle": "No integrations match your search",
|
||||||
"filteredDescription": "No integrations match \"{search}\". Try another name, type, or URL.",
|
"filteredDescription": "No integrations match \"{search}\". Try another name, type, or URL.",
|
||||||
"clearSearch": "Clear search",
|
"clearSearch": "Clear search",
|
||||||
"noPermissionTitle": "No manageable integrations",
|
"createOnlyTitle": "You can only add integrations",
|
||||||
"noPermissionDescription": "You don't have full management access to any integrations. Ask your administrator."
|
"createOnlyDescription": "Your permissions let you create integrations but not manage existing ones. Ask an administrator for access to the ones you need."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
|
|||||||
Reference in new issue
Block a user