-
Notifications
You must be signed in to change notification settings - Fork 6
check for Pulse report permission in UI #2482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2f42689
55d9c12
8878ec9
3ca2ce1
fc5e0c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| import { useMediaQuery } from '@mui/material'; | ||
| import React, { useState } from 'react'; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| import React from 'react'; | ||
| import DesktopTable from './DesktopTable'; | ||
| import MobileTable from './MobileTable'; | ||
| import { allPermissions, roles } from './sample-data'; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| export default function Permissions() { | ||
| const showDesktop = useMediaQuery('(min-width:650px)', { noSsr: true }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,10 +123,9 @@ function Menu({ children }) { | |
| links.push(['/checkins-reports', 'Check-ins']); | ||
| } | ||
|
|
||
| // TODO: Uncomment this check after PR #2429 is merged. | ||
| //if (selectHasViewPulseReportPermission(state)) { | ||
| if (selectHasViewPulseReportPermission(state)) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is working now. |
||
| links.push(['/pulse-reports', 'Pulses']); | ||
| //} | ||
| } | ||
|
|
||
| if (selectHasSkillsReportPermission(state)) { | ||
| links.push(['/skills-reports', 'Skills']); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,14 +16,13 @@ export const selectLoading = state => state.loading; | |
| export const selectReviewPeriods = state => state.reviewPeriods; | ||
| export const selectPermissions = state => state.permissions; | ||
|
|
||
| const hasPermission = permissionName => createSelector( | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prettier made lots of formatting changes in this file. |
||
| selectUserProfile, | ||
| userProfile => | ||
| userProfile && | ||
| const hasPermission = permissionName => | ||
| createSelector( | ||
| selectUserProfile, | ||
| userProfile => | ||
| userProfile && | ||
| userProfile.role && | ||
| userProfile.permissions.some(p => | ||
| p?.permission?.includes(permissionName) | ||
| ) | ||
| userProfile.permissions.some(p => p?.permission?.includes(permissionName)) | ||
| ); | ||
|
|
||
| export const selectTeamsLoading = createSelector(selectLoading, loading => { | ||
|
|
@@ -47,58 +46,75 @@ export const selectIsAdmin = createSelector( | |
| userProfile && userProfile.role && userProfile.role.includes('ADMIN') | ||
| ); | ||
|
|
||
| export const selectHasPermissionAssignmentPermission = | ||
| hasPermission('CAN_ASSIGN_ROLE_PERMISSIONS'); | ||
| export const selectHasPermissionAssignmentPermission = hasPermission( | ||
| 'CAN_ASSIGN_ROLE_PERMISSIONS' | ||
| ); | ||
|
|
||
| export const selectHasReportPermission = hasPermission('REPORT'); | ||
|
|
||
| export const selectHasAnniversaryReportPermission = | ||
| hasPermission('CAN_VIEW_ANNIVERSARY_REPORT'); | ||
| export const selectHasAnniversaryReportPermission = hasPermission( | ||
| 'CAN_VIEW_ANNIVERSARY_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasBirthdayReportPermission = | ||
| hasPermission('CAN_VIEW_BIRTHDAY_REPORT'); | ||
| export const selectHasBirthdayReportPermission = hasPermission( | ||
| 'CAN_VIEW_BIRTHDAY_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasCheckinsReportPermission = | ||
| hasPermission('CAN_VIEW_CHECKINS_REPORT'); | ||
| export const selectHasCheckinsReportPermission = hasPermission( | ||
| 'CAN_VIEW_CHECKINS_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasProfileReportPermission = | ||
| hasPermission('CAN_VIEW_PROFILE_REPORT'); | ||
| export const selectHasProfileReportPermission = hasPermission( | ||
| 'CAN_VIEW_PROFILE_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasViewPulseReportPermission = | ||
| hasPermission('CAN_VIEW_ALL_PULSE_RESPONSES'); | ||
| export const selectHasViewPulseReportPermission = hasPermission( | ||
| 'CAN_VIEW_ALL_PULSE_RESPONSES' | ||
| ); | ||
|
|
||
| export const selectHasSkillsReportPermission = | ||
| hasPermission('CAN_VIEW_SKILLS_REPORT'); | ||
| export const selectHasSkillsReportPermission = hasPermission( | ||
| 'CAN_VIEW_SKILLS_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasTeamSkillsReportPermission = | ||
| hasPermission('CAN_VIEW_SKILLS_REPORT'); | ||
| export const selectHasTeamSkillsReportPermission = hasPermission( | ||
| 'CAN_VIEW_SKILLS_REPORT' | ||
| ); | ||
|
|
||
| export const selectHasCreateReviewAssignmentsPermission = | ||
| hasPermission('CAN_CREATE_REVIEW_ASSIGNMENTS'); | ||
| export const selectHasCreateReviewAssignmentsPermission = hasPermission( | ||
| 'CAN_CREATE_REVIEW_ASSIGNMENTS' | ||
| ); | ||
|
|
||
| export const selectHasDeleteReviewAssignmentsPermission = | ||
| hasPermission('CAN_DELETE_REVIEW_ASSIGNMENTS'); | ||
| export const selectHasDeleteReviewAssignmentsPermission = hasPermission( | ||
| 'CAN_DELETE_REVIEW_ASSIGNMENTS' | ||
| ); | ||
|
|
||
| export const selectHasUpdateReviewAssignmentsPermission = | ||
| hasPermission('CAN_UPDATE_REVIEW_ASSIGNMENTS'); | ||
| export const selectHasUpdateReviewAssignmentsPermission = hasPermission( | ||
| 'CAN_UPDATE_REVIEW_ASSIGNMENTS' | ||
| ); | ||
|
|
||
| export const selectHasViewReviewAssignmentsPermission = | ||
| hasPermission('CAN_VIEW_REVIEW_ASSIGNMENTS'); | ||
| export const selectHasViewReviewAssignmentsPermission = hasPermission( | ||
| 'CAN_VIEW_REVIEW_ASSIGNMENTS' | ||
| ); | ||
|
|
||
| export const selectHasCloseReviewPeriodPermission = | ||
| hasPermission('CAN_CLOSE_REVIEW_PERIOD'); | ||
| export const selectHasCloseReviewPeriodPermission = hasPermission( | ||
| 'CAN_CLOSE_REVIEW_PERIOD' | ||
| ); | ||
|
|
||
| export const selectHasCreateReviewPeriodPermission = | ||
| hasPermission('CAN_CREATE_REVIEW_PERIOD'); | ||
| export const selectHasCreateReviewPeriodPermission = hasPermission( | ||
| 'CAN_CREATE_REVIEW_PERIOD' | ||
| ); | ||
|
|
||
| export const selectHasDeleteReviewPeriodPermission = | ||
| hasPermission('CAN_DELETE_REVIEW_PERIOD'); | ||
| export const selectHasDeleteReviewPeriodPermission = hasPermission( | ||
| 'CAN_DELETE_REVIEW_PERIOD' | ||
| ); | ||
|
|
||
| export const selectHasLaunchReviewPeriodPermission = | ||
| hasPermission('CAN_LAUNCH_REVIEW_PERIOD'); | ||
| export const selectHasLaunchReviewPeriodPermission = hasPermission( | ||
| 'CAN_LAUNCH_REVIEW_PERIOD' | ||
| ); | ||
|
|
||
| export const selectHasUpdateReviewPeriodPermission = | ||
| hasPermission('CAN_UPDATE_REVIEW_PERIOD'); | ||
| export const selectHasUpdateReviewPeriodPermission = hasPermission( | ||
| 'CAN_UPDATE_REVIEW_PERIOD' | ||
| ); | ||
|
|
||
| export const selectIsPDL = createSelector( | ||
| selectUserProfile, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this permission to the Reporting category since it is a kind of report and we don't have anything else in the Pulse category.