@stackfactor/client-api 1.0.31 → 1.0.33
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/index.js +0 -2
- package/lib/actionNotifications.js +202 -226
- package/lib/address.js +21 -27
- package/lib/axiosClient.js +58 -64
- package/lib/config.js +62 -66
- package/lib/dashboard.js +64 -68
- package/lib/departmentTrainingPlans.js +159 -153
- package/lib/groups.js +266 -291
- package/lib/integration.js +307 -312
- package/lib/integrationConfiguration.js +96 -90
- package/lib/integrations/contentGenerator.js +71 -74
- package/lib/learningContent.js +239 -240
- package/lib/logger.js +51 -56
- package/lib/role.js +238 -245
- package/lib/roleTemplate.js +247 -255
- package/lib/skill.js +299 -311
- package/lib/skillAssessmentTestingSession.js +132 -137
- package/lib/skillAssessments.js +125 -129
- package/lib/skillTemplate.js +250 -255
- package/lib/teams.js +261 -257
- package/lib/tenants.js +48 -52
- package/lib/trainingPlanTemplate.js +203 -202
- package/lib/trainingPlans.js +249 -251
- package/lib/userInformation.js +97 -85
- package/lib/users.js +557 -555
- package/lib/utils.js +38 -42
- package/package.json +1 -1
- package/lib/templates.js +0 -148
package/lib/groups.js
CHANGED
|
@@ -1,310 +1,285 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Add permissions to group
|
|
5
|
+
* @param {String} groupId The group Id
|
|
6
|
+
* @param {Array<String>} permissions The permissions to be added
|
|
7
|
+
* @param {String} authToken - Authentication token
|
|
8
|
+
*/
|
|
9
|
+
export const addPermissionsToGroup = (groupId, permissions, authToken) => {
|
|
10
|
+
return new Promise(function (resolve, reject) {
|
|
11
|
+
const request = axios.post(
|
|
12
|
+
`api/v1/groups/permissions/add`,
|
|
13
|
+
{
|
|
14
|
+
groupId: groupId,
|
|
15
|
+
permissions: permissions,
|
|
16
|
+
},
|
|
17
|
+
{ headers: { authorization: authToken } }
|
|
18
|
+
);
|
|
19
|
+
request
|
|
20
|
+
.then((response) => {
|
|
21
|
+
resolve(response.data);
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
reject(error);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
5
28
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Add users to group
|
|
31
|
+
* @param {String} groupId The group Id
|
|
32
|
+
* @param {Array<String>} users The users to be added
|
|
33
|
+
* @param {String} authToken - Authentication token
|
|
34
|
+
*/
|
|
35
|
+
export const addUsersToGroup = (groupId, users, authToken) => {
|
|
36
|
+
return new Promise(function (resolve, reject) {
|
|
37
|
+
const request = axios.post(
|
|
38
|
+
`api/v1/groups/users/add`,
|
|
39
|
+
{
|
|
40
|
+
groupId: groupId,
|
|
41
|
+
users: users,
|
|
42
|
+
},
|
|
43
|
+
{ headers: { authorization: authToken } }
|
|
44
|
+
);
|
|
45
|
+
request
|
|
46
|
+
.then((response) => {
|
|
47
|
+
resolve(response.data);
|
|
48
|
+
})
|
|
49
|
+
.catch((error) => {
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
31
54
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Create group
|
|
57
|
+
* @param {String} name The name of the group
|
|
58
|
+
* @param {String} description The description of the group
|
|
59
|
+
* @param {String} authToken The authorization token
|
|
60
|
+
*/
|
|
61
|
+
export const createGroup = (name, description, authToken) => {
|
|
62
|
+
return new Promise(function (resolve, reject) {
|
|
63
|
+
const request = axios.post(
|
|
64
|
+
`api/v1/groups/group`,
|
|
65
|
+
{
|
|
66
|
+
name: name,
|
|
67
|
+
description: description,
|
|
68
|
+
},
|
|
69
|
+
{ headers: { authorization: authToken } }
|
|
70
|
+
);
|
|
71
|
+
request
|
|
72
|
+
.then((response) => {
|
|
73
|
+
resolve(response.data);
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
reject(error);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
57
80
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{ headers: { authorization: authToken } }
|
|
73
|
-
);
|
|
74
|
-
request
|
|
75
|
-
.then((response) => {
|
|
76
|
-
resolve(response.data);
|
|
77
|
-
})
|
|
78
|
-
.catch((error) => {
|
|
79
|
-
reject(error);
|
|
80
|
-
});
|
|
81
|
+
/**
|
|
82
|
+
* Delete group
|
|
83
|
+
* @param {String} groupId The group to be deleted
|
|
84
|
+
* @param {String} defaultGroupId The default group all the users will be moved to
|
|
85
|
+
* @param {String} authToken The authentication token
|
|
86
|
+
*/
|
|
87
|
+
export const deleteGroup = (groupId, defaultGroupId, authToken) => {
|
|
88
|
+
return new Promise(function (resolve, reject) {
|
|
89
|
+
const request = axios.delete(`api/v1/groups/delete`, {
|
|
90
|
+
headers: { authorization: authToken },
|
|
91
|
+
data: {
|
|
92
|
+
id: groupId,
|
|
93
|
+
defaultGroupId: defaultGroupId,
|
|
94
|
+
},
|
|
81
95
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @param {String} authToken The authentication token
|
|
89
|
-
*/
|
|
90
|
-
deleteGroup: (groupId, defaultGroupId, authToken) => {
|
|
91
|
-
return new Promise(function (resolve, reject) {
|
|
92
|
-
const request = axios.delete(`api/v1/groups/delete`, {
|
|
93
|
-
headers: { authorization: authToken },
|
|
94
|
-
data: {
|
|
95
|
-
id: groupId,
|
|
96
|
-
defaultGroupId: defaultGroupId,
|
|
97
|
-
},
|
|
96
|
+
request
|
|
97
|
+
.then((response) => {
|
|
98
|
+
resolve(response.data);
|
|
99
|
+
})
|
|
100
|
+
.catch((error) => {
|
|
101
|
+
reject(error);
|
|
98
102
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
resolve(response.data);
|
|
102
|
-
})
|
|
103
|
-
.catch((error) => {
|
|
104
|
-
reject(error);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
},
|
|
103
|
+
});
|
|
104
|
+
};
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
request
|
|
119
|
-
.then((response) => {
|
|
120
|
-
resolve(response.data);
|
|
121
|
-
})
|
|
122
|
-
.catch((error) => {
|
|
123
|
-
reject(error);
|
|
124
|
-
});
|
|
106
|
+
/**
|
|
107
|
+
* Get all permissions
|
|
108
|
+
* @param {String} authToken The authentication token
|
|
109
|
+
*/
|
|
110
|
+
export const getAllPermissions = (authToken) => {
|
|
111
|
+
return new Promise(function (resolve, reject) {
|
|
112
|
+
const request = axios.get(`api/v1/groups/permissions/getAllPermissions`, {
|
|
113
|
+
headers: { authorization: authToken },
|
|
125
114
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*/
|
|
133
|
-
getGroupById: (groupId, authToken) => {
|
|
134
|
-
return new Promise(function (resolve, reject) {
|
|
135
|
-
const request = axios.get(`api/v1/groups/group/${groupId}`, {
|
|
136
|
-
headers: { authorization: authToken },
|
|
115
|
+
request
|
|
116
|
+
.then((response) => {
|
|
117
|
+
resolve(response.data);
|
|
118
|
+
})
|
|
119
|
+
.catch((error) => {
|
|
120
|
+
reject(error);
|
|
137
121
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
resolve(response.data);
|
|
141
|
-
})
|
|
142
|
-
.catch((error) => {
|
|
143
|
-
reject(error);
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
},
|
|
122
|
+
});
|
|
123
|
+
};
|
|
147
124
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
request
|
|
158
|
-
.then((response) => {
|
|
159
|
-
resolve(response.data);
|
|
160
|
-
})
|
|
161
|
-
.catch((error) => {
|
|
162
|
-
reject(error);
|
|
163
|
-
});
|
|
125
|
+
/**
|
|
126
|
+
* Get group by Id
|
|
127
|
+
* @param {String} groupId The group Id
|
|
128
|
+
* @param {String} authToken The authentication token
|
|
129
|
+
*/
|
|
130
|
+
export const getGroupById = (groupId, authToken) => {
|
|
131
|
+
return new Promise(function (resolve, reject) {
|
|
132
|
+
const request = axios.get(`api/v1/groups/group/${groupId}`, {
|
|
133
|
+
headers: { authorization: authToken },
|
|
164
134
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
getUserPermissions: (authToken) => {
|
|
172
|
-
return new Promise(function (resolve, reject) {
|
|
173
|
-
const request = axios.get(`api/v1/groups/users/getuserpermissions`, {
|
|
174
|
-
headers: { authorization: authToken },
|
|
135
|
+
request
|
|
136
|
+
.then((response) => {
|
|
137
|
+
resolve(response.data);
|
|
138
|
+
})
|
|
139
|
+
.catch((error) => {
|
|
140
|
+
reject(error);
|
|
175
141
|
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
resolve(response.data);
|
|
179
|
-
})
|
|
180
|
-
.catch((error) => {
|
|
181
|
-
reject(error);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
},
|
|
142
|
+
});
|
|
143
|
+
};
|
|
185
144
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
MANAGE_BILLING: "5e1570cd03f676213bfdcd08",
|
|
195
|
-
MANAGE_CONTENT_PROVIDERS: "5f0fa12f16a720fde58ea820",
|
|
196
|
-
MANAGE_GROUPS: "5dd612fe59e518ac87b8cf8e",
|
|
197
|
-
MANAGE_OWN_PROFILE_INFORMATION_AUTO_APP: "5fac210e7e6539d37a897c94",
|
|
198
|
-
MANAGE_ORGANIZATION_INFORMATION: "5dd612d5338ea9a6ae6326da",
|
|
199
|
-
MANAGE_OWN_SKILL_SET_AUTO_APPROVE: "5fac21164351c6727a34cd4e",
|
|
200
|
-
MANAGE_SETTINGS: "5e1570e087d836dc77888a5f",
|
|
201
|
-
MANAGE_TEAM_INFORMATION_AUTO_APPROVE: "5fac211e6c8f874bd7137b98",
|
|
202
|
-
MANAGE_TEAMS: "5dd61314afc2455a89b1a37b",
|
|
203
|
-
MANAGE_USERS: "5dd612e40f0bc559c41a2b29",
|
|
204
|
-
PROMOTE_CONTENT: "5fac2126427ce31f8a92c0cb",
|
|
205
|
-
MANAGE_PLAN_TEMPLATES: "5dd61305a73c68b44c3f0827",
|
|
206
|
-
},
|
|
207
|
-
/**
|
|
208
|
-
* Remove permissions from group
|
|
209
|
-
* @param {String} groupId The group Id
|
|
210
|
-
* @param {Array<String>} permissions The permissions to be removed from the group
|
|
211
|
-
* @param {String} authToken The authentication token
|
|
212
|
-
*/
|
|
213
|
-
removePermissionsFromGroup: (groupId, permissions, authToken) => {
|
|
214
|
-
return new Promise(function (resolve, reject) {
|
|
215
|
-
const request = axios.post(
|
|
216
|
-
`api/v1/groups/permissions/remove/`,
|
|
217
|
-
{
|
|
218
|
-
groupId: groupId,
|
|
219
|
-
permissions: permissions,
|
|
220
|
-
},
|
|
221
|
-
{ headers: { authorization: authToken } }
|
|
222
|
-
);
|
|
223
|
-
request
|
|
224
|
-
.then((response) => {
|
|
225
|
-
resolve(response.data);
|
|
226
|
-
})
|
|
227
|
-
.catch((error) => {
|
|
228
|
-
reject(error);
|
|
229
|
-
});
|
|
145
|
+
/**
|
|
146
|
+
* Get groups for current tenant
|
|
147
|
+
* @param {String} authToken The authentication token
|
|
148
|
+
*/
|
|
149
|
+
export const getGroups = (authToken) => {
|
|
150
|
+
return new Promise(function (resolve, reject) {
|
|
151
|
+
const request = axios.get(`api/v1/groups/`, {
|
|
152
|
+
headers: { authorization: authToken },
|
|
230
153
|
});
|
|
231
|
-
|
|
154
|
+
request
|
|
155
|
+
.then((response) => {
|
|
156
|
+
resolve(response.data);
|
|
157
|
+
})
|
|
158
|
+
.catch((error) => {
|
|
159
|
+
reject(error);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
232
163
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const request = axios.post(
|
|
242
|
-
`api/v1/groups/users/remove/`,
|
|
243
|
-
{
|
|
244
|
-
groupId: groupId,
|
|
245
|
-
users: users,
|
|
246
|
-
},
|
|
247
|
-
{ headers: { authorization: authToken } }
|
|
248
|
-
);
|
|
249
|
-
request
|
|
250
|
-
.then((response) => {
|
|
251
|
-
resolve(response.data);
|
|
252
|
-
})
|
|
253
|
-
.catch((error) => {
|
|
254
|
-
reject(error);
|
|
255
|
-
});
|
|
164
|
+
/**
|
|
165
|
+
* Get current user permissions
|
|
166
|
+
* @param {String} authToken The authentication token
|
|
167
|
+
*/
|
|
168
|
+
export const getUserPermissions = (authToken) => {
|
|
169
|
+
return new Promise(function (resolve, reject) {
|
|
170
|
+
const request = axios.get(`api/v1/groups/users/getuserpermissions`, {
|
|
171
|
+
headers: { authorization: authToken },
|
|
256
172
|
});
|
|
257
|
-
|
|
173
|
+
request
|
|
174
|
+
.then((response) => {
|
|
175
|
+
resolve(response.data);
|
|
176
|
+
})
|
|
177
|
+
.catch((error) => {
|
|
178
|
+
reject(error);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
258
182
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Remove permissions from group
|
|
185
|
+
* @param {String} groupId The group Id
|
|
186
|
+
* @param {Array<String>} permissions The permissions to be removed from the group
|
|
187
|
+
* @param {String} authToken The authentication token
|
|
188
|
+
*/
|
|
189
|
+
export const removePermissionsFromGroup = (groupId, permissions, authToken) => {
|
|
190
|
+
return new Promise(function (resolve, reject) {
|
|
191
|
+
const request = axios.post(
|
|
192
|
+
`api/v1/groups/permissions/remove/`,
|
|
193
|
+
{
|
|
194
|
+
groupId: groupId,
|
|
195
|
+
permissions: permissions,
|
|
196
|
+
},
|
|
197
|
+
{ headers: { authorization: authToken } }
|
|
198
|
+
);
|
|
199
|
+
request
|
|
200
|
+
.then((response) => {
|
|
201
|
+
resolve(response.data);
|
|
202
|
+
})
|
|
203
|
+
.catch((error) => {
|
|
204
|
+
reject(error);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
};
|
|
282
208
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Remove users from group
|
|
211
|
+
* @param {String} groupId The group Id
|
|
212
|
+
* @param {Array<String>} users The users to be removed from the group
|
|
213
|
+
* @param {String} authToken The authentication token
|
|
214
|
+
*/
|
|
215
|
+
export const removeUsersFromGroup = (groupId, users, authToken) => {
|
|
216
|
+
return new Promise(function (resolve, reject) {
|
|
217
|
+
const request = axios.post(
|
|
218
|
+
`api/v1/groups/users/remove/`,
|
|
219
|
+
{
|
|
220
|
+
groupId: groupId,
|
|
221
|
+
users: users,
|
|
222
|
+
},
|
|
223
|
+
{ headers: { authorization: authToken } }
|
|
224
|
+
);
|
|
225
|
+
request
|
|
226
|
+
.then((response) => {
|
|
227
|
+
resolve(response.data);
|
|
228
|
+
})
|
|
229
|
+
.catch((error) => {
|
|
230
|
+
reject(error);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
* Set group as defualt
|
|
237
|
+
* @param {String} groupId The group Id
|
|
238
|
+
* @param {String} authToken The authentication token
|
|
239
|
+
*/
|
|
240
|
+
export const setDefault = (groupId, authToken) => {
|
|
241
|
+
return new Promise(function (resolve, reject) {
|
|
242
|
+
const request = axios.put(
|
|
243
|
+
`api/v1/groups/setDefault/`,
|
|
244
|
+
{
|
|
245
|
+
id: groupId,
|
|
246
|
+
},
|
|
247
|
+
{ headers: { authorization: authToken } }
|
|
248
|
+
);
|
|
249
|
+
request
|
|
250
|
+
.then((response) => {
|
|
251
|
+
resolve(response.data);
|
|
252
|
+
})
|
|
253
|
+
.catch((error) => {
|
|
254
|
+
reject(error);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Update group
|
|
261
|
+
* @param {String} groupId The group Id
|
|
262
|
+
* @param {String} name The updated name of the group
|
|
263
|
+
* @param {String} description The updated description of the group
|
|
264
|
+
* @param {String} authToken The authentication token
|
|
265
|
+
*/
|
|
266
|
+
export const updateGroup = (groupId, name, description, authToken) => {
|
|
267
|
+
return new Promise(function (resolve, reject) {
|
|
268
|
+
const request = axios.patch(
|
|
269
|
+
`api/v1/groups/group/`,
|
|
270
|
+
{
|
|
271
|
+
id: groupId,
|
|
272
|
+
name: name,
|
|
273
|
+
description: description,
|
|
274
|
+
},
|
|
275
|
+
{ headers: { authorization: authToken } }
|
|
276
|
+
);
|
|
277
|
+
request
|
|
278
|
+
.then((response) => {
|
|
279
|
+
resolve(response.data);
|
|
280
|
+
})
|
|
281
|
+
.catch((error) => {
|
|
282
|
+
reject(error);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
310
285
|
};
|