Skip to content

Commit

Permalink
JIT Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Jun 3, 2024
1 parent ffdc744 commit 5ede288
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 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
70 changes: 62 additions & 8 deletions src/views/identity/administration/DeployJITAdmin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import { useLazyGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 's
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 { 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 GDAPRoles from 'src/data/GDAPRoles'
import { CippDatatable, cellDateFormatter } from 'src/components/tables'

const DeployJITAdmin = () => {
const [ExecuteGetRequest, getResults] = useLazyGenericGetRequestQuery()
Expand All @@ -30,12 +31,13 @@ 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,
useraction: values.useraction,
AdminRoles: values.AdminRoles?.map((role) => role.value),
StartDate: startTime,
EndDate: endTime,
ExpireAction: values?.expireAction ?? 'delete',
ExpireAction: values.expireAction.value,
}
genericPostRequest({ path: '/api/ExecJITAdmin', values: shippedValues }).then((res) => {
setRefreshState(res.requestId)
Expand All @@ -51,8 +53,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 @@ -69,7 +71,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 @@ -90,7 +94,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 @@ -112,6 +126,7 @@ const DeployJITAdmin = () => {
</CCol>
</CRow>
</Condition>
<hr />
<CRow className="mb-3">
<CCol>
<RFFSelectSearch
Expand Down Expand Up @@ -205,6 +220,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 }}
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 5ede288

Please sign in to comment.