Skip to content

Commit 0f660b0

Browse files
committed
Merge branch 'develop' into bugfix-2654/managers-cannot-approve-assignments
2 parents a04c643 + 9210c3b commit 0f660b0

File tree

7 files changed

+33
-12
lines changed

7 files changed

+33
-12
lines changed

web-ui/src/components/feedback_template_selector/FeedbackTemplateSelector.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
9696
creatorId: currentUserId,
9797
active: true,
9898
isAdHoc: true,
99-
isPublic: false
99+
isPublic: false,
100+
isReview: false,
100101
};
101102

102103
const newTemplateQuestion = {
@@ -187,6 +188,7 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
187188
description={template.description}
188189
isAdHoc={template.isAdHoc}
189190
isPublic={template.isPublic}
191+
isReview={template.isReview}
190192
isSelected={query === template.id}
191193
questions={template.questions}
192194
expanded={preview.open}

web-ui/src/components/menu/Menu.jsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ import {
1313
selectHasSkillsReportPermission,
1414
selectHasTeamSkillsReportPermission,
1515
selectHasViewPulseReportPermission,
16-
selectIsAdmin
16+
selectIsAdmin,
17+
selectHasEarnedCertificationsPermission,
18+
selectHasMeritReportPermission,
19+
selectHasVolunteeringEventsPermission,
20+
selectHasVolunteeringRelationshipsPermission,
1721
} from '../../context/selectors';
1822
import { UPDATE_TOAST } from '../../context/actions';
1923

@@ -136,7 +140,9 @@ function Menu({ children }) {
136140
links.push(['/birthday-reports', 'Birthdays']);
137141
}
138142

139-
links.push(['/certification-reports', 'Certifications']);
143+
if (selectHasEarnedCertificationsPermission(state)) {
144+
links.push(['/certification-reports', 'Certifications']);
145+
}
140146

141147
if (selectHasCheckinsReportPermission(state)) {
142148
links.push(['/checkins-reports', 'Check-ins']);
@@ -154,8 +160,14 @@ function Menu({ children }) {
154160
links.push(['/team-skills-reports', 'Team Skills']);
155161
}
156162

157-
links.push(['/merit-reports', 'Merit Report']);
158-
links.push(['/volunteer-reports', 'Volunteering']);
163+
if (selectHasMeritReportPermission(state)) {
164+
links.push(['/merit-reports', 'Merit Report']);
165+
}
166+
167+
if (selectHasVolunteeringEventsPermission(state) ||
168+
selectHasVolunteeringRelationshipsPermission(state)) {
169+
links.push(['/volunteer-reports', 'Volunteering']);
170+
}
159171

160172
return links;
161173
};

web-ui/src/components/personnel/Personnel.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { UPDATE_CHECKINS } from '../../context/actions';
77
import {
88
selectCurrentUserId,
99
selectMostRecentCheckin,
10-
selectCsrfToken
10+
selectCsrfToken,
11+
selectCanViewCheckinsPermission,
1112
} from '../../context/selectors';
1213
import Card from '@mui/material/Card';
1314
import CardHeader from '@mui/material/CardHeader';
@@ -53,7 +54,7 @@ const Personnel = () => {
5354
// Get checkins per personnel
5455
useEffect(() => {
5556
async function updateCheckins() {
56-
if (personnel) {
57+
if (personnel && selectCanViewCheckinsPermission(state)) {
5758
for (const person of personnel) {
5859
let res = await getCheckinByMemberId(person.id, csrf);
5960
let data =

web-ui/src/components/volunteer/VolunteerTables.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Box, Tab, Tabs, Typography, Card, CardHeader, CardContent, Avatar } fro
44

55
import {
66
selectHasVolunteeringEventsPermission,
7-
selectHasVolunteeringOrganizationsPermission,
87
selectHasVolunteeringRelationshipsPermission,
98
noPermission,
109
} from '../../context/selectors';
@@ -58,7 +57,6 @@ const VolunteerReportPage = ({ onlyMe = false }) => {
5857
let tabContent = 0;
5958

6059
return (selectHasVolunteeringEventsPermission(state) ||
61-
selectHasVolunteeringOrganizationsPermission(state) ||
6260
selectHasVolunteeringRelationshipsPermission(state)) ? (
6361
<Card className="volunteer-activities-card">
6462
<CardContent className="volunteer-tables">

web-ui/src/context/AppContext.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import {
2121
getAllMembers,
2222
getAllTerminatedMembers
2323
} from '../api/member';
24+
import {
25+
selectCanViewCheckinsPermission,
26+
} from './selectors';
2427
import { getAllRoles, getAllUserRoles } from '../api/roles';
2528
import { getMemberSkills } from '../api/memberskill';
2629
import { BASE_API_URL } from '../api/api';
@@ -188,7 +191,7 @@ const AppContextProvider = props => {
188191
csrf
189192
) {
190193
getAllCheckinsForAdmin(dispatch, csrf);
191-
} else if (id && csrf) {
194+
} else if (id && csrf && selectCanViewCheckinsPermission(state)) {
192195
getCheckins(id, pdlId, dispatch, csrf);
193196
}
194197
}

web-ui/src/context/selectors.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ export const selectHasSendEmailPermission = hasPermission(
186186
'CAN_SEND_EMAIL'
187187
);
188188

189+
export const selectCanViewCheckinsPermission = hasPermission(
190+
'CAN_VIEW_CHECKINS'
191+
);
192+
189193
export const selectIsPDL = createSelector(
190194
selectUserProfile,
191195
userProfile =>

web-ui/src/pages/CheckinsPage.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
selectCsrfToken,
1313
selectCheckin,
1414
selectProfile,
15-
selectCheckinsForMember
15+
selectCheckinsForMember,
16+
selectCanViewCheckinsPermission,
1617
} from '../context/selectors';
1718
import { getCheckins, createNewCheckin } from '../context/thunks';
1819
import { UPDATE_CHECKIN, UPDATE_TOAST } from '../context/actions';
@@ -72,7 +73,7 @@ const CheckinsPage = () => {
7273
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
7374

7475
useEffect(() => {
75-
if (selectedProfile) {
76+
if (selectedProfile && selectCanViewCheckinsPermission(state)) {
7677
getCheckins(memberId, selectedProfile.pdlId, dispatch, csrf);
7778
}
7879
}, [memberId, selectedProfile, csrf, dispatch]);

0 commit comments

Comments
 (0)