From a65ebac1a78b42e2c0b4c73ac009b058e10e5254 Mon Sep 17 00:00:00 2001 From: Marilynn Stone Date: Wed, 13 Nov 2024 14:40:06 -0800 Subject: [PATCH] Revert "Track 210 - Update restrictions for Status and Issues editing permissions" (#2434) Reverts bcgov/EPIC.track#2432 --- epictrack-api/docker-compose.yml | 4 +-- epictrack-api/{src/api => }/logging.conf | 0 epictrack-web/package-lock.json | 28 ------------------- .../issues/IssueAccordion/Details.tsx | 24 ++++------------ .../IssueAccordion/IssueHistory/index.tsx | 18 ------------ .../issues/IssueAccordion/Summary.tsx | 16 ++--------- .../status/StatusView/RecentStatus.tsx | 14 +--------- .../status/StatusView/StatusHistory/index.tsx | 18 ++---------- .../src/constants/application-constant.ts | 6 +--- .../src/services/userService/index.ts | 2 +- 10 files changed, 14 insertions(+), 116 deletions(-) rename epictrack-api/{src/api => }/logging.conf (100%) diff --git a/epictrack-api/docker-compose.yml b/epictrack-api/docker-compose.yml index 6aa102ec8..9ed0aba82 100644 --- a/epictrack-api/docker-compose.yml +++ b/epictrack-api/docker-compose.yml @@ -25,7 +25,7 @@ services: links: - eao-reports-api-db ports: - - '3200:8080' + - '3002:8080' environment: - JWT_OIDC_ISSUER:${JWT_OIDC_ISSUER} - JWT_OIDC_WELL_KNOWN_CONFIG:${JWT_OIDC_WELL_KNOWN_CONFIG} @@ -48,7 +48,7 @@ services: networks: - eao-network - + networks: eao-network: diff --git a/epictrack-api/src/api/logging.conf b/epictrack-api/logging.conf similarity index 100% rename from epictrack-api/src/api/logging.conf rename to epictrack-api/logging.conf diff --git a/epictrack-web/package-lock.json b/epictrack-web/package-lock.json index dd0efc7de..6ca9673f6 100644 --- a/epictrack-web/package-lock.json +++ b/epictrack-web/package-lock.json @@ -4184,34 +4184,6 @@ "url": "https://github.com/sponsors/tannerlinsley" } }, - "node_modules/@testing-library/dom": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", - "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/runtime": "^7.12.5", - "@types/aria-query": "^5.0.1", - "aria-query": "5.3.0", - "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.5.0", - "pretty-format": "^27.0.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@testing-library/dom/node_modules/aria-query": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", - "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", - "peer": true, - "dependencies": { - "dequal": "^2.0.3" - } - }, "node_modules/@testing-library/jest-dom": { "version": "5.17.0", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", diff --git a/epictrack-web/src/components/workPlan/issues/IssueAccordion/Details.tsx b/epictrack-web/src/components/workPlan/issues/IssueAccordion/Details.tsx index aed10bc60..3f0dccc59 100644 --- a/epictrack-web/src/components/workPlan/issues/IssueAccordion/Details.tsx +++ b/epictrack-web/src/components/workPlan/issues/IssueAccordion/Details.tsx @@ -1,7 +1,6 @@ import React from "react"; import { Button, Grid } from "@mui/material"; import { WorkIssue } from "../../../../models/Issue"; -import { WorkStaffRole, WorkStaffRoleNames } from "../../../../models/role"; import { ETCaption1, ETHeading4, ETParagraph, GrayBox } from "../../../shared"; import moment from "moment"; import { ETChip } from "../../../shared/chip/ETChip"; @@ -15,11 +14,10 @@ import IssueHistory from "./IssueHistory"; import { MONTH_DAY_YEAR, ROLES, - SPECIAL_FIELDS, } from "../../../../constants/application-constant"; import { Restricted } from "../../../shared/restricted"; import { useAppSelector } from "hooks"; -import { WorkplanContext } from "../../WorkPlanContext"; +import { WorkplanContext } from "components/workPlan/WorkPlanContext"; const IssueDetails = ({ issue }: { issue: WorkIssue }) => { const latestUpdate = issue.updates[0]; @@ -27,20 +25,7 @@ const IssueDetails = ({ issue }: { issue: WorkIssue }) => { const PencilEditIcon: React.FC = icons["PencilEditIcon"]; const AddIcon: React.FC = icons["AddIcon"]; - // These are used in conjunction with /restricted/index.tsx for permission control. const { team } = React.useContext(WorkplanContext); - const activeTeam = team?.filter((member) => member.is_active); - const { email } = useAppSelector((state) => state.user.userDetail); - const isTeamMember = team?.some((member) => member.staff.email === email); - const rolesArray = [ - ROLES.RESPONSIBLE_EPD, - ROLES.TEAM_LEAD, - ROLES.TEAM_CO_LEAD, - ]; - const userHasRole = activeTeam?.some( - (member) => - member.staff.email === email && rolesArray.includes(member.role.name) - ); const { setEditIssueUpdateFormIsOpen, @@ -52,6 +37,9 @@ const IssueDetails = ({ issue }: { issue: WorkIssue }) => { setNewIssueUpdateFormIsOpen, } = React.useContext(IssuesContext); + const { email } = useAppSelector((state) => state.user.userDetail); + const isTeamMember = team?.some((member) => member.staff.email === email); + const handleApproveIssue = () => { approveIssue(issue.id, latestUpdate.id); setIssueToApproveId(null); @@ -166,10 +154,8 @@ const IssueDetails = ({ issue }: { issue: WorkIssue }) => { allowed={[ latestUpdate.is_approved ? ROLES.EXTENDED_EDIT : ROLES.EDIT, ]} + exception={!latestUpdate.is_approved && isTeamMember} errorProps={{ disabled: true }} - exception={ - (!latestUpdate.is_approved && isTeamMember) || userHasRole - } >