Skip to content

Commit

Permalink
Merge pull request #1318 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev to release
  • Loading branch information
KelvinTegelaar authored Jan 20, 2023
2 parents c7cab52 + 547e7ef commit 43538c2
Show file tree
Hide file tree
Showing 26 changed files with 339 additions and 157 deletions.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.19.1
2.20.0
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Page401 = React.lazy(() => import('./views/pages/page401/Page401'))
const Page403 = React.lazy(() => import('./views/pages/page403/Page403'))
const Page404 = React.lazy(() => import('./views/pages/page404/Page404'))
const Page500 = React.lazy(() => import('./views/pages/page500/Page500'))
const PageLogOut = React.lazy(() => import('src/views/pages/LogoutRedirect/PageLogOut'))
const Login = React.lazy(() => import('./views/pages/login/Login'))
const Logout = React.lazy(() => import('./views/pages/login/Logout'))

Expand All @@ -26,6 +27,7 @@ const App = () => {
<title>CIPP</title>
</Helmet>
<Routes>
<Route exact path="/LogoutRedirect" name="LogoutRedirect" element={<PageLogOut />} />
<Route exact path="/401" name="Page 401" element={<Page401 />} />
<Route exact path="/403" name="Page 403" element={<Page403 />} />
<Route exact path="/404" name="Page 404" element={<Page404 />} />
Expand Down
5 changes: 4 additions & 1 deletion src/components/tables/CellGenericFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export const cellGenericFormatter =
return CellBoolean({ cell, warning, reverse, colourless, noDataIsFalse })
}
if (typeof cell === 'string') {
console.log(cell)
return CellTip(cell)
}
if (Array.isArray(cell) || typeof cell === 'object') {
console.log(cell)
return CellTip(JSON.stringify(cell))
}
}
2 changes: 2 additions & 0 deletions src/components/tables/CippTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PropTypes from 'prop-types'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCheck, faColumns, faSearch, faSync } from '@fortawesome/free-solid-svg-icons'
import { useEffect } from 'react'
import { cellGenericFormatter } from './CellGenericFormat'

const FilterComponent = ({ filterText, onFilter, onClear, filterlist, onFilterPreset }) => (
<>
Expand Down Expand Up @@ -211,6 +212,7 @@ export default function CippTable({
selector: (row) => row[columnname],
sortable: true,
exportSelector: columnname,
cell: cellGenericFormatter(),
})
} else {
let indexOfExisting = columns.findIndex((o) => o.exportSelector === columnname)
Expand Down
9 changes: 8 additions & 1 deletion src/data/standards.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,19 @@
"label": "Enable Auto-expanding archives"
},
{
"name": "standards.SpoofWarn",
"name": "standards.SpoofWarn.Enable",
"cat": "Exchange",
"helpText": "This is the default helptext",
"addedComponent": null,
"label": "Enable Spoofing warnings for Outlook (This e-mail is external identifiers)"
},
{
"name": "standards.SpoofWarn.Disable",
"cat": "Exchange",
"helpText": "This is the default helptext",
"addedComponent": null,
"label": "Disable Spoofing warnings for Outlook (This e-mail is external identifiers)"
},
{
"name": "standards.DisableViva",
"cat": "Exchange",
Expand Down
3 changes: 3 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const EditGroup = React.lazy(() => import('src/views/identity/administration/Edi
const ViewGroup = React.lazy(() => import('src/views/identity/administration/ViewGroup'))
const Roles = React.lazy(() => import('src/views/identity/administration/Roles'))
const Devices = React.lazy(() => import('src/views/endpoint/intune/Devices'))
const PageLogOut = React.lazy(() => import('src/views/pages/LogoutRedirect/PageLogOut'))

const Page404 = React.lazy(() => import('src/views/pages/page404/Page404'))
const Page403 = React.lazy(() => import('src/views/pages/page403/Page403'))
const Page500 = React.lazy(() => import('src/views/pages/page500/Page500'))
Expand Down Expand Up @@ -218,6 +220,7 @@ const routes = [
// { path: '/', exact: true, name: 'Home' },
{ path: '/home', name: 'Home', component: Home },
{ path: '/cipp/logs', name: 'Logs', component: Logs },

{ path: '/cipp/404', name: 'Error', component: Page404 },
{ path: '/cipp/403', name: 'Error', component: Page403 },
{ path: '/cipp/500', name: 'Error', component: Page500 },
Expand Down
2 changes: 2 additions & 0 deletions src/store/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const appApi = baseApi.injectEndpoints({
addStandardsDeploy,
addChocoApp,
onePerTenant,
logsToInclude,
}) => ({
path: '/api/ExecNotificationConfig',
data: {
Expand All @@ -58,6 +59,7 @@ export const appApi = baseApi.injectEndpoints({
addStandardsDeploy: addStandardsDeploy,
addChocoApp: addChocoApp,
onePerTenant: onePerTenant,
logsToInclude: logsToInclude,
},
method: 'post',
}),
Expand Down
9 changes: 9 additions & 0 deletions src/store/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export const usersApi = baseApi.injectEndpoints({
},
}),
}),
listContacts: builder.query({
query: ({ tenantDomain }) => ({
path: '/api/ListContacts',
params: {
TenantFilter: tenantDomain,
},
}),
}),
listUser: builder.query({
query: ({ tenantDomain, userId }) => ({
path: '/api/ListUsers',
Expand Down Expand Up @@ -109,6 +117,7 @@ export const {
useEditUserMutation,
useListUsersQuery,
useListUserQuery,
useListContactsQuery,
useListUserConditionalAccessPoliciesQuery,
useListUserSigninLogsQuery,
useAddUserMutation,
Expand Down
183 changes: 90 additions & 93 deletions src/views/cipp/CIPPSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ import { useLazyEditDnsConfigQuery, useLazyGetDnsConfigQuery } from 'src/store/a
import { useDispatch, useSelector } from 'react-redux'
import { cellBooleanFormatter, CellTip, CellTipIcon, CippTable } from 'src/components/tables'
import { CippPage, CippPageList } from 'src/components/layout'
import { RFFCFormSwitch, RFFCFormInput, RFFCFormSelect } from 'src/components/forms'
import {
RFFCFormSwitch,
RFFCFormInput,
RFFCFormSelect,
RFFSelectSearch,
} from 'src/components/forms'
import { Form } from 'react-final-form'
import useConfirmModal from 'src/hooks/useConfirmModal'
import { setCurrentTenant } from 'src/store/features/app'
Expand Down Expand Up @@ -375,45 +380,56 @@ const GeneralSettings = () => {
<CCardTitle>Tenant Access Check</CCardTitle>
</CCardHeader>
<CCardBody>
<div className="mb-3">
Click the button below to start a tenant access check. You can select multiple a
maximum of {maxSelected + 1} tenants is recommended.
</div>
<CRow className="mb-3">
<CCol>
<div className="mb-3">
Click the button below to start a tenant access check. You can select multiple a
maximum of {maxSelected + 1} tenants is recommended.
</div>

<TenantSelectorMultiple
ref={tenantSelectorRef}
values={selectedTenants}
onChange={(value) =>
handleSetSelectedTenants(
value.map((val) => {
return val.value
}),
)
}
/>
{showMaxSelected && (
<CCallout color="warning">
A maximum of {maxSelected + 1} tenants is recommended.
</CCallout>
)}
<br />
<CButton
onClick={() => handleCheckAccess()}
disabled={accessCheckResult.isFetching || selectedTenants.length < 1}
>
{accessCheckResult.isFetching && (
<FontAwesomeIcon icon={faCircleNotch} spin className="me-2" size="1x" />
)}
Run access check
</CButton>
{accessCheckResult.isSuccess && (
<CippTable
reportName="none"
columns={checkAccessColumns}
tableProps={tableProps}
data={accessCheckResult.data.Results}
/>
)}
<TenantSelectorMultiple
ref={tenantSelectorRef}
values={selectedTenants}
onChange={(value) =>
handleSetSelectedTenants(
value.map((val) => {
return val.value
}),
)
}
/>
{showMaxSelected && (
<CCallout color="warning">
A maximum of {maxSelected + 1} tenants is recommended.
</CCallout>
)}
</CCol>
</CRow>
<CRow className="mb-3">
<CCol>
<CButton
onClick={() => handleCheckAccess()}
disabled={accessCheckResult.isFetching || selectedTenants.length < 1}
>
{accessCheckResult.isFetching && (
<FontAwesomeIcon icon={faCircleNotch} spin className="me-2" size="1x" />
)}
Run access check
</CButton>
</CCol>
</CRow>
<CRow>
<CCol>
{accessCheckResult.isSuccess && (
<CippTable
reportName="none"
columns={checkAccessColumns}
tableProps={tableProps}
data={accessCheckResult.data.Results}
/>
)}
</CCol>
</CRow>
</CCardBody>
</CCard>
</CCol>
Expand Down Expand Up @@ -823,18 +839,13 @@ const SecuritySettings = () => {
}

const NotificationsSettings = () => {
//to post settings
const [configNotifications, notificationConfigResult] = useLazyExecNotificationConfigQuery()

const [listNotification, notificationListResult] = useLazyListNotificationConfigQuery()
const onSubmit = (values) => {
// @todo bind this
// window.alert(JSON.stringify(values))
// console.log(values)
console.log(values)
configNotifications(values)
}
//to get current settings
const [listNotification, notificationListResult] = useLazyListNotificationConfigQuery()
//todo: Replace with prettier sliders etc
return (
<>
{notificationListResult.isUninitialized && listNotification()}
Expand All @@ -851,7 +862,10 @@ const NotificationsSettings = () => {
</CCardHeader>
<CCardBody>
<Form
initialValues={{ ...notificationListResult.data }}
initialValues={{
logsToInclude: notificationListResult.data.logsToInclude,
...notificationListResult.data,
}}
onSubmit={onSubmit}
render={({ handleSubmit, submitting, values }) => {
return (
Expand All @@ -876,52 +890,35 @@ const NotificationsSettings = () => {
<CCol>
<RFFCFormInput type="text" name="webhook" label="Webhook" />
</CCol>
<CFormLabel>
Choose which types of updates you want to receive. This notification will be
sent every 15 minutes.
</CFormLabel>
<br />
<RFFCFormSwitch
name="addUser"
label="New Accounts created via CIPP"
value={false}
/>
<RFFCFormSwitch
name="removeUser"
label="Removed Accounts via CIPP"
value={false}
/>
<RFFCFormSwitch
name="addChocoApp"
label="New Applications added via CIPP"
value={false}
/>
<RFFCFormSwitch
name="addPolicy"
label="New Policies added via CIPP"
value={false}
/>
<RFFCFormSwitch
name="addStandardsDeploy"
label="New Standards added via CIPP"
value={false}
/>
<RFFCFormSwitch
name="removeStandard"
label="Removed Standards via CIPP"
value={false}
/>
<RFFCFormSwitch
name="tokenUpdater"
label="Token Refresh Events"
value={false}
/>
<RFFCFormSwitch
name="onePerTenant"
label="Receive one email per tenant"
value={false}
/>
<br></br>
<CCol>
<RFFSelectSearch
multi={true}
label="Choose which logs you'd like to receive alerts from. This notification will be sent every 15 minutes."
name="logsToInclude"
values={[
{ value: 'standards', name: 'All Standards' },
{ value: 'TokensUpdater', name: 'Token Events' },
{ value: 'ExecDnsConfig', name: 'Changing DNS Settings' },
{ value: 'ExecExcludeLicenses', name: 'Adding excluded licenses' },
{ value: 'ExecExcludeTenant', name: 'Adding excluded tenants' },
{ value: 'EditUser', name: 'Editing a user' },
{ value: 'ChocoApp', name: 'Adding or deploying applications' },
{ value: 'AddAPDevice', name: 'Adding autopilot devices' },
{ value: 'EditTenant', name: 'Editing a tenant' },
{ value: 'AddMSPApp', name: 'Adding an MSP app' },
{ value: 'AddUser', name: 'Adding a user' },
{ value: 'AddGroup', name: 'Adding a group' },
{ value: 'ExecOffboardUser', name: 'Executing the offboard wizard' },
]}
/>
</CCol>
<CCol>
<RFFCFormSwitch
name="onePerTenant"
label="Receive one email per tenant"
value={false}
/>
</CCol>
<CButton disabled={notificationConfigResult.isFetching} type="submit">
Set Notification Settings
</CButton>
Expand Down
Loading

0 comments on commit 43538c2

Please sign in to comment.