Skip to content

Commit 0edac74

Browse files
author
James Cori
committed
Increasing Logging on Groups Calls
1 parent 10b592d commit 0edac74

File tree

3 files changed

+23
-41
lines changed

3 files changed

+23
-41
lines changed

src/common/helper.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ async function getProjectDefaultTerms (projectId) {
758758
* @param {Number} projectId The id of the project for which to get the default terms of use
759759
* @returns {Promise<Number>} The billing account ID
760760
*/
761-
async function getProjectBillingInformation (projectId) {
761+
async function getProjectBillingInformation (projectId) {
762762
const token = await getM2MToken()
763763
const projectUrl = `${config.PROJECTS_API_URL}/${projectId}/billingAccount`
764764
try {
@@ -865,7 +865,11 @@ async function _filterChallengesByGroupsAccess (currentUser, challenges) {
865865
async function ensureAccessibleByGroupsAccess (currentUser, challenge) {
866866
const filtered = await _filterChallengesByGroupsAccess(currentUser, [challenge])
867867
if (filtered.length === 0) {
868-
throw new errors.ForbiddenError(`You don't have access to this group!`)
868+
throw new errors.ForbiddenError(`helper ensureAcessibilityToModifiedGroups :: You don't have access to this group!
869+
Current user: ${JSON.stringify(currentUser)}
870+
Challenge: ${JSON.stringify(challenge)}
871+
Filtered: ${JSON.stringify(filtered)}
872+
`)
869873
}
870874
}
871875

src/scripts/seed/TimelineTemplate.json

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,6 @@
4949
"phaseId": "aa5a3f78-79e0-4bf7-93ff-b11e8f5b398b",
5050
"predecessor": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
5151
"defaultDuration": 259200
52-
},
53-
{
54-
"phaseId": "1c24cfb3-5b0a-4dbd-b6bd-4b0dff5349c6",
55-
"predecessor": "aa5a3f78-79e0-4bf7-93ff-b11e8f5b398b",
56-
"defaultDuration": 86400
57-
},
58-
{
59-
"phaseId": "797a6af7-cd3f-4436-9fca-9679f773bee9",
60-
"predecessor": "1c24cfb3-5b0a-4dbd-b6bd-4b0dff5349c6",
61-
"defaultDuration": 57600
62-
},
63-
{
64-
"phaseId": "3e2afca6-9542-4763-a135-96b33f12c082",
65-
"predecessor": "797a6af7-cd3f-4436-9fca-9679f773bee9",
66-
"defaultDuration": 86400
67-
},
68-
{
69-
"phaseId": "f3acaf26-1dd5-42ae-9f0d-8eb0fd24ae59",
70-
"predecessor": "3e2afca6-9542-4763-a135-96b33f12c082",
71-
"defaultDuration": 86400
72-
},
73-
{
74-
"phaseId": "ad985cff-ad3e-44de-b54e-3992505ba0ae",
75-
"predecessor": "f3acaf26-1dd5-42ae-9f0d-8eb0fd24ae59",
76-
"defaultDuration": 172800
7752
}
7853
]
7954
},
@@ -194,11 +169,6 @@
194169
"phaseId": "003a4b14-de5d-43fc-9e35-835dbeb6af1f",
195170
"predecessor": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
196171
"defaultDuration": 86400
197-
},
198-
{
199-
"phaseId": "ad985cff-ad3e-44de-b54e-3992505ba0ae",
200-
"predecessor": "003a4b14-de5d-43fc-9e35-835dbeb6af1f",
201-
"defaultDuration": 86400
202172
}
203173
]
204174
},
@@ -208,19 +178,18 @@
208178
"description": "Task Timeline",
209179
"isActive": true,
210180
"phases": [
181+
{
182+
"phaseId": "a93544bc-c165-4af4-b55e-18f3593b457a",
183+
"defaultDuration": 864000
184+
},
211185
{
212186
"phaseId": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
213-
"defaultDuration": 86400
187+
"defaultDuration": 864000
214188
},
215189
{
216190
"phaseId": "003a4b14-de5d-43fc-9e35-835dbeb6af1f",
217191
"predecessor": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
218192
"defaultDuration": 86400
219-
},
220-
{
221-
"phaseId": "ad985cff-ad3e-44de-b54e-3992505ba0ae",
222-
"predecessor": "003a4b14-de5d-43fc-9e35-835dbeb6af1f",
223-
"defaultDuration": 86400
224193
}
225194
]
226195
}

src/services/ChallengeService.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ async function filterChallengesByGroupsAccess (currentUser, challenges) {
8888
async function ensureAccessibleByGroupsAccess (currentUser, challenge) {
8989
const filtered = await filterChallengesByGroupsAccess(currentUser, [challenge])
9090
if (filtered.length === 0) {
91-
throw new errors.ForbiddenError(`You don't have access to this group!`)
91+
throw new errors.ForbiddenError(`ensureAccessibleByGroupsAccess :: You don't have access to this group!
92+
Current User: ${JSON.stringify(currentUser)}
93+
Challenge: ${JSON.stringify(challenge)}
94+
Filtered: ${JSON.stringify(filtered)}
95+
`)
9296
}
9397
}
9498

@@ -108,7 +112,12 @@ async function ensureAcessibilityToModifiedGroups (currentUser, data, challenge)
108112
const updatedGroups = _.difference(_.union(challenge.groups, data.groups), _.intersection(challenge.groups, data.groups))
109113
const filtered = updatedGroups.filter(g => !userGroupsIds.includes(g))
110114
if (filtered.length > 0) {
111-
throw new errors.ForbiddenError(`You don't have access to this group!`)
115+
throw new errors.ForbiddenError(`ensureAcessibilityToModifiedGroups :: You don't have access to this group!
116+
Current User: ${JSON.stringify(currentUser)}
117+
Data: ${JSON.stringify(data)}
118+
Challenge: ${JSON.stringify(challenge)}
119+
Filtered: ${JSON.stringify(filtered)}
120+
`)
112121
}
113122
}
114123

@@ -2012,4 +2021,4 @@ module.exports = {
20122021
deleteChallenge
20132022
}
20142023

2015-
// logger.buildService(module.exports)
2024+
logger.buildService(module.exports)

0 commit comments

Comments
 (0)