Skip to content

Commit

Permalink
Merge pull request #596 from bcgov/SRS-197
Browse files Browse the repository at this point in the history
added 403 route for staff reviewers to form
  • Loading branch information
nikhila-aot authored Jan 5, 2024
2 parents ce2f7d8 + e6e9d46 commit c449a36
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG MF_FORMSFLOW_ADMIN_URL
ARG MF_FORMSFLOW_THEME_URL
ARG REACT_APP_CUSTOM_LOGOUT_URL
ARG REACT_APP_CUSTOM_MAP_URL
ARG REACT_APP_SUPPORT_EMAIL
ARG ssh_prv_key
ARG ssh_pub_key

Expand All @@ -25,6 +26,7 @@ ENV MF_FORMSFLOW_THEME_URL ${MF_FORMSFLOW_THEME_URL}
ENV NODE_ENV ${NODE_ENV}
ENV REACT_APP_CUSTOM_LOGOUT_URL ${REACT_APP_CUSTOM_LOGOUT_URL}
ENV REACT_APP_CUSTOM_MAP_URL ${REACT_APP_CUSTOM_MAP_URL}
ENV REACT_APP_SUPPORT_EMAIL ${REACT_APP_SUPPORT_EMAIL}

# Add `/app/node_modules/.bin` to $PATH
ENV PATH /forms-flow-web-root-config/app/node_modules/.bin:$PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- REACT_APP_ENABLE_APPLICATIONS_MODULE=${ENABLE_APPLICATIONS_MODULE:-true}
- REACT_APP_CUSTOM_MAP_URL=${EPD_CUSTOM_MAP_URL:-http://localhost:4000/map}
- REACT_APP_CUSTOM_LOGOUT_URL=${EPD_IDP_LOGOUT_URL:-https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://epd-keycloak-dev.apps.silver.devops.gov.bc.ca/auth/realms/forms-flow-ai/protocol/openid-connect/logout?post_logout_redirect_uri=http://localhost:4000}
- REACT_APP_SUPPORT_EMAIL=${EPD_SUPPORT_EMAIL:[email protected]}
ports:
- "3000:8080"
tty: true
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ window["_env_"] = {
REACT_APP_ENABLE_APPLICATIONS_MODULE: "${REACT_APP_ENABLE_APPLICATIONS_MODULE}",
REACT_APP_CUSTOM_MAP_URL: "${REACT_APP_CUSTOM_MAP_URL}",
REACT_APP_CUSTOM_LOGOUT_URL: "${REACT_APP_CUSTOM_LOGOUT_URL}",
REACT_APP_SUPPORT_EMAIL: "${REACT_APP_SUPPORT_EMAIL}"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import "./pagenotfound.scss";
import {SUPPORT_EMAIL} from '../../constants/constants';

const NotFound = React.memo(({ errorMessage, errorCode }) => {
return (
<section>
<div className="circles">
<p>
{errorCode}
<br />
<small>{errorMessage}</small>
</p>
<span className="circle big" />
<span className="circle med" />
<span className="circle small" />
</div>
</section>
);
});

NotFound.defaultProps = {
errorMessage: "You do not have sufficient permissions to access this page. Please contact support " + SUPPORT_EMAIL + "for further clarification.",
errorCode: "403",
};

export default NotFound;
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
body {
width: 100%;
height: 100%;
font-weight: 300;
margin: 0;
padding: 0;
}

.circles:after {
content: "";
display: inline-block;
width: 100%;
height: 100px;
background: #fff;
position: absolute;
top: -50px;
left: 0;
transform: skewY(-4deg);
-webkit-transform: skewY(-4deg);
}

.circles {
background: #fff;
text-align: center;
position: relative;
margin-top: -60px;
}

.circles p {
margin-top: 120px;
font-size: 240px;
color: rgb(0, 8, 8);
padding-top: 60px;
position: relative;
font-family: "Raleway", sans-serif;

z-index: 9;
line-height: 100%;
}

.circles p small {
font-size: 40px;
line-height: 100%;
vertical-align: top;
}

.circles .circle.small {
width: 140px;
height: 140px;
border-radius: 50%;
background: #48a9e6;
position: absolute;
z-index: 1;
top: 80px;
left: 50%;
animation: 7s smallmove infinite cubic-bezier(1, 0.22, 0.71, 0.98);
-webkit-animation: 7s smallmove infinite cubic-bezier(1, 0.22, 0.71, 0.98);
animation-delay: 1.2s;
-webkit-animation-delay: 1.2s;
}

.circles .circle.med {
width: 200px;
height: 200px;
border-radius: 50%;
background: #48a9e6;
position: absolute;
z-index: 1;
top: 0;
left: 10%;
animation: 7s medmove infinite cubic-bezier(0.32, 0.04, 0.15, 0.75);
-webkit-animation: 7s medmove infinite cubic-bezier(0.32, 0.04, 0.15, 0.75);
animation-delay: 0.4s;
-webkit-animation-delay: 0.4s;
}

.circles .circle.big {
width: 400px;
height: 400px;
border-radius: 50%;
background: #48a9e6;
position: absolute;
z-index: 1;
top: 200px;
right: 0;
animation: 8s bigmove infinite;
-webkit-animation: 8s bigmove infinite;
animation-delay: 3s;
-webkit-animation-delay: 1s;
}

@-webkit-keyframes smallmove {
0% {
top: 10px;
left: 45%;
opacity: 1;
}
25% {
top: 300px;
left: 40%;
opacity: 0.7;
}
50% {
top: 240px;
left: 55%;
opacity: 0.4;
}
75% {
top: 100px;
left: 40%;
opacity: 0.6;
}
100% {
top: 10px;
left: 45%;
opacity: 1;
}
}
@keyframes smallmove {
0% {
top: 10px;
left: 45%;
opacity: 1;
}
25% {
top: 300px;
left: 40%;
opacity: 0.7;
}
50% {
top: 240px;
left: 55%;
opacity: 0.4;
}
75% {
top: 100px;
left: 40%;
opacity: 0.6;
}
100% {
top: 10px;
left: 45%;
opacity: 1;
}
}

@-webkit-keyframes medmove {
0% {
top: 0px;
left: 20%;
opacity: 1;
}
25% {
top: 300px;
left: 80%;
opacity: 0.7;
}
50% {
top: 240px;
left: 55%;
opacity: 0.4;
}
75% {
top: 100px;
left: 40%;
opacity: 0.6;
}
100% {
top: 0px;
left: 20%;
opacity: 1;
}
}

@keyframes medmove {
0% {
top: 0px;
left: 20%;
opacity: 1;
}
25% {
top: 300px;
left: 80%;
opacity: 0.7;
}
50% {
top: 240px;
left: 55%;
opacity: 0.4;
}
75% {
top: 100px;
left: 40%;
opacity: 0.6;
}
100% {
top: 0px;
left: 20%;
opacity: 1;
}
}

@-webkit-keyframes bigmove {
0% {
top: 0px;
right: 4%;
opacity: 0.5;
}
25% {
top: 100px;
right: 40%;
opacity: 0.4;
}
50% {
top: 240px;
right: 45%;
opacity: 0.8;
}
75% {
top: 100px;
right: 35%;
opacity: 0.6;
}
100% {
top: 0px;
right: 4%;
opacity: 0.5;
}
}
@keyframes bigmove {
0% {
top: 0px;
right: 4%;
opacity: 0.5;
}
25% {
top: 100px;
right: 40%;
opacity: 0.4;
}
50% {
top: 240px;
right: 45%;
opacity: 0.8;
}
75% {
top: 100px;
right: 35%;
opacity: 0.6;
}
100% {
top: 0px;
right: 4%;
opacity: 0.5;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
} from "../apiManager/endpoints/config";
import { AppConfig } from "../config";
import { getFormioRoleIds } from "../apiManager/services/userservices";
import Denied from "./Denied";

export const kcServiceInstance = (tenantId = null) => {
return KeycloakService.getInstance(
Expand Down Expand Up @@ -176,7 +177,8 @@ const PrivateRoute = React.memo((props) => {
<Route
{...rest}
render={(props) =>
userRoles.includes(STAFF_REVIEWER) && !userRoles.includes(CLIENT_REVIEWER) ? (
userRoles.includes(STAFF_REVIEWER) &&
!userRoles.includes(CLIENT_REVIEWER) ? (
<Component {...props} />
) : (
<Redirect exact to="/404" />
Expand Down Expand Up @@ -236,12 +238,23 @@ const PrivateRoute = React.memo((props) => {
component={Form}
/>
)}
{ENABLE_FORMS_MODULE && !userRoles.includes(STAFF_REVIEWER) && (

{ENABLE_FORMS_MODULE && userRoles.includes(STAFF_REVIEWER) && (
<Route
path={[`${BASE_ROUTE}form`, `${BASE_ROUTE}bundle`]}
component={Form}
>
<Redirect exact to="/403" />
</Route>
)}

{ENABLE_FORMS_MODULE && !userRoles.includes(STAFF_REVIEWER) && (
<Route
path={[`${BASE_ROUTE}form`, `${BASE_ROUTE}bundle`]}
component={Form}
/>
)}

{ENABLE_FORMS_MODULE && (
<DesignerRoute path={`${BASE_ROUTE}formflow`} component={Form} />
)}
Expand All @@ -268,8 +281,6 @@ const PrivateRoute = React.memo((props) => {
/>
)}



{ENABLE_DASHBOARDS_MODULE && (
<ReviewerDashboardRoute
path={`${BASE_ROUTE}metrics`}
Expand All @@ -290,14 +301,17 @@ const PrivateRoute = React.memo((props) => {
)}

<Route exact path={BASE_ROUTE}>
{userRoles.length && <Redirect
to={
userRoles?.includes(STAFF_REVIEWER)
? `${redirecUrl}task`
: `${redirecUrl}form`
}
/>}
{userRoles.length && (
<Redirect
to={
userRoles?.includes(STAFF_REVIEWER)
? `${redirecUrl}task`
: `${redirecUrl}form`
}
/>
)}
</Route>
<Route path="/403" exact={true} component={Denied} />
<Route path="/404" exact={true} component={NotFound} />
<Redirect from="*" to="/404" />
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,7 @@ export const ENABLE_APPLICATIONS_MODULE =
window._env_?.REACT_APP_ENABLE_APPLICATIONS_MODULE === false
? false
: true;

export const SUPPORT_EMAIL =
(window._env_ && window._env_.REACT_APP_SUPPORT_EMAIL) ||
process.env.REACT_APP_SUPPORT_EMAIL;

0 comments on commit c449a36

Please sign in to comment.