screwdriver-api 4.1.202 → 4.1.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/events/create.js +16 -3
package/package.json
CHANGED
package/plugins/events/create.js
CHANGED
|
@@ -115,6 +115,10 @@ module.exports = () => ({
|
|
|
115
115
|
userFactory.get({ username, scmContext })
|
|
116
116
|
]);
|
|
117
117
|
|
|
118
|
+
if (!pipeline) {
|
|
119
|
+
throw boom.notFound();
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
payload.scmContext = pipeline.scmContext;
|
|
119
123
|
|
|
120
124
|
// In pipeline scope, check if the token is allowed to the pipeline
|
|
@@ -126,7 +130,16 @@ module.exports = () => ({
|
|
|
126
130
|
const scmUri = await getScmUri({ pipeline, pipelineFactory });
|
|
127
131
|
|
|
128
132
|
// Check the user's permission
|
|
129
|
-
|
|
133
|
+
let permissions;
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
permissions = await user.getPermissions(scmUri);
|
|
137
|
+
} catch (err) {
|
|
138
|
+
if (err.statusCode === 403 && (pipeline.scmRepo && pipeline.scmRepo.private)) {
|
|
139
|
+
throw boom.notFound();
|
|
140
|
+
}
|
|
141
|
+
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
142
|
+
}
|
|
130
143
|
|
|
131
144
|
// Update admins
|
|
132
145
|
if (!prNum) {
|
|
@@ -187,8 +200,8 @@ module.exports = () => ({
|
|
|
187
200
|
// User has good permissions, create an event
|
|
188
201
|
sha = await scm.getCommitSha(scmConfig);
|
|
189
202
|
} catch (err) {
|
|
190
|
-
if (err.
|
|
191
|
-
throw boom.boomify(err, { statusCode: err.
|
|
203
|
+
if (err.statusCode) {
|
|
204
|
+
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
192
205
|
}
|
|
193
206
|
}
|
|
194
207
|
|