Skip to content

Commit e368280

Browse files
committed
fix: included talent manager to check for profile downloadable role
1 parent c8d7457 commit e368280

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

app-constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* App constants
33
*/
44
const ADMIN_ROLES = ['administrator', 'admin']
5-
const PM_ROLES = ['project manager']
5+
const PROFILE_DOWNLOAD_ROLES = ['project manager', 'Talent Manager']
66
const SEARCH_BY_EMAIL_ROLES = ADMIN_ROLES.concat('tgadmin')
77
const AUTOCOMPLETE_ROLES = ['copilot', 'administrator', 'admin', 'Connect Copilot', 'Connect Account Manager', 'Connect Admin', 'Account Executive']
88

@@ -33,7 +33,7 @@ const BOOLEAN_OPERATOR = {
3333
}
3434
module.exports = {
3535
ADMIN_ROLES,
36-
PM_ROLES,
36+
PROFILE_DOWNLOAD_ROLES,
3737
SEARCH_BY_EMAIL_ROLES,
3838
AUTOCOMPLETE_ROLES,
3939
EVENT_ORIGINATOR,

src/common/helper.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ function hasAutocompleteRole (authUser) {
150150
}
151151

152152
/**
153-
* Check if the user has PM role
153+
* Check if the user has a role which can download profile
154154
* @param {Object} authUser the user
155155
* @returns {Boolean} whether the user has PM role
156156
*/
157-
function hasPMRole (authUser) {
157+
function hasProfileDownloadableRole (authUser) {
158158
if (!authUser || !authUser.roles) {
159159
return false
160160
}
161161
for (let i = 0; i < authUser.roles.length; i += 1) {
162-
for (let j = 0; j < constants.PM_ROLES.length; j += 1) {
163-
if (authUser.roles[i].toLowerCase() === constants.PM_ROLES[j].toLowerCase()) {
162+
for (let j = 0; j < constants.PROFILE_DOWNLOAD_ROLES.length; j += 1) {
163+
if (authUser.roles[i].toLowerCase() === constants.PROFILE_DOWNLOAD_ROLES[j].toLowerCase()) {
164164
return true
165165
}
166166
}
@@ -377,7 +377,7 @@ function canDownloadProfile (currentUser, member) {
377377
return true
378378
}
379379
// PM can download
380-
if (hasPMRole(currentUser)) {
380+
if (hasProfileDownloadableRole(currentUser)) {
381381
return true
382382
}
383383
// Member can download their own profile
@@ -641,7 +641,7 @@ module.exports = {
641641
hasAdminRole,
642642
hasAutocompleteRole,
643643
hasSearchByEmailRole,
644-
hasPMRole,
644+
hasProfileDownloadableRole,
645645
getMemberByHandle,
646646
uploadPhotoToS3,
647647
postBusEvent,

0 commit comments

Comments
 (0)