Skip to content

Commit

Permalink
Merge pull request #245 from AOT-Technologies/feature/FWF-3316-permis…
Browse files Browse the repository at this point in the history
…sion-matrix

[🥬] Feature/fwf 3316 permission matrix to develop
  • Loading branch information
shuhaib-aot authored Jul 30, 2024
2 parents 40978c6 + cca634f commit 9d5e9bc
Show file tree
Hide file tree
Showing 23 changed files with 875 additions and 400 deletions.
1 change: 1 addition & 0 deletions .github/workflows/forms-flow-admin-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- release/*
- feature/FWF-3316-permission-matrix
paths:
- "forms-flow-admin/**"
- "VERSION"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/forms-flow-integration-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- release/*
- feature/FWF-3316-permission-matrix
paths:
- "forms-flow-integration/**"
- "VERSION"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/forms-flow-nav.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- release/*
- feature/FWF-3316-permission-matrix
paths:
- "forms-flow-nav/**"
- "VERSION"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/forms-flow-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- release/*
- feature/FWF-3316-permission-matrix
paths:
- "forms-flow-service/**"
- "VERSION"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/forms-flow-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- develop
- release/*
- feature/FWF-3316-permission-matrix
paths:
- "forms-flow-theme/**"
- "VERSION"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.1.0-alpha
v6.1.0-rbac-alpha
46 changes: 46 additions & 0 deletions forms-flow-admin/src/components/AccessDenied/AccessDenied.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions forms-flow-admin/src/components/AccessDenied/accessDenied.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.access-denied-text {
font-family: Arial, Helvetica, sans-serif;
font-size: 2rem;
color: var(--ff-black);
opacity: 1;
}
.access-denied{
font-family: Arial, Helvetica, sans-serif;
font-size: 1rem;
color: var(--ff-black);
opacity: 1;
}
45 changes: 45 additions & 0 deletions forms-flow-admin/src/components/AccessDenied/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from "react";
import AccessDeniedIcon from "./AccessDenied.js";
import './accessDenied.scss';
import { useTranslation } from "react-i18next";
import { BASE_ROUTE } from "../../constants/index";
import { useHistory } from "react-router-dom";


const AccessDenied = ({ userRoles }) => {
const { t } = useTranslation();
const history = useHistory();

const handleLogout = () => {
const kcInstance = kcServiceInstance();
kcInstance.userLogout();
};

const handleReturn = () => {
history.push(BASE_ROUTE);
};

const showReturnToLogin = userRoles?.length === 0;
const showReturnToHome = userRoles?.length > 0;

return (
<div className="d-flex flex-column align-items-center text-center" data-testid="access-denied-component">
<AccessDeniedIcon alt="Access Denied" className="mb-4 mt-2" />
<h1 className="access-denied-text" data-testid="access-denied-title">{t("Access Denied")}</h1>
<span className="access-denied" data-testid="access-denied-message">{t("You don't have permission to access this page.")}</span>
<span className="access-denied" data-testid="access-denied-submessage">{t("Please contact your administrator or try again later.")}</span>
{showReturnToLogin && (
<button className="btn btn-primary me-1 mt-4" onClick={handleLogout} data-testid="return-to-login-button">
{t("Return to login")}
</button>
)}
{showReturnToHome && (
<button className="btn btn-primary me-1 mt-4" onClick={handleReturn} data-testid="return-to-home-button">
{t("Return to home")}
</button>
)}
</div>
);
};

export default AccessDenied;
Loading

0 comments on commit 9d5e9bc

Please sign in to comment.