Skip to content

Commit 595b1dd

Browse files
authored
Merge pull request #55 from KelvinTegelaar/main
[pull] main from KelvinTegelaar:main
2 parents d1ef1c6 + de9125d commit 595b1dd

File tree

7 files changed

+143
-9
lines changed

7 files changed

+143
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cipp",
3-
"version": "10.2.0",
3+
"version": "10.2.1",
44
"author": "CIPP Contributors",
55
"homepage": "https://cipp.app/",
66
"bugs": {

public/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "10.2.0"
2+
"version": "10.2.1"
33
}

src/components/CippComponents/CippAddTenantGroupDrawer.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import React, { useState, useEffect } from "react";
1+
import { useState, useEffect } from "react";
22
import { Button, Box } from "@mui/material";
33
import { useForm, useFormState } from "react-hook-form";
44
import { GroupAdd } from "@mui/icons-material";
55
import { CippOffCanvas } from "./CippOffCanvas";
66
import { CippApiResults } from "./CippApiResults";
77
import { ApiPostCall } from "../../api/ApiCall";
88
import CippAddEditTenantGroups from "./CippAddEditTenantGroups";
9-
import { getCippValidator } from "../../utils/get-cipp-validator";
109

1110
export const CippAddTenantGroupDrawer = ({
1211
buttonText = "Add Tenant Group",

src/components/CippFormPages/CippAddEditUser.jsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ const CippAddEditUser = (props) => {
112112
return username.toLowerCase();
113113
};
114114

115+
const validateOtherMails = (value) => {
116+
if (!value || (Array.isArray(value) && value.length === 0)) {
117+
return true;
118+
}
119+
120+
const emailList = (Array.isArray(value) ? value.join(",") : value)
121+
.split(",")
122+
.map((email) => email.trim())
123+
.filter(Boolean);
124+
125+
const invalidEmail = emailList.find((email) => getCippValidator(email, "email") !== true);
126+
127+
return !invalidEmail || `This is not a valid email: ${invalidEmail}`;
128+
};
129+
115130
useEffect(() => {
116131
//if watch.firstname changes, and watch.lastname changes, set displayname to firstname + lastname
117132
if (watcher.givenName && watcher.surname && formType === "add") {
@@ -331,7 +346,6 @@ const CippAddEditUser = (props) => {
331346
setDisplayNameManuallySet(true);
332347
}}
333348
required={true}
334-
validators={{ required: "Display Name is required" }}
335349
/>
336350
</Grid>
337351
<Grid size={{ md: 6, xs: 12 }}>
@@ -356,7 +370,6 @@ const CippAddEditUser = (props) => {
356370
setUsernameManuallySet(true);
357371
}}
358372
required={true}
359-
validators={{ required: "Username is required" }}
360373
/>
361374
</Grid>
362375
<Grid size={{ md: 6, xs: 12 }}>
@@ -603,10 +616,10 @@ const CippAddEditUser = (props) => {
603616
<CippFormComponent
604617
type="textField"
605618
fullWidth
606-
label="Alternate Email Address"
619+
label="Alternate Email Addresses (comma separated)"
607620
name="otherMails"
608621
formControl={formControl}
609-
validators={{ validate: (value) => !value || getCippValidator(value, "email") }}
622+
validators={{ validate: validateOtherMails }}
610623
/>
611624
</Grid>
612625
{userSettingsDefaults?.userAttributes

src/layouts/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,11 @@ export const nativeMenuItems = [
741741
path: "/email/reports/calendar-permissions",
742742
permissions: ["Exchange.Mailbox.*"],
743743
},
744+
{
745+
title: "Mailbox Forwarding",
746+
path: "/email/reports/mailbox-forwarding",
747+
permissions: ["Exchange.Mailbox.*"],
748+
},
744749
{
745750
title: "Anti-Phishing Filters",
746751
path: "/email/reports/antiphishing-filters",
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { Layout as DashboardLayout } from "../../../../layouts/index.js";
2+
import { CippTablePage } from "../../../../components/CippComponents/CippTablePage.jsx";
3+
import { useState } from "react";
4+
import { Button, Alert, SvgIcon, IconButton, Tooltip } from "@mui/material";
5+
import { useSettings } from "../../../../hooks/use-settings";
6+
import { Stack } from "@mui/system";
7+
import { Sync, Info } from "@mui/icons-material";
8+
import { useDialog } from "../../../../hooks/use-dialog";
9+
import { CippApiDialog } from "../../../../components/CippComponents/CippApiDialog";
10+
import { CippQueueTracker } from "../../../../components/CippTable/CippQueueTracker";
11+
12+
const Page = () => {
13+
const currentTenant = useSettings().currentTenant;
14+
const syncDialog = useDialog();
15+
const [syncQueueId, setSyncQueueId] = useState(null);
16+
17+
const isAllTenants = currentTenant === "AllTenants";
18+
19+
const columns = [
20+
...(isAllTenants ? ["Tenant"] : []),
21+
"UPN",
22+
"DisplayName",
23+
"RecipientTypeDetails",
24+
"ForwardingType",
25+
"ForwardTo",
26+
"DeliverToMailboxAndForward",
27+
"CacheTimestamp",
28+
];
29+
30+
const apiData = {
31+
UseReportDB: true,
32+
};
33+
34+
const filters = [
35+
{
36+
filterName: "External Forwarding",
37+
value: [{ id: "ForwardingType", value: "External" }],
38+
type: "column",
39+
},
40+
{
41+
filterName: "Internal Forwarding",
42+
value: [{ id: "ForwardingType", value: "Internal" }],
43+
type: "column",
44+
},
45+
];
46+
47+
const pageActions = [
48+
<Stack direction="row" spacing={2} alignItems="center" key="actions-stack">
49+
<CippQueueTracker
50+
queueId={syncQueueId}
51+
queryKey={`mailbox-forwarding-${currentTenant}`}
52+
title="Mailbox Forwarding Sync"
53+
/>
54+
<Tooltip title="This report displays cached mailbox data from the CIPP reporting database. Cache timestamps are shown in the table. Click the Sync button to update the mailbox cache for the current tenant.">
55+
<IconButton size="small">
56+
<Info fontSize="small" />
57+
</IconButton>
58+
</Tooltip>
59+
<Button
60+
startIcon={
61+
<SvgIcon fontSize="small">
62+
<Sync />
63+
</SvgIcon>
64+
}
65+
size="xs"
66+
onClick={syncDialog.handleOpen}
67+
disabled={isAllTenants}
68+
>
69+
Sync
70+
</Button>
71+
</Stack>,
72+
];
73+
74+
return (
75+
<>
76+
{currentTenant && currentTenant !== "" ? (
77+
<CippTablePage
78+
title="Mailbox Forwarding Report"
79+
apiUrl="/api/ListMailboxForwarding"
80+
queryKey={`mailbox-forwarding-${currentTenant}`}
81+
apiData={apiData}
82+
simpleColumns={columns}
83+
filters={filters}
84+
cardButton={pageActions}
85+
offCanvas={null}
86+
/>
87+
) : (
88+
<Alert severity="warning">Please select a tenant to view mailbox forwarding settings.</Alert>
89+
)}
90+
<CippApiDialog
91+
createDialog={syncDialog}
92+
title="Sync Mailbox Cache"
93+
fields={[]}
94+
api={{
95+
type: "GET",
96+
url: "/api/ExecCIPPDBCache",
97+
confirmText: `Run mailbox cache sync for ${currentTenant}? This will update mailbox data including forwarding settings.`,
98+
relatedQueryKeys: [`mailbox-forwarding-${currentTenant}`],
99+
data: {
100+
Name: "Mailboxes",
101+
Types: "",
102+
},
103+
onSuccess: (result) => {
104+
if (result?.Metadata?.QueueId) {
105+
setSyncQueueId(result.Metadata.QueueId);
106+
}
107+
},
108+
}}
109+
/>
110+
</>
111+
);
112+
};
113+
114+
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;
115+
116+
export default Page;

src/pages/identity/administration/users/add.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { Box } from "@mui/material";
22
import CippFormPage from "../../../../components/CippFormPages/CippFormPage";
33
import { Layout as DashboardLayout } from "../../../../layouts/index.js";
44
import { useForm, useWatch } from "react-hook-form";
5-
import { CippFormUserSelector } from "../../../../components/CippComponents/CippFormUserSelector";
65
import { useSettings } from "../../../../hooks/use-settings";
76
import { useEffect } from "react";
87

98
import CippAddEditUser from "../../../../components/CippFormPages/CippAddEditUser";
109
const Page = () => {
1110
const userSettingsDefaults = useSettings();
11+
const tenantDomain = useSettings().currentTenant;
1212

1313
const formControl = useForm({
1414
mode: "onBlur",
@@ -54,6 +54,7 @@ const Page = () => {
5454
title="User"
5555
backButtonTitle="User Overview"
5656
postUrl="/api/AddUser"
57+
relatedQueryKeys={`Users - ${tenantDomain}`}
5758
>
5859
<Box sx={{ my: 2 }}>
5960
<CippAddEditUser formControl={formControl} userSettingsDefaults={userSettingsDefaults} />

0 commit comments

Comments
 (0)