Skip to content

Commit 0858e51

Browse files
Issue #78 - Fix issue where searching for groups as a user would fail
Real fix is only in app-routes.js - others are undoing changes that we thought would resolve the issue Basically, this ticket dealt with the cause and removed changes that dealt with the effect
1 parent 4fe32a8 commit 0858e51

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

app-constants.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*/
44
const UserRoles = {
55
Admin: 'Administrator',
6-
User: 'Topcoder User',
7-
CoPilot: 'copilot'
6+
User: 'Topcoder User'
87
}
98

109
const MembershipTypes = {

app-routes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = (app) => {
4141
if (!req.authUser) {
4242
return next(new errors.UnauthorizedError('Action is not allowed for invalid token'))
4343
}
44+
req.authUser.userId = String(req.authUser.userId)
4445
req.auth = req.authUser
4546
req.auth.sub = req.auth.userId
4647
if (req.authUser.roles) {

src/controllers/GroupController.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const logger = require('../common/logger')
1414
async function searchGroups (req, res) {
1515
const criteria = req.query || {}
1616
const isAdmin = req.authUser.isMachine || helper.hasAdminRole(req.authUser)
17-
console.log('isAdmin', isAdmin)
1817
if (!isAdmin) {
19-
console.log(req.authUser)
2018
criteria.memberId = req.authUser.userId
2119
criteria.membershipType = config.MEMBERSHIP_TYPES.User
2220
}

src/routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
controller: 'GroupController',
1111
method: 'searchGroups',
1212
auth: 'jwt',
13-
access: [constants.UserRoles.Admin, constants.UserRoles.User, constants.UserRoles.CoPilot],
13+
access: [constants.UserRoles.Admin, constants.UserRoles.User],
1414
scopes: ['read:groups', 'write:groups', 'all:groups']
1515
},
1616
post: {

0 commit comments

Comments
 (0)