users with less rights than others can no longer edit their rights
This commit is contained in:
@@ -33,6 +33,7 @@ import { ChartBarBigIcon, Check, Eye, PlaneIcon, Timer, X } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
import { Error } from "_components/Error";
|
||||
import { useSession } from "next-auth/react";
|
||||
|
||||
interface ProfileFormProps {
|
||||
user: User;
|
||||
@@ -40,6 +41,7 @@ interface ProfileFormProps {
|
||||
|
||||
export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormProps) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const session = useSession();
|
||||
const form = useForm<UserOptionalDefaults>({
|
||||
defaultValues: user,
|
||||
resolver: zodResolver(UserOptionalDefaultsSchema),
|
||||
@@ -131,6 +133,7 @@ export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormPro
|
||||
form={form}
|
||||
name="permissions"
|
||||
label="Permissions"
|
||||
isDisabled={user.permissions.length > (session.data?.user?.permissions?.length ?? 0)}
|
||||
options={Object.entries(PERMISSION).map(([key, value]) => ({
|
||||
label: value,
|
||||
value: key,
|
||||
|
||||
Reference in New Issue
Block a user