chore: un feature flag
This commit is contained in:
@@ -599,15 +599,16 @@ describe("ROLE_SCOPES", () => {
|
||||
expect(ROLE_SCOPES.sales.length).toBe(7);
|
||||
});
|
||||
|
||||
test("member contains all :read scopes, no :write", () => {
|
||||
expect(ROLE_SCOPES.member.length).toBe(RESOURCES.length);
|
||||
test("member contains expected :read scopes, no :write", () => {
|
||||
expect(ROLE_SCOPES.member.length).toBe(RESOURCES.length - 1);
|
||||
for (const s of ROLE_SCOPES.member) {
|
||||
expect(s.endsWith(":read")).toBe(true);
|
||||
expect(s.endsWith(":write")).toBe(false);
|
||||
}
|
||||
for (const r of RESOURCES) {
|
||||
for (const r of RESOURCES.filter((r) => r !== "migrations")) {
|
||||
expect(ROLE_SCOPES.member).toContain(`${r}:read` as ScopeString);
|
||||
}
|
||||
expect(ROLE_SCOPES.member).not.toContain(Scopes.Migrations.Read);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -402,7 +402,6 @@ export const ROLE_SCOPES: Record<Role, ScopeString[]> = {
|
||||
Scopes.Rewards.Read,
|
||||
Scopes.Balances.Read,
|
||||
Scopes.Billing.Read,
|
||||
Scopes.Migrations.Read,
|
||||
Scopes.Analytics.Read,
|
||||
Scopes.ApiKeys.Read,
|
||||
Scopes.Platform.Read,
|
||||
|
||||
@@ -23,17 +23,17 @@ const ROLE_META: Record<Role, { label: string; description: string }> = {
|
||||
owner: {
|
||||
label: "Owner",
|
||||
description:
|
||||
"Write on everything (organisation, customers, features, plans, rewards, balances, billing, API keys, platform) + read analytics. Can delete the org and manage ownership.",
|
||||
"Write on everything (organisation, customers, features, plans, rewards, balances, billing, migrations, API keys, platform) + read analytics. Can delete the org and manage ownership.",
|
||||
},
|
||||
admin: {
|
||||
label: "Admin",
|
||||
description:
|
||||
"Write on everything (organisation, customers, features, plans, rewards, balances, billing, API keys, platform) + read analytics. Cannot delete the org or transfer ownership.",
|
||||
"Write on everything (organisation, customers, features, plans, rewards, balances, billing, migrations, API keys, platform) + read analytics. Cannot delete the org or transfer ownership.",
|
||||
},
|
||||
developer: {
|
||||
label: "Developer",
|
||||
description:
|
||||
"Write on customers, features, plans, rewards, balances, billing, API keys, and platform. Read organisation and analytics.",
|
||||
"Write on customers, features, plans, rewards, balances, billing, migrations, API keys, and platform. Read organisation and analytics.",
|
||||
},
|
||||
sales: {
|
||||
label: "Sales",
|
||||
@@ -43,7 +43,7 @@ const ROLE_META: Record<Role, { label: string; description: string }> = {
|
||||
member: {
|
||||
label: "Member",
|
||||
description:
|
||||
"Read-only on everything: organisation, customers, features, plans, rewards, balances, billing, analytics, API keys, platform. No write access.",
|
||||
"Read-only on organisation, customers, features, plans, rewards, balances, billing, analytics, API keys, and platform. No migrations access.",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
UsersIcon,
|
||||
WebhooksLogoIcon,
|
||||
} from "@phosphor-icons/react";
|
||||
import { Scopes } from "@autumn/shared";
|
||||
import { PanelLeft } from "lucide-react";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
import { BetaBadge } from "@/components/v2/badges/BetaBadge";
|
||||
@@ -23,7 +24,6 @@ import { useLocalStorage } from "@/hooks/common/useLocalStorage";
|
||||
import { useScopes } from "@/hooks/useScopes";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useEnv } from "@/utils/envUtils";
|
||||
import { useAdmin } from "@/views/admin/hooks/useAdmin";
|
||||
import { CollapsibleNavGroup } from "./CollapsibleNavGroup";
|
||||
import { OrgDropdown } from "./components/OrgDropdown";
|
||||
import { EnvDropdown } from "./EnvDropdown";
|
||||
@@ -92,8 +92,8 @@ export const MainSidebar = ({
|
||||
|
||||
const flags = useAutumnFlags();
|
||||
const { has } = useScopes();
|
||||
const { isAdmin } = useAdmin();
|
||||
const canSeeDev = has("apiKeys:read");
|
||||
const canSeeDev = has(Scopes.ApiKeys.Read);
|
||||
const canSeeMigrations = has(Scopes.Migrations.Read);
|
||||
|
||||
const [storedExpanded, setExpanded] = useLocalStorage<boolean>(
|
||||
"sidebar.expanded",
|
||||
@@ -183,7 +183,7 @@ export const MainSidebar = ({
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{isAdmin ? (
|
||||
{canSeeMigrations ? (
|
||||
<CollapsibleNavGroup
|
||||
value="customers"
|
||||
icon={<UserCircleIcon size={16} weight="fill" />}
|
||||
|
||||
Reference in New Issue
Block a user