|
1 | 1 | import React from 'react'
|
| 2 | +import { CButton } from '@coreui/react' |
| 3 | +import { faBan } from '@fortawesome/free-solid-svg-icons' |
2 | 4 | import { useSelector } from 'react-redux'
|
3 | 5 | import { CellTip, cellBooleanFormatter } from 'src/components/tables'
|
4 | 6 | 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 | +} |
5 | 45 |
|
6 | 46 | const columns = [
|
7 | 47 | {
|
@@ -43,6 +83,11 @@ const columns = [
|
43 | 83 | cell: (row) => CellTip(row['accountEnabled']),
|
44 | 84 | exportSelector: 'accountEnabled',
|
45 | 85 | },
|
| 86 | + { |
| 87 | + name: 'Block sign-in', |
| 88 | + cell: (row) => DisableSharedMailbox(row['id']), |
| 89 | + minWidth: '100px', |
| 90 | + }, |
46 | 91 | ]
|
47 | 92 |
|
48 | 93 | const SharedMailboxEnabledAccount = () => {
|
|
0 commit comments