diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index b45ed0a2ea..9d4dae9d02 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -87,68 +87,69 @@ export function Header(props) { () => ALLOWED_ROLES_TO_INTERACT.includes(props.auth.user.role), [ALLOWED_ROLES_TO_INTERACT, props.auth.user.role], ); + const headerDisabled = isAuthUser ? false : !canInteractWithViewingUser; // Reports const canGetReports = props.hasPermission( 'getReports', - !isAuthUser && canInteractWithViewingUser, + !isAuthUser , ); const canGetWeeklySummaries = props.hasPermission( 'getWeeklySummaries', - !isAuthUser && canInteractWithViewingUser, + !isAuthUser, ); const canGetWeeklyVolunteerSummary = props.hasPermission('getWeeklySummaries'); const canGetJobAnalytics = props.hasPermission('getJobReports'); // Users const canAccessUserManagement = - props.hasPermission('postUserProfile', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteUserProfile', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('changeUserStatus', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('getUserProfiles', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('setFinalDay', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('postUserProfile', !isAuthUser ) || + props.hasPermission('deleteUserProfile', !isAuthUser ) || + props.hasPermission('changeUserStatus', !isAuthUser ) || + props.hasPermission('getUserProfiles', !isAuthUser ) || + props.hasPermission('setFinalDay', !isAuthUser); // Badges const canAccessBadgeManagement = - props.hasPermission('seeBadges', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('createBadges', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('updateBadges', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteBadges', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('seeBadges', !isAuthUser ) || + props.hasPermission('createBadges', !isAuthUser ) || + props.hasPermission('updateBadges', !isAuthUser) || + props.hasPermission('deleteBadges', !isAuthUser ); // Projects const canAccessProjects = - props.hasPermission('postProject', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteProject', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('putProject', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('getProjectMembers', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('assignProjectToUsers', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('postWbs', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteWbs', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('postTask', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('updateTask', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteTask', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('postProject', !isAuthUser ) || + props.hasPermission('deleteProject', !isAuthUser ) || + props.hasPermission('putProject', !isAuthUser ) || + props.hasPermission('getProjectMembers', !isAuthUser ) || + props.hasPermission('assignProjectToUsers', !isAuthUser ) || + props.hasPermission('postWbs', !isAuthUser ) || + props.hasPermission('deleteWbs', !isAuthUser ) || + props.hasPermission('postTask', !isAuthUser ) || + props.hasPermission('updateTask', !isAuthUser ) || + props.hasPermission('deleteTask', !isAuthUser); // Tasks const canUpdateTask = props.hasPermission( 'updateTask', - !isAuthUser && canInteractWithViewingUser, + !isAuthUser, ); // Teams const canAccessTeams = - props.hasPermission('postTeam', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('putTeam', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteTeam', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('assignTeamToUsers', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('postTeam', !isAuthUser ) || + props.hasPermission('putTeam', !isAuthUser) || + props.hasPermission('deleteTeam', !isAuthUser ) || + props.hasPermission('assignTeamToUsers', !isAuthUser); // Popups const canAccessPopups = - props.hasPermission('createPopup', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('updatePopup', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('createPopup', !isAuthUser) || + props.hasPermission('updatePopup', !isAuthUser ); // SendEmails const canAccessSendEmails = props.hasPermission('sendEmails', !isAuthUser); // Permissions const canAccessPermissionsManagement = - props.hasPermission('postRole', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('putRole', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('deleteRole', !isAuthUser && canInteractWithViewingUser) || - props.hasPermission('putUserProfilePermissions', !isAuthUser && canInteractWithViewingUser); + props.hasPermission('postRole', !isAuthUser ) || + props.hasPermission('putRole', !isAuthUser ) || + props.hasPermission('deleteRole', !isAuthUser ) || + props.hasPermission('putUserProfilePermissions', !isAuthUser); // Blue Square Email Management const canAccessBlueSquareEmailManagement = props.hasPermission('resendBlueSquareAndSummaryEmails', !isAuthUser); @@ -413,7 +414,7 @@ export function Header(props) { > {canUpdateTask && ( - + {props.taskEditSuggestionCount} @@ -421,22 +422,22 @@ export function Header(props) { )} - + {DASHBOARD} - + {TIMELOG} {showProjectDropdown && ( - + {PROJECTS} - + Add Material - + Log Material - + Material List Add Equipment/Tool @@ -461,6 +463,7 @@ export function Header(props) { tag={Link} to="/bmdashboard/equipment/:equipmentId" className={fontColor} + disabled={headerDisabled} > Log Equipment/Tool @@ -468,16 +471,17 @@ export function Header(props) { tag={Link} to="/bmdashboard/tools/:equipmentId/update" className={fontColor} + disabled={headerDisabled} > Update Equipment/Tool - + Equipment/Tool List - + Issue - + Lesson @@ -492,48 +496,49 @@ export function Header(props) { {canGetReports && ( - + {REPORTS} )} {canGetWeeklySummaries && ( - + {WEEKLY_SUMMARIES_REPORT} )} {canGetWeeklyVolunteerSummary && ( - + {TOTAL_ORG_SUMMARY} )} {canGetJobAnalytics && ( - + {JOB_ANALYTICS_REPORT} )} - + {TEAM_LOCATIONS} {TOTAL_CONSTRUCTION_SUMMARY} - setShowPromotionsPopup(true)} className={fontColor}> + setShowPromotionsPopup(true)} className={fontColor} disabled={headerDisabled}> {PR_PROMOTIONS} ) : ( - + {TEAM_LOCATIONS} )} - + {(canAccessUserManagement || @@ -550,27 +555,27 @@ export function Header(props) { {canAccessUserManagement && ( - + {USER_MANAGEMENT} )} {canAccessBadgeManagement && ( - + {BADGE_MANAGEMENT} )} {canAccessProjects && ( - + {PROJECTS} )} {canAccessTeams && ( - + {TEAMS} )} {canAccessSendEmails && ( - + {SEND_EMAILS} )} @@ -581,13 +586,14 @@ export function Header(props) { tag={Link} to="/permissionsmanagement" className={fontColor} + disabled={headerDisabled} > {PERMISSIONS_MANAGEMENT} > )} - + PR Team Analytics {canAccessBlueSquareEmailManagement && ( @@ -595,6 +601,7 @@ export function Header(props) { tag={Link} to="/bluesquare-email-management" className={fontColor} + disabled={headerDisabled} > {BLUE_SQUARE_EMAIL_MANAGEMENT} @@ -634,6 +641,7 @@ export function Header(props) { tag={Link} to={`/userprofile/${displayUserId}`} className={fontColor} + disabled={headerDisabled} > {VIEW_PROFILE} @@ -653,7 +661,7 @@ export function Header(props) { - + {LOGOUT}