mirror of
https://github.com/sasjs/server.git
synced 2026-01-15 01:40:05 +00:00
chore: show principal type in permissions list
This commit is contained in:
@@ -38,6 +38,11 @@ const BootstrapTableCell = styled(TableCell)({
|
|||||||
textAlign: 'left'
|
textAlign: 'left'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
enum PrincipalType {
|
||||||
|
User = 'User',
|
||||||
|
Group = 'Group'
|
||||||
|
}
|
||||||
|
|
||||||
const Permission = () => {
|
const Permission = () => {
|
||||||
const appContext = useContext(AppContext)
|
const appContext = useContext(AppContext)
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
@@ -304,6 +309,7 @@ const PermissionTable = ({
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<BootstrapTableCell>Uri</BootstrapTableCell>
|
<BootstrapTableCell>Uri</BootstrapTableCell>
|
||||||
<BootstrapTableCell>Principal</BootstrapTableCell>
|
<BootstrapTableCell>Principal</BootstrapTableCell>
|
||||||
|
<BootstrapTableCell>Type</BootstrapTableCell>
|
||||||
<BootstrapTableCell>Setting</BootstrapTableCell>
|
<BootstrapTableCell>Setting</BootstrapTableCell>
|
||||||
{appContext.isAdmin && (
|
{appContext.isAdmin && (
|
||||||
<BootstrapTableCell>Action</BootstrapTableCell>
|
<BootstrapTableCell>Action</BootstrapTableCell>
|
||||||
@@ -317,6 +323,9 @@ const PermissionTable = ({
|
|||||||
<BootstrapTableCell>
|
<BootstrapTableCell>
|
||||||
{displayPrincipal(permission)}
|
{displayPrincipal(permission)}
|
||||||
</BootstrapTableCell>
|
</BootstrapTableCell>
|
||||||
|
<BootstrapTableCell>
|
||||||
|
{displayPrincipalType(permission)}
|
||||||
|
</BootstrapTableCell>
|
||||||
<BootstrapTableCell>{permission.setting}</BootstrapTableCell>
|
<BootstrapTableCell>{permission.setting}</BootstrapTableCell>
|
||||||
{appContext.isAdmin && (
|
{appContext.isAdmin && (
|
||||||
<BootstrapTableCell>
|
<BootstrapTableCell>
|
||||||
@@ -346,9 +355,11 @@ const PermissionTable = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const displayPrincipal = (permission: PermissionResponse) => {
|
const displayPrincipal = (permission: PermissionResponse) => {
|
||||||
if (permission.user) {
|
if (permission.user) return permission.user?.displayName
|
||||||
return permission.user?.displayName
|
if (permission.group) return permission.group?.name
|
||||||
} else if (permission.group) {
|
}
|
||||||
return permission.group?.name
|
|
||||||
}
|
const displayPrincipalType = (permission: PermissionResponse) => {
|
||||||
|
if (permission.user) return PrincipalType.User
|
||||||
|
if (permission.group) return PrincipalType.Group
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user