Revert "CEC-2977 Filter portal access based on auth provider (#231)"
This reverts commit f2f046968e.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import {
|
||||
Grid,
|
||||
Table,
|
||||
@@ -8,30 +10,28 @@ import {
|
||||
TableRow,
|
||||
Tooltip,
|
||||
} from "@material-ui/core";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import SendIcon from "@material-ui/icons/Send";
|
||||
import VisibilityIcon from "@material-ui/icons/Visibility";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import clsx from "clsx";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import EditIcon from "@material-ui/icons/Edit";
|
||||
import { logger } from "../../../services/monitoring";
|
||||
import { LocalDateTimeString } from "../../../utils/dates";
|
||||
import { TYPE_MANIFEST_SOFTWARE } from "../../../utils/manifest_types";
|
||||
import { hasRole, Permissions } from "../../../utils/roles";
|
||||
import {
|
||||
ManifestsProvider,
|
||||
useManifestsContext,
|
||||
ManifestsProvider,
|
||||
} from "../../Contexts/ManifestsContext";
|
||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||
import { useUserContext } from "../../Contexts/UserContext";
|
||||
import ECUList from "../../Controls/ECUList";
|
||||
import SearchField from "../../Controls/SearchField";
|
||||
import DeleteConfirmation from "../../DeleteConfirmation";
|
||||
import TableHeaderSortable from "../../Table/HeaderSortable";
|
||||
import { useLocalStorage } from "../../useLocalStorage";
|
||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||
import useStyles from "../../useStyles";
|
||||
import { LocalDateTimeString } from "../../../utils/dates";
|
||||
import TableHeaderSortable from "../../Table/HeaderSortable";
|
||||
import SearchField from "../../Controls/SearchField";
|
||||
import { logger } from "../../../services/monitoring";
|
||||
import ECUList from "../../Controls/ECUList";
|
||||
import { Roles, hasRole } from "../../../utils/roles";
|
||||
import { useLocalStorage } from "../../useLocalStorage";
|
||||
import { TYPE_MANIFEST_SOFTWARE } from "../../../utils/manifest_types";
|
||||
import DeleteConfirmation from "../../DeleteConfirmation";
|
||||
import EditIcon from "@material-ui/icons/Edit";
|
||||
|
||||
const tableColumns = [
|
||||
{
|
||||
@@ -71,7 +71,7 @@ const formatManifestType = (type) => {
|
||||
default:
|
||||
return "Standard";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const PAGE_SIZE = "MANIFEST_LIST_PAGE_SIZE";
|
||||
|
||||
@@ -95,7 +95,6 @@ const MainForm = () => {
|
||||
idToken: { jwtToken: token },
|
||||
},
|
||||
groups,
|
||||
providers,
|
||||
} = useUserContext();
|
||||
|
||||
const sortHandler = (event, property) => {
|
||||
@@ -156,7 +155,7 @@ const MainForm = () => {
|
||||
setDeleteId(id);
|
||||
setDeleteRowName(`${row.name} ${row.version}`);
|
||||
setShowDeleteModal(true);
|
||||
};
|
||||
}
|
||||
|
||||
const onDelete = async (manifest_id) => {
|
||||
try {
|
||||
@@ -169,30 +168,29 @@ const MainForm = () => {
|
||||
|
||||
const Actions = (row) => {
|
||||
let actions = [];
|
||||
if (hasRole(groups, Permissions.FiskerMagnaRead, providers)) {
|
||||
if (hasRole([Roles.CREATE, Roles.READ], groups)) {
|
||||
actions.push({
|
||||
tip: `Status "${row.name} ${row.version}"`,
|
||||
link: `/package-status/${row.id}`,
|
||||
icon: (
|
||||
<VisibilityIcon aria-label={`Status ${row.name} ${row.version}`} />
|
||||
),
|
||||
});
|
||||
}
|
||||
if (hasRole(groups, Permissions.FiskerRead, providers)) {
|
||||
actions.push({
|
||||
}, {
|
||||
tip: `Update "${row.name} ${row.version}"`,
|
||||
link: `/package-update/${row.id}`,
|
||||
icon: <EditIcon aria-label={`Update ${row.name} ${row.version}`} />,
|
||||
icon: (
|
||||
<EditIcon aria-label={`Update ${row.name} ${row.version}`} />
|
||||
),
|
||||
});
|
||||
}
|
||||
if (hasRole(groups, Permissions.FiskerMagnaCreate, providers)) {
|
||||
if (hasRole([Roles.CREATE], groups)) {
|
||||
actions.push({
|
||||
tip: `Deploy "${row.name} ${row.version}"`,
|
||||
link: `/package-deploy/${row.id}`,
|
||||
icon: <SendIcon aria-label={`Deploy ${row.name} ${row.version}`} />,
|
||||
});
|
||||
}
|
||||
if (hasRole(groups, Permissions.FiskerDelete, providers)) {
|
||||
if (hasRole([Roles.DELETE], groups)) {
|
||||
actions.push({
|
||||
tip: `Delete "${row.name} ${row.version}"`,
|
||||
id: row.id,
|
||||
@@ -259,9 +257,7 @@ const MainForm = () => {
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="center">{row.version}</TableCell>
|
||||
<TableCell align="center">
|
||||
{formatManifestType(row.type)}
|
||||
</TableCell>
|
||||
<TableCell align="center">{formatManifestType(row.type)}</TableCell>
|
||||
<TableCell align="center">
|
||||
{LocalDateTimeString(row.created)}
|
||||
</TableCell>
|
||||
@@ -294,8 +290,7 @@ const MainForm = () => {
|
||||
message={deleteRowName}
|
||||
open={showDeleteModal}
|
||||
close={() => setShowDeleteModal(false)}
|
||||
deleteFunction={() => onDelete(deleteId)}
|
||||
/>
|
||||
deleteFunction={() => onDelete(deleteId)} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user