Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kris6673 authored Jun 5, 2024
2 parents 6ea3f5e + 70dddff commit 5d8dee5
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "5.7.0",
"version": "5.7.1",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7.0
5.7.1
2 changes: 1 addition & 1 deletion src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const _nav = [
{
component: CNavItem,
name: 'JIT Admin',
to: '/identity/administration/users/jit-admin',
to: '/identity/administration/jit-admin',
},
{
component: CNavItem,
Expand Down
2 changes: 1 addition & 1 deletion src/importsMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react'
"/identity/administration/users/edit": React.lazy(() => import('./views/identity/administration/EditUser')),
"/identity/administration/users/view": React.lazy(() => import('./views/identity/administration/ViewUser')),
"/identity/administration/users/InviteGuest": React.lazy(() => import('./views/identity/administration/InviteGuest')),
"/identity/administration/users/jit-admin": React.lazy(() => import('./views/identity/administration/DeployJITAdmin')),
"/identity/administration/jit-admin": React.lazy(() => import('./views/identity/administration/DeployJITAdmin')),
"/identity/administration/ViewBec": React.lazy(() => import('./views/identity/administration/ViewBEC')),
"/identity/administration/users": React.lazy(() => import('./views/identity/administration/Users')),
"/identity/administration/devices": React.lazy(() => import('./views/identity/administration/Devices')),
Expand Down
2 changes: 1 addition & 1 deletion src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/identity/administration/users/jit-admin",
"path": "/identity/administration/jit-admin",
"name": "JIT Admin",
"component": "views/identity/administration/DeployJITAdmin",
"allowedRoles": ["admin", "editor", "readonly"]
Expand Down
108 changes: 87 additions & 21 deletions src/views/identity/administration/DeployJITAdmin.jsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
import React, { useState } from 'react'
import { CButton, CCallout, CCol, CForm, CRow, CSpinner, CTooltip } from '@coreui/react'
import { useSelector } from 'react-redux'
import { Field, Form, FormSpy } from 'react-final-form'
import { Field, Form } from 'react-final-form'
import {
Condition,
RFFCFormInput,
RFFCFormRadio,
RFFCFormRadioList,
RFFCFormSwitch,
RFFSelectSearch,
} from 'src/components/forms'
import {
useGenericGetRequestQuery,
useLazyGenericGetRequestQuery,
useLazyGenericPostRequestQuery,
} from 'src/store/api/app'
import { useLazyGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 'src/store/api/app'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCircleNotch, faEdit, faEye } from '@fortawesome/free-solid-svg-icons'
import { CippContentCard, CippPage, CippPageList } from 'src/components/layout'
import { CellTip } from 'src/components/tables/CellGenericFormat'
import { CellTip, cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
import 'react-datepicker/dist/react-datepicker.css'
import { CippActionsOffcanvas, ModalService, TenantSelector } from 'src/components/utilities'
import { TenantSelector } from 'src/components/utilities'
import arrayMutators from 'final-form-arrays'
import DatePicker from 'react-datepicker'
import 'react-datepicker/dist/react-datepicker.css'
import { useListUsersQuery } from 'src/store/api/users'
import { useListConditionalAccessPoliciesQuery } from 'src/store/api/tenants'
import GDAPRoles from 'src/data/GDAPRoles'
import { CippDatatable, cellDateFormatter } from 'src/components/tables'

const DeployJITAdmin = () => {
const [ExecuteGetRequest, getResults] = useLazyGenericGetRequestQuery()
Expand All @@ -42,12 +37,21 @@ const DeployJITAdmin = () => {
const startTime = Math.floor(startDate.getTime() / 1000)
const endTime = Math.floor(endDate.getTime() / 1000)
const shippedValues = {
tenantFilter: tenantDomain,
TenantFilter: tenantDomain,
UserId: values.UserId?.value,
PolicyId: values.PolicyId?.value,
UserPrincipalName: values.UserPrincipalName,
FirstName: values.FirstName,
LastName: values.LastName,
useraction: values.useraction,
AdminRoles: values.AdminRoles?.map((role) => role.value),
StartDate: startTime,
EndDate: endTime,
ExpireAction: values?.expireAction ?? 'delete',
ExpireAction: values.expireAction.value,
PostExecution: {
Webhook: values.webhook,
Email: values.email,
PSA: values.psa,
},
}
genericPostRequest({ path: '/api/ExecJITAdmin', values: shippedValues }).then((res) => {
setRefreshState(res.requestId)
Expand All @@ -63,8 +67,8 @@ const DeployJITAdmin = () => {
return (
<CippPage title={`Add JIT Admin`} tenantSelector={false}>
<>
<CRow>
<CCol md={4}>
<CRow className="mb-3">
<CCol lg={4} md={12}>
<CippContentCard title="Add JIT Admin" icon={faEdit}>
<Form
onSubmit={onSubmit}
Expand All @@ -81,7 +85,9 @@ const DeployJITAdmin = () => {
<CRow className="mb-3">
<CCol>
<label className="mb-2">Tenant</label>
<Field name="tenantFilter">{(props) => <TenantSelector />}</Field>
<Field name="tenantFilter">
{(props) => <TenantSelector showAllTenantSelector={false} />}
</Field>
</CCol>
</CRow>
<CRow>
Expand All @@ -102,7 +108,17 @@ const DeployJITAdmin = () => {
</CCol>
</CRow>
<Condition when="useraction" is="create">
<CRow className="mb-3">
<CRow>
<CCol>
<RFFCFormInput label="First Name" name="FirstName" />
</CCol>
</CRow>
<CRow>
<CCol>
<RFFCFormInput label="Last Name" name="LastName" />
</CCol>
</CRow>
<CRow>
<CCol>
<RFFCFormInput label="User Principal Name" name="UserPrincipalName" />
</CCol>
Expand All @@ -124,6 +140,7 @@ const DeployJITAdmin = () => {
</CCol>
</CRow>
</Condition>
<hr />
<CRow className="mb-3">
<CCol>
<RFFSelectSearch
Expand Down Expand Up @@ -169,15 +186,23 @@ const DeployJITAdmin = () => {
<RFFSelectSearch
label="Expiration Action"
values={[
{ value: 'removeroles', name: 'Remove Admin Roles' },
{ value: 'disable', name: 'Disable' },
{ value: 'delete', name: 'Delete' },
{ value: 'RemoveRoles', name: 'Remove Admin Roles' },
{ value: 'DisableUser', name: 'Disable User' },
{ value: 'DeleteUser', name: 'Delete User' },
]}
placeholder="Select action for when JIT expires"
name="expireAction"
/>
</CCol>
</CRow>
<CRow className="mb-3">
<CCol>
<label>Send results to</label>
<RFFCFormSwitch name="webhook" label="Webhook" />
<RFFCFormSwitch name="email" label="E-mail" />
<RFFCFormSwitch name="psa" label="PSA" />
</CCol>
</CRow>
<CRow className="mb-3">
<CCol md={6}>
<CButton type="submit" disabled={submitting}>
Expand All @@ -195,7 +220,9 @@ const DeployJITAdmin = () => {
</CRow>
{postResults.isSuccess && (
<CCallout color="success">
<li>{postResults.data.Results}</li>
{postResults.data?.Results.map((result, idx) => (
<li key={idx}>{result}</li>
))}
</CCallout>
)}
{getResults.isFetching && (
Expand All @@ -217,6 +244,45 @@ const DeployJITAdmin = () => {
/>
</CippContentCard>
</CCol>
<CCol lg={8} md={12}>
<CippContentCard title="JIT Admins" icon="user-shield">
<CippDatatable
title="JIT Admins"
path="/api/ExecJITAdmin?Action=List"
params={{ TenantFilter: tenantDomain, refreshState }}
columns={[
{
name: 'User',
selector: (row) => row['userPrincipalName'],
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'userPrincipalName',
},
{
name: 'JIT Enabled',
selector: (row) => row['jitAdminEnabled'],
sortable: true,
cell: cellGenericFormatter(),
exportSelector: 'jitAdminEnabled',
},
{
name: 'JIT Expires',
selector: (row) => row['jitAdminExpiration'],
sortable: true,
cell: cellDateFormatter({ format: 'short' }),
exportSelector: 'jitAdminExpiration',
},
{
name: 'Admin Roles',
selector: (row) => row['memberOf'],
sortable: false,
cell: cellGenericFormatter(),
exportSelector: 'memberOf',
},
]}
/>
</CippContentCard>
</CCol>
</CRow>
</>
</CippPage>
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7.0
5.7.1

0 comments on commit 5d8dee5

Please sign in to comment.