screwdriver-api 8.0.17 → 8.0.18

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.17",
3
+ "version": "8.0.18",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -52,6 +52,10 @@ module.exports = () => ({
52
52
  if (!isValidToken(pipeline.id, request.auth.credentials)) {
53
53
  throw boom.unauthorized('Token does not have permission to this pipeline');
54
54
  }
55
+ // for mysql backward compatibility
56
+ if (!pipeline.adminUserIds) {
57
+ pipeline.adminUserIds = [];
58
+ }
55
59
 
56
60
  return (
57
61
  user
@@ -29,6 +29,10 @@ const eventsPlugin = {
29
29
  server.expose('updateAdmins', ({ permissions, pipeline, user }) => {
30
30
  const { username, id: userId } = user;
31
31
 
32
+ // for mysql backward compatibility
33
+ if (!pipeline.adminUserIds) {
34
+ pipeline.adminUserIds = [];
35
+ }
32
36
  // Delete user from admin list if bad permissions
33
37
  if (!permissions.push) {
34
38
  const newAdmins = pipeline.admins;
@@ -41,6 +41,10 @@ module.exports = () => ({
41
41
  if (!user) {
42
42
  throw boom.notFound(`User ${username} does not exist`);
43
43
  }
44
+ // for mysql backward compatibility
45
+ if (!pipeline.adminUserIds) {
46
+ pipeline.adminUserIds = [];
47
+ }
44
48
 
45
49
  // Use parent's scmUri if pipeline is child pipeline and using read-only SCM
46
50
  const scmUri = await getScmUri({ pipeline, pipelineFactory });
@@ -21,6 +21,10 @@ function getPermissionsForOldPipeline({ scmContexts, pipeline, user }) {
21
21
  const isPipelineSCMContextObsolete = !scmContexts.includes(pipeline.scmContext);
22
22
  const isUserFromAnotherSCMContext = user.scmContext !== pipeline.scmContext;
23
23
 
24
+ // for mysql backward compatibility
25
+ if (!pipeline.adminUserIds) {
26
+ pipeline.adminUserIds = [];
27
+ }
24
28
  // this pipeline's scmContext has been removed, allow current admin to change it
25
29
  // also allow pipeline admins from other scmContexts to change it
26
30
  if (isPipelineSCMContextObsolete || isUserFromAnotherSCMContext) {
@@ -70,6 +74,11 @@ module.exports = () => ({
70
74
  throw boom.notFound(`Pipeline ${id} does not exist`);
71
75
  }
72
76
 
77
+ // for mysql backward compatibility
78
+ if (!oldPipeline.adminUserIds) {
79
+ oldPipeline.adminUserIds = [];
80
+ }
81
+
73
82
  if (oldPipeline.configPipelineId) {
74
83
  throw boom.forbidden(
75
84
  `Child pipeline can only be modified by config pipeline ${oldPipeline.configPipelineId}`
@@ -90,6 +90,10 @@ async function updateAdmins(userFactory, username, scmContext, pipeline, pipelin
90
90
  const user = await userFactory.get({ username, scmContext });
91
91
  const userPermissions = await user.getPermissions(pipeline.scmUri, user.scmContext, pipeline.scmRepo);
92
92
 
93
+ // for mysql backward compatibility
94
+ if (!pipeline.adminUserIds) {
95
+ pipeline.adminUserIds = [];
96
+ }
93
97
  // Delete user from admin list if bad permissions
94
98
  if (!userPermissions.push) {
95
99
  const newAdmins = pipeline.admins;