Skip to content

Commit cb8498e

Browse files
Merge pull request #1939 from kris6673/add-block-sign-in-button
Add block sign-in button to Shared Mailbox with Enabled Account report
2 parents b22cae2 + da7e256 commit cb8498e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/views/email-exchange/reports/SharedMailboxEnabledAccount.jsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
11
import React from 'react'
2+
import { CButton } from '@coreui/react'
3+
import { faBan } from '@fortawesome/free-solid-svg-icons'
24
import { useSelector } from 'react-redux'
35
import { CellTip, cellBooleanFormatter } from 'src/components/tables'
46
import { CippPageList } from 'src/components/layout'
7+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
8+
import { ModalService } from 'src/components/utilities'
9+
import { useLazyGenericGetRequestQuery } from 'src/store/api/app'
10+
11+
const DisableSharedMailbox = (userId) => {
12+
const tenant = useSelector((state) => state.app.currentTenant)
13+
const [genericGetRequest, getResults] = useLazyGenericGetRequestQuery()
14+
const handleModal = (modalMessage, modalUrl) => {
15+
ModalService.confirm({
16+
body: (
17+
<div style={{ overflow: 'visible' }}>
18+
<div>{modalMessage}</div>
19+
</div>
20+
),
21+
title: 'Confirm',
22+
onConfirm: () => genericGetRequest({ path: modalUrl }),
23+
})
24+
}
25+
26+
return (
27+
<>
28+
<CButton
29+
color="danger"
30+
variant="ghost"
31+
onClick={() => {
32+
ModalService.confirm(
33+
handleModal(
34+
'Are you sure you want to block this user from signing in?',
35+
`/api/ExecDisableUser?TenantFilter=${tenant?.defaultDomainName}&ID=${userId}`,
36+
),
37+
)
38+
}}
39+
>
40+
<FontAwesomeIcon icon={faBan} />
41+
</CButton>
42+
</>
43+
)
44+
}
545

646
const columns = [
747
{
@@ -43,6 +83,11 @@ const columns = [
4383
cell: (row) => CellTip(row['accountEnabled']),
4484
exportSelector: 'accountEnabled',
4585
},
86+
{
87+
name: 'Block sign-in',
88+
cell: (row) => DisableSharedMailbox(row['id']),
89+
minWidth: '100px',
90+
},
4691
]
4792

4893
const SharedMailboxEnabledAccount = () => {

0 commit comments

Comments
 (0)