From 49d22498fc3eb5608b06ade6150518248c71c15e Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Mon, 4 May 2026 20:47:00 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20only=20select=20one=20role?= =?UTF-8?q?=20in=20CE=20and=20if=20user=20is=20non=20paying?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/roles-selector.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/roles-selector.tsx b/src/components/roles-selector.tsx index f69ff4a98..bf682bb31 100644 --- a/src/components/roles-selector.tsx +++ b/src/components/roles-selector.tsx @@ -5,6 +5,8 @@ import { useDebounce } from "use-debounce"; import { useTranslations } from "next-intl"; import { MultiSelectTagInput } from "./multi-select/multi-select-tag-input"; +import { usePaidStatus } from "@app/hooks/usePaidStatus"; +import { TierFeature, tierMatrix } from "@server/lib/billing/tierMatrix"; export type SelectedRole = { id: string; text: string }; @@ -27,6 +29,8 @@ export function RolesSelector({ mapRolesByName, buttonText }: RolesSelectorProps) { + const { isPaidUser } = usePaidStatus(); + const canSelectMultipleUsers = isPaidUser(tierMatrix.fullRbac); const t = useTranslations(); const [roleSearchQuery, setRoleSearchQuery] = useState(""); @@ -74,7 +78,13 @@ export function RolesSelector({ onSearch={setRoleSearchQuery} options={rolesShown} value={selectedRoles} - onChange={onSelectRoles} + onChange={(newRoles) => { + let roles = canSelectMultipleUsers + ? [...newRoles] + : [newRoles[0]]; + + onSelectRoles(roles); + }} disabled={disabled} /> );