Skip to content

Commit 016e303

Browse files
committed
Fix: Fix automapping not defaulting to true correctly
1 parent 8872296 commit 016e303

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/CippComponents/CippMailboxPermissionsDialog.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import { Box, Stack } from "@mui/material";
22
import CippFormComponent from "./CippFormComponent";
33
import { useWatch } from "react-hook-form";
4+
import { useEffect } from "react";
45

56
const CippMailboxPermissionsDialog = ({ formHook, combinedOptions, isUserGroupLoading }) => {
67
const fullAccess = useWatch({
78
control: formHook.control,
89
name: "permissions.AddFullAccess",
910
});
1011

12+
// Ensure AutoMap is set to true when FullAccess is selected
13+
useEffect(() => {
14+
if (fullAccess) {
15+
// Always set to true when FullAccess user is selected for the first time
16+
// This ensures the form value matches the UI default state
17+
formHook.setValue("permissions.AutoMap", true);
18+
}
19+
}, [fullAccess, formHook]);
20+
1121
return (
1222
<Stack spacing={2} sx={{ mt: 1 }}>
1323
<Box>

src/pages/identity/administration/users/user/exchange.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ const Page = () => {
181181
customDataformatter: (row, action, data) => {
182182
const permissions = [];
183183
const { permissions: permissionValues } = data;
184-
const autoMap = permissionValues.AutoMap === undefined ? true : permissionValues.AutoMap;
184+
// Always default to true for FullAccess permissions unless explicitly disabled
185+
const autoMap = permissionValues?.AddFullAccess ? permissionValues.AutoMap !== false : true;
185186

186187
// Build permissions array based on form values
187188
if (permissionValues?.AddFullAccess) {

0 commit comments

Comments
 (0)