This commit is contained in:
@@ -316,7 +316,7 @@ const EventsCalendar = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewCalendar()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const CreateEventRequest = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const EventRequestList = () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ const CreateEvent = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canEditMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ const EventsCalendar = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ const EventsList = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ const EventsMultipleList = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ const UpdateEvent = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canEditMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const ViewEvent = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalEvents()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ const SideMenu = () => {
|
|||||||
name: 'Appointment One-Day List',
|
name: 'Appointment One-Day List',
|
||||||
link: '/medical/events/list',
|
link: '/medical/events/list',
|
||||||
category: '/events/list',
|
category: '/events/list',
|
||||||
roleFunc: AuthService.canAccessLegacySystem
|
roleFunc: AuthService.canViewMedicalEvents
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// name: 'Customer Report',
|
// name: 'Customer Report',
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const InfoScreen = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canViewRoutes()) {
|
if (!AuthService.canViewInfoScreen()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.');
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.');
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate('/login');
|
navigate('/login');
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ const Medical = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection() && !AuthService.canViewMedicalEvents()) {
|
||||||
|
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const MedicalIndex = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection() && !AuthService.canViewMedicalEvents()) {
|
||||||
|
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const TemplateManager = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert("You haven't login yet OR this user does not have access to this page. Please change an admin account to login.");
|
window.alert("You haven't login yet OR this user does not have access to this page. Please change an admin account to login.");
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ const CreateResource = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const ResourcesList = () => {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ const UpdateResource = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const ViewResource = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewMedicalSection()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const DailyTemplatesList = () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!AuthService.canAccessLegacySystem()) {
|
if (!AuthService.canViewRoutes()) {
|
||||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.')
|
||||||
AuthService.logout();
|
AuthService.logout();
|
||||||
navigate(`/login`);
|
navigate(`/login`);
|
||||||
|
|||||||
@@ -89,6 +89,22 @@ const canViewMedicalSection = () => {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const canViewMedicalEvents = () => {
|
||||||
|
return hasAnyPermission([
|
||||||
|
'View _Calendar _Medical Appointment',
|
||||||
|
'Edit&Create _Calendar _Medical Appointment',
|
||||||
|
'View_Appointment Calendar',
|
||||||
|
'Edit & Create_Appointment Calendar'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const canEditMedicalEvents = () => {
|
||||||
|
return hasAnyPermission([
|
||||||
|
'Edit&Create _Calendar _Medical Appointment',
|
||||||
|
'Edit & Create_Appointment Calendar'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
const canViewMealStatus = () => {
|
const canViewMealStatus = () => {
|
||||||
return hasAnyPermission([
|
return hasAnyPermission([
|
||||||
'View_Meal Status',
|
'View_Meal Status',
|
||||||
@@ -291,6 +307,8 @@ export const AuthService = {
|
|||||||
canViewCalendar,
|
canViewCalendar,
|
||||||
canViewMessaging,
|
canViewMessaging,
|
||||||
canViewMedicalSection,
|
canViewMedicalSection,
|
||||||
|
canViewMedicalEvents,
|
||||||
|
canEditMedicalEvents,
|
||||||
canViewMealStatus,
|
canViewMealStatus,
|
||||||
canViewSeatingChart,
|
canViewSeatingChart,
|
||||||
canViewLobby,
|
canViewLobby,
|
||||||
|
|||||||
Reference in New Issue
Block a user