Closed sandhiyakavi closed 3 years ago
@sandhiyakavi for user other than BM/admin role - plan is - not show taas-admin
icon. This will be implemented.
cc @maxceem
Summary:
withAuthentication
HOC, so it support the second argument roles
where we should pass user roles who can access this page. If auth user don't have such roles, we should show error.Example:
export default withAuthentication(WorkPeriods, ADMIN_ROLES);
ADMIN_ROLES
is a constant with value ['bookingmanager', 'administrator']
And update the code of withAuthentication
to be:
export default function withAuthentication(Component, roles) {
and inside, as soon as we get the user details, we should check if user has at least one role, and if no, then show error: You don't have permissions to access this page
.
Freelancers
page without roles
mentioned which means any user can access it.@MadOPcode would you like to handle it as a private task? The prize is mentioned in the issue description - $30.
Working branch: dev
Submission: PR
@maxceem yes I'm ready to make a PR.
ok, please, make PR when it's ready
@maxceem although I have a question first. The HOC component withAuthentication either displays or hides the whole page including the sidebar with navigation menu. So if the user doesn't have required role(s) the navigation menu will not be on the page. Should the sidebar with navigation menu still be visible if the user does not have required role(s)?
That's a good question. Let's keep it simple for now - the whole page would be hidden with sidebar, if wee need to keep sidebar visible in the future we would think for another solution.
Verified on Dev Env.
Verified on Prod Env with @nkumar-topcoder
Description:
Users other than BookingManager/Admin if they try to access the Taas Admin app. Now the text "Error: You don't have access to view memberRate" is displayed.
Instead of that can we have other text like "You don't have permission to access this page" or hide the "TAAS admin" option itself in the top nav bar ?