Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit fadd8d0

Browse files
Misc
1 parent 9ab4681 commit fadd8d0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/common/es-helper.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,10 @@ async function searchUsers (authUser, filter, params) {
13401340
const { checkIfExists, getAuthUser } = require('./helper')
13411341
const queryDoc = DOCUMENTS.user
13421342

1343+
if (!filter.organizationId) {
1344+
throw new Error('Cannot search for users without organization info')
1345+
}
1346+
13431347
if (!params.page) {
13441348
params.page = 1
13451349
}
@@ -1437,6 +1441,9 @@ async function searchUsers (authUser, filter, params) {
14371441
* @param {Object} param0 the organizationId and keyword
14381442
*/
14391443
async function searchSkillsInOrganization ({ organizationId, keyword }) {
1444+
if (!organizationId) {
1445+
throw Error('Cannot search for skills without organization info')
1446+
}
14401447
const esQueryToGetSkillProviders = buildEsQueryToGetSkillProviderIds(organizationId)
14411448
logger.debug(`ES query to get skill provider ids: ${JSON.stringify(esQueryToGetSkillProviders, null, 2)}`)
14421449

@@ -1488,6 +1495,9 @@ async function searchAttributeValues ({ attributeId, attributeValue }) {
14881495
}
14891496

14901497
async function searchAchievementValues ({ organizationId, keyword }) {
1498+
if (!organizationId) {
1499+
throw Error('Cannot search for achievements without organization info')
1500+
}
14911501
const esQuery = buildEsQueryToGetAchievements(organizationId, querystring.unescape(keyword), 5)
14921502
logger.debug(`ES query for searching achievement values; ${JSON.stringify(esQuery, null, 2)}`)
14931503

src/modules/usersRole/route.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ module.exports = {
3838
access: consts.AllAuthenticatedUsers,
3939
scopes: ['read:usersRole', 'all:usersRole']
4040
},
41-
patch: {
42-
method: Controller.patch,
43-
auth: 'jwt',
44-
access: consts.AllAuthenticatedUsers,
45-
scopes: ['update:usersRole', 'all:usersRole']
46-
},
4741
delete: {
4842
method: Controller.remove,
4943
auth: 'jwt',

0 commit comments

Comments
 (0)