Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2031 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev to release
  • Loading branch information
KelvinTegelaar authored Jan 19, 2024
2 parents f6bf6be + a804f5f commit ebe99ca
Show file tree
Hide file tree
Showing 22 changed files with 667 additions and 101 deletions.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.9.1
5.0.0
5 changes: 5 additions & 0 deletions src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ const _nav = [
name: 'Deploy CA Policies',
to: '/tenant/conditional/deploy',
},
{
component: CNavItem,
name: 'CA Vacation Mode',
to: '/tenant/conditional/deploy-vacation',
},
{
component: CNavItem,
name: 'CA Templates',
Expand Down
8 changes: 8 additions & 0 deletions src/components/forms/RFFComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,17 @@ export const RFFCFormInput = ({
disabled = false,
spellCheck = true,
autoFocus = false,
onChange,
}) => {
return (
<Field name={name} validate={validate}>
{({ input, meta }) => {
const handleChange = onChange
? (e) => {
input.onChange(e)
onChange(e)
}
: input.onChange
return (
<div className={className}>
{label && <CFormLabel htmlFor={name}>{label}</CFormLabel>}
Expand All @@ -155,6 +162,7 @@ export const RFFCFormInput = ({
placeholder={placeholder}
spellCheck={spellCheck}
autoFocus={autoFocus}
onChange={handleChange}
/>
<RFFCFormFeedback meta={meta} />
</div>
Expand Down
11 changes: 1 addition & 10 deletions src/components/layout/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@ import {
} from '@coreui/react'
import { AppHeaderSearch } from 'src/components/header'
import { TenantSelector } from '../utilities'
import cyberdrainlogolight from 'src/assets/images/CIPP.png'
import cyberdrainlogodark from 'src/assets/images/CIPP_Dark.png'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
faBars,
faCaretSquareLeft,
faCaretSquareRight,
faHamburger,
faStroopwafel,
} from '@fortawesome/free-solid-svg-icons'
import { faBars } from '@fortawesome/free-solid-svg-icons'
import { setCurrentTheme, setUserSettings, toggleSidebarShow } from 'src/store/features/app'
import { useMediaPredicate } from 'react-media-hook'
import { useGenericGetRequestQuery, useLoadAlertsDashQuery } from 'src/store/api/app'
Expand Down
13 changes: 7 additions & 6 deletions src/components/layout/AppSidebar.jsx

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions src/components/tables/CellMathFormatter.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react'
import { CBadge, CTooltip } from '@coreui/react'
import CellBoolean from 'src/components/tables/CellBoolean.jsx'
import cellTable from './CellTable'

export function CellTip(cell, overflow = false) {
return (
<CTooltip content={String(cell)}>
<div className="celltip-content-nowrap">{String(cell)}</div>
</CTooltip>
)
}
export const cellMathFormatter =
({ col } = {}) =>
(row) => {
const evaluateCalculation = (calculation, row) => {
try {
const formattedCalculation = calculation.replace(/\b\w+(\.\w+|\[\d+\])*\b/g, (key) => {
if (!isNaN(key)) {
return parseFloat(key)
}

const path = key.split(/\.|\[(\d+)\]/).filter(Boolean) // Splits keys and array indices
let currentObject = row
for (const prop of path) {
if (currentObject && prop in currentObject) {
currentObject = currentObject[prop]
} else if (!isNaN(prop)) {
// Checks if the prop is an array index
currentObject = currentObject[parseInt(prop, 10)]
} else {
throw new Error(`Property '${prop}' not found in row`)
}
}

return parseFloat(currentObject)
})

return Number(eval(formattedCalculation))
} catch (e) {
console.error(e)
return null
}
}

const result = evaluateCalculation(col.value, row)

if (result === null) {
return 'N/A'
}

if (col.showAs === 'percentage') {
return `${result.toFixed(2)}%`
} else {
return result.toFixed(2)
}
}

export default cellMathFormatter
36 changes: 29 additions & 7 deletions src/components/utilities/CippActionsOffcanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@ export default function CippActionsOffcanvas(props) {
}
const handleModal = useCallback(
(modalMessage, modalUrl, modalType = 'GET', modalBody, modalInput, modalDropdown) => {
const handlePostConfirm = () => {
const selectedValue = inputRef.current.value
console.log(inputRef)
let additionalFields = {}

if (inputRef.current.nodeName === 'SELECT') {
const selectedItem = dropDownInfo.data.find(
(item) => item[modalDropdown.valueField] === selectedValue,
)
if (selectedItem && modalDropdown.addedField) {
Object.keys(modalDropdown.addedField).forEach((key) => {
additionalFields[key] = selectedItem[modalDropdown.addedField[key]]
})
}
}
const postRequestBody = {
...modalBody,
...additionalFields,
input: selectedValue,
}
// Send the POST request
genericPostRequest({
path: modalUrl,
values: postRequestBody,
})
}

// Modal setup for GET, codeblock, and other types
if (modalType === 'GET') {
ModalService.confirm({
body: (
Expand Down Expand Up @@ -82,12 +110,7 @@ export default function CippActionsOffcanvas(props) {
</div>
),
title: 'Confirm',
onConfirm: () => [
genericPostRequest({
path: modalUrl,
values: { ...modalBody, ...{ input: inputRef.current.value } },
}),
],
onConfirm: handlePostConfirm,
})
}
},
Expand All @@ -99,7 +122,6 @@ export default function CippActionsOffcanvas(props) {
modalContent,
],
)

useEffect(() => {
if (dropDownInfo.isFetching) {
handleModal(
Expand Down
4 changes: 4 additions & 0 deletions src/data/BPAField.schema.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
{
"const": "number",
"title": "Displays as a numerical value"
},
{
"const": "math",
"title": "Displays as a calculated value"
}
]
}
Expand Down
95 changes: 78 additions & 17 deletions src/data/standards.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,30 @@
{
"name": "standards.AuditLog",
"cat": "Global Standards",
"helpText": "Enables the Unified Audit Log for tracking and auditing activities; also runs Enable-OrganizationCustomization if necessary.",
"helpText": "Enables the Unified Audit Log for tracking and auditing activities. Also runs Enable-OrganizationCustomization if necessary.",
"addedComponent": [],
"label": "Enable the Unified Audit Log",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.PhishProtection",
"cat": "Global Standards",
"helpText": "Adds branding to the logon page that only appears if the url is not login.microsoftonline.com. This potentially prevents AITM attacks via EvilNginx. This will also automatically generate alerts if a clone of your login page has been found. (P1 or higher required)",
"addedComponent": [],
"label": "Enable Phishing Protection system via branding CSS",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.EnableCustomerLockbox",
"cat": "Global Standards",
"helpText": "Enables Customer Lockbox that offers an approval process for Microsoft support to access organization data",
"addedComponent": [],
"label": "Enable Customer Lockbox",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.AnonReportDisable",
"cat": "Global Standards",
Expand All @@ -55,7 +73,7 @@
{
"name": "standards.DisableGuestDirectory",
"cat": "Global Standards",
"helpText": "Disables Guest access to enumerate directory objects. This prevents guest users from see other users or guests in the directory.",
"helpText": "Disables Guest access to enumerate directory objects. This prevents guest users from seeing other users or guests in the directory.",
"addedComponent": [],
"label": "Restrict guest user access to directory objects",
"impact": "Low Impact",
Expand All @@ -64,7 +82,7 @@
{
"name": "standards.DisableBasicAuthSMTP",
"cat": "Global Standards",
"helpText": "Disables SMTP AUTH for the organization. This is the default for new tenants. Sets the entire tenant to no longer allow SMTP AUTH, and as such has no exclusions.",
"helpText": "Disables SMTP AUTH for the organization and all users. This is the default for new tenants. ",
"addedComponent": [],
"label": "Disable SMTP Basic Authentication",
"impact": "Medium Impact",
Expand All @@ -84,7 +102,7 @@
"cat": "Entra (AAD) Standards",
"helpText": "Enables the tenant to use LAPS. You must still create a policy for LAPS to be active on all devices. Use the template standards to deploy this by default.",
"addedComponent": [],
"label": "Enable LAPs on the tenant",
"label": "Enable LAPS on the tenant",
"impact": "Low Impact",
"impactColour": "info"
},
Expand All @@ -102,7 +120,7 @@
"name": "standards.allowOTPTokens",
"helpText": "Allows you to use MS authenticator OTP token generator",
"addedComponent": [],
"label": "Enable OTP via Authenticator.",
"label": "Enable OTP via Authenticator",
"impact": "Low Impact",
"impactColour": "info"
},
Expand Down Expand Up @@ -221,7 +239,7 @@
"name": "standards.NudgeMFA.enable",
"helpText": "Enables registration campaign for the tenant",
"addedComponent": [],
"label": "Request to setup Authenticator if not setup yet.",
"label": "Request to setup Authenticator if not setup yet",
"impact": "Low Impact",
"impactColour": "info"
},
Expand All @@ -230,7 +248,7 @@
"name": "standards.NudgeMFA.disable",
"helpText": "Disables registration campaign for the tenant",
"addedComponent": [],
"label": "Disables the request to setup Authenticator if setup.",
"label": "Disables the request to setup Authenticator if setup",
"impact": "Low Impact",
"impactColour": "info"
},
Expand Down Expand Up @@ -290,16 +308,16 @@
"label": "Allowed application IDs, comma separated"
}
],
"label": "Require admin consent for applications (Prevent OAuth phishing.)",
"impact": "Medium impact",
"label": "Require admin consent for applications (Prevent OAuth phishing)",
"impact": "Medium Impact",
"impactColour": "warning"
},
{
"cat": "Entra (AAD) Standards",
"name": "standards.OauthConsentLowSec",
"helpText": "Sets the default oauth consent level so users can consent to applications that have low risks.",
"label": "Allow users to consent to applications with low security risk (Prevent OAuth phishing. Lower impact, less secure.)",
"impact": "Medium impact",
"label": "Allow users to consent to applications with low security risk (Prevent OAuth phishing. Lower impact, less secure)",
"impact": "Medium Impact",
"impactColour": "warning"
},
{
Expand Down Expand Up @@ -364,7 +382,7 @@
{
"name": "standards.OutBoundSpamAlert",
"cat": "Exchange Standards",
"helpText": "Set the Outbound Spam Alert e-mail address.",
"helpText": "Set the Outbound Spam Alert e-mail address",
"addedComponent": [
{
"type": "input",
Expand Down Expand Up @@ -406,7 +424,23 @@
]
}
],
"label": "Enable or disable 'external' warning in Outlook.",
"label": "Enable or disable 'external' warning in Outlook",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.EnableMailTips",
"cat": "Exchange Standards",
"helpText": "Enables all MailTips in Outlook. MailTips are the notifications Outlook and Outlook on the web shows when an email you create, meets some requirements",
"addedComponent": [
{
"type": "number",
"name": "standards.EnableMailTips.MailTipsLargeAudienceThreshold",
"label": "Number of recipients to trigger the large audience MailTip (Default is 25)",
"placeholder": "Enter a profile name"
}
],
"label": "Enable all MailTips",
"impact": "Low Impact",
"impactColour": "info"
},
Expand Down Expand Up @@ -437,20 +471,29 @@
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.EnableMailboxAuditing",
"cat": "Exchange Standards",
"helpText": "Enables Mailbox auditing for all mailboxes and on tenant level. By default Microsoft does not enable mailbox auditing for Resource Mailboxes, Public Folder Mailboxes and DiscoverySearch Mailboxes. Unified Audit Log needs to be enabled for this standard to function.",
"addedComponent": [],
"label": "Enable Mailbox auditing",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.SendReceiveLimitTenant",
"cat": "Exchange Standards",
"helpText": "Sets the Send and Receive limits for new users. Valid values are 1KB to 150MB. Invalid values will be set to EXO standard of 35MB,36MB",
"helpText": "Sets the Send and Receive limits for new users. Valid values are 1MB to 150MB",
"addedComponent": [
{
"type": "number",
"name": "standards.SendReceiveLimitTenant.SendLimit",
"label": "Send limit in MB"
"label": "Send limit in MB (Default is 35)"
},
{
"type": "number",
"name": "standards.SendReceiveLimitTenant.ReceiveLimit",
"label": "Receive Limit in MB"
"label": "Receive Limit in MB (Default is 36)"
}
],
"label": "Set send/receive size limits",
Expand Down Expand Up @@ -507,6 +550,24 @@
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.DisableExternalCalendarSharing",
"cat": "Exchange Standards",
"helpText": "Disables the ability for users to share their calendar with external users. Only for the default policy, so exclusions can be made if needed.",
"addedComponent": [],
"label": "Disable external calendar sharing",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.DisableAdditionalStorageProviders",
"cat": "Exchange Standards",
"helpText": "Disables the ability for users to open files in Outlook on the Web, from other providers such as Box, Dropbox, Facebook, Google Drive, OneDrive Personal, etc.",
"addedComponent": [],
"label": "Disable additional storage providers in OWA",
"impact": "Low Impact",
"impactColour": "info"
},
{
"name": "standards.SafeSendersDisable",
"cat": "Exchange Standards",
Expand Down Expand Up @@ -616,7 +677,7 @@
{
"name": "standards.DisableAddShortcutsToOneDrive",
"cat": "SharePoint Standards",
"helpText": "When the feature is disabled the option Add shortcut to My files will be removed; any folders that have already been added will remain on the user's computer.",
"helpText": "When the feature is disabled the option Add shortcut to OneDrive will be removed. Any folders that have already been added will remain on the user's computer.",
"disabledFeatures": {
"report": true,
"warn": true,
Expand Down
Loading

0 comments on commit ebe99ca

Please sign in to comment.