Skip to content

Commit

Permalink
Merge pull request #123 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Feb 27, 2025
2 parents d0c9231 + 1af58f9 commit 9319c9b
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 14 deletions.
22 changes: 12 additions & 10 deletions src/components/CippComponents/CippApiDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,21 @@ export const CippApiDialog = (props) => {
};

// Handling link navigation
if (api.link) {
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
return getNestedValue(row, key) || `[${key}]`;
});
useEffect(() => {
if (api.link && createDialog.open) {
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
return getNestedValue(row, key) || `[${key}]`;
});

if (linkWithRowData.startsWith("/")) {
router.push(linkWithRowData, undefined, { shallow: true });
} else {
window.open(linkWithRowData, api.target || "_blank");
if (linkWithRowData.startsWith("/")) {
router.push(linkWithRowData, undefined, { shallow: true });
} else {
window.open(linkWithRowData, api.target || "_blank");
}
createDialog.handleClose();
}
}, [api.link, createDialog.open]);

return null;
}
useEffect(() => {
if (api.noConfirm) {
formHook.handleSubmit(onSubmit)(); // Submits the form on mount
Expand Down
30 changes: 29 additions & 1 deletion src/data/standards.json
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,33 @@
"powershellEquivalent": "Graph API",
"recommendedBy": []
},
{
"name": "standards.UserPreferredLanguage",
"cat": "Entra (AAD) Standards",
"tag": [],
"helpText": "Sets the preferred language property for all users in the tenant. This will override the user's language settings.",
"docsDescription": "Sets the preferred language property for all users in the tenant. This will override the user's language settings.",
"addedComponent": [
{
"type": "autoComplete",
"multiple": false,
"creatable": false,
"name": "standards.UserPreferredLanguage.preferredLanguage",
"label": "Preferred Language",
"api": {
"url": "/languageList.json",
"labelField": "language",
"valueField": "tag"
}
}
],
"label": "Preferred language for all users",
"impact": "High Impact",
"impactColour": "info",
"addedDate": "2025-02-26",
"powershellEquivalent": "Update-MgUser -UserId user@domain.com -BodyParameter @{preferredLanguage='en-US'}",
"recommendedBy": []
},
{
"name": "standards.OutBoundSpamAlert",
"cat": "Exchange Standards",
Expand Down Expand Up @@ -3206,7 +3233,8 @@
{
"type": "textField",
"name": "standards.AutopilotStatusPage.ErrorMessage",
"label": "Custom Error Message"
"label": "Custom Error Message",
"required": false
},
{
"type": "switch",
Expand Down
20 changes: 20 additions & 0 deletions src/pages/cipp/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ import { useSettings } from "../../hooks/use-settings";
import countryList from "../../data/countryList.json";
import { CippSettingsSideBar } from "../../components/CippComponents/CippSettingsSideBar";
import CippDevOptions from "/src/components/CippComponents/CippDevOptions";
import { ApiGetCall } from "../../api/ApiCall";
import { getCippFormatting } from "../../utils/get-cipp-formatting";

const Page = () => {
const settings = useSettings();
const formcontrol = useForm({ mode: "onChange", defaultValues: settings });

const auth = ApiGetCall({
url: "/.auth/me",
queryKey: "authmecipp",
staleTime: 120000,
refetchOnWindowFocus: true,
});

const addedAttributes = [
{ value: "consentProvidedForMinor", label: "consentProvidedForMinor" },
{ value: "employeeId", label: "employeeId" },
Expand Down Expand Up @@ -281,6 +290,17 @@ const Page = () => {
</Grid>
<Grid size={{ xs: 12, lg: 4 }}>
<Stack spacing={3}>
<CippPropertyListCard
title={`CIPP Roles for ${auth?.data?.clientPrincipal?.userDetails}`}
propertyItems={(auth?.data?.clientPrincipal?.userRoles ?? [])
.filter((role) => !['anonymous', 'authenticated'].includes(role))
.map((role) => ({
label: "",
value: getCippFormatting(role,"role"),
}))}
showDivider={false}
/>

<CippSettingsSideBar formcontrol={formcontrol} />
<CippDevOptions />
</Stack>
Expand Down
8 changes: 6 additions & 2 deletions src/pages/cipp/settings/tenants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Page = () => {
data: { value: "customerId" },
confirmText: "Are you sure you want to exclude these tenants?",
multiPost: false,
condition: (row) => row.displayName !== '*Partner Tenant',
},
{
label: "Include Tenants",
Expand All @@ -30,13 +31,14 @@ const Page = () => {
data: { value: "customerId" },
confirmText: "Are you sure you want to include these tenants?",
multiPost: false,
condition: (row) => row.displayName !== '*Partner Tenant',
},
{
label: "Refresh CPV Permissions",
type: "POST",
url: `/api/ExecCPVPermissions`,
icon: <PlayArrow />,
data: { TenantFilter: "customerId" },
data: { tenantFilter: "customerId" },
confirmText: "Are you sure you want to refresh the CPV permissions for these tenants?",
multiPost: false,
},
Expand All @@ -45,10 +47,11 @@ const Page = () => {
type: "POST",
url: `/api/ExecCPVPermissions?&ResetSP=true`,
icon: <RestartAlt />,
data: { TenantFilter: "customerId" },
data: { tenantFilter: "customerId" },
confirmText:
"Are you sure you want to reset the CPV permissions for these tenants? (This will delete the Service Principal and re-add it.)",
multiPost: false,
condition: (row) => row.displayName !== '*Partner Tenant',
},
{
label: "Remove Tenant",
Expand All @@ -58,6 +61,7 @@ const Page = () => {
data: { TenantID: "customerId" },
confirmText: "Are you sure you want to remove this tenant?",
multiPost: false,
condition: (row) => row.displayName !== '*Partner Tenant',
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
}
}

if (cellName === "ClientId") {
if (cellName === "ClientId" || cellName === "role") {
return isText ? data : <CippCopyToClipBoard text={data} type="chip" />;
}

Expand Down

0 comments on commit 9319c9b

Please sign in to comment.