-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from AOT-Technologies/feature/FWF-3316-permis…
…sion-matrix [🥬] Feature/fwf 3316 permission matrix to develop
- Loading branch information
Showing
23 changed files
with
875 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
46
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.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
forms-flow-admin/src/components/AccessDenied/accessDenied.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.