screwdriver-api 8.0.70 → 8.0.71
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/auth/index.js +11 -0
package/package.json
CHANGED
package/plugins/auth/index.js
CHANGED
|
@@ -230,6 +230,17 @@ const authPlugin = {
|
|
|
230
230
|
scmContext: user.scmContext,
|
|
231
231
|
scope: ['user']
|
|
232
232
|
};
|
|
233
|
+
|
|
234
|
+
const scmDisplayName = scm.getDisplayName({ scmContext: profile.scmContext });
|
|
235
|
+
const userDisplayName = pluginOptions.authCheckById
|
|
236
|
+
? `${scmDisplayName}:${profile.username}:${profile.scmUserId}`
|
|
237
|
+
: `${scmDisplayName}:${profile.username}`;
|
|
238
|
+
const admins = pluginOptions.authCheckById ? pluginOptions.sdAdmins : pluginOptions.admins;
|
|
239
|
+
|
|
240
|
+
// Check admin
|
|
241
|
+
if (admins.length > 0 && admins.includes(userDisplayName)) {
|
|
242
|
+
profile.scope.push('admin');
|
|
243
|
+
}
|
|
233
244
|
}
|
|
234
245
|
if (token.pipelineId) {
|
|
235
246
|
// if token has pipelineId then the token is for pipeline
|