prevent patient to see Worklist
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -59,3 +59,5 @@ tests/playwright-report/
|
|||||||
|
|
||||||
# Dummy
|
# Dummy
|
||||||
/dump
|
/dump
|
||||||
|
jwt-auth-inject.json
|
||||||
|
platform/app/dist.zip
|
||||||
|
|||||||
@@ -85,6 +85,38 @@ function WorkList({
|
|||||||
const debouncedFilterValues = useDebounce(filterValues, 200);
|
const debouncedFilterValues = useDebounce(filterValues, 200);
|
||||||
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
|
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Patch untuk Role checking patient gabisa akses ke study list
|
||||||
|
*/
|
||||||
|
const token = window.sessionStorage.getItem('ohif-auth-token');
|
||||||
|
if (!token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const decodedToken = decodeToken(token);
|
||||||
|
|
||||||
|
// Check jika 'role' = 'patient' tapi akses '/' return ke viewer
|
||||||
|
if (decodedToken && decodedToken.role === 'patient') {
|
||||||
|
const currentPath = window.location.pathname + window.location.search;
|
||||||
|
if (currentPath === '/') {
|
||||||
|
console.log(
|
||||||
|
'User is a patient and trying to access the root path. Redirecting to his/her home URL.'
|
||||||
|
);
|
||||||
|
window.location.href = `${decodedToken.home_url}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function decodeToken(token) {
|
||||||
|
try {
|
||||||
|
const payload = token.split('.')[1];
|
||||||
|
if (payload) {
|
||||||
|
return JSON.parse(atob(payload));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error parsing JWT token', e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The default sort value keep the filters synchronized with runtime conditional sorting
|
* The default sort value keep the filters synchronized with runtime conditional sorting
|
||||||
* Only applied if no other sorting is specified and there are less than 101 studies
|
* Only applied if no other sorting is specified and there are less than 101 studies
|
||||||
@@ -542,7 +574,7 @@ function WorkList({
|
|||||||
/>
|
/>
|
||||||
<Onboarding />
|
<Onboarding />
|
||||||
<InvestigationalUseDialog dialogConfiguration={appConfig?.investigationalUseDialog} />
|
<InvestigationalUseDialog dialogConfiguration={appConfig?.investigationalUseDialog} />
|
||||||
<div className="flex flex-col h-full overflow-y-auto">
|
<div className="flex h-full flex-col overflow-y-auto">
|
||||||
<ScrollArea>
|
<ScrollArea>
|
||||||
<div className="flex grow flex-col">
|
<div className="flex grow flex-col">
|
||||||
<StudyListFilter
|
<StudyListFilter
|
||||||
@@ -558,9 +590,7 @@ function WorkList({
|
|||||||
// ? () => dataSourceConfigurationComponent()
|
// ? () => dataSourceConfigurationComponent()
|
||||||
// : undefined
|
// : undefined
|
||||||
// }
|
// }
|
||||||
getDataSourceConfigurationComponent={
|
getDataSourceConfigurationComponent={undefined}
|
||||||
undefined
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{hasStudies ? (
|
{hasStudies ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user