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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.70",
3
+ "version": "8.0.71",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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