prevent patient to see Worklist
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -59,3 +59,5 @@ tests/playwright-report/
|
||||
|
||||
# Dummy
|
||||
/dump
|
||||
jwt-auth-inject.json
|
||||
platform/app/dist.zip
|
||||
|
||||
@@ -85,6 +85,38 @@ function WorkList({
|
||||
const debouncedFilterValues = useDebounce(filterValues, 200);
|
||||
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
|
||||
* Only applied if no other sorting is specified and there are less than 101 studies
|
||||
@@ -542,7 +574,7 @@ function WorkList({
|
||||
/>
|
||||
<Onboarding />
|
||||
<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>
|
||||
<div className="flex grow flex-col">
|
||||
<StudyListFilter
|
||||
@@ -558,9 +590,7 @@ function WorkList({
|
||||
// ? () => dataSourceConfigurationComponent()
|
||||
// : undefined
|
||||
// }
|
||||
getDataSourceConfigurationComponent={
|
||||
undefined
|
||||
}
|
||||
getDataSourceConfigurationComponent={undefined}
|
||||
/>
|
||||
</div>
|
||||
{hasStudies ? (
|
||||
|
||||
Reference in New Issue
Block a user