@oneuptime/common 7.0.4850 → 7.0.4877

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.
Files changed (39) hide show
  1. package/Models/DatabaseModels/Index.ts +7 -0
  2. package/Models/DatabaseModels/ProjectSCIM.ts +451 -0
  3. package/Models/DatabaseModels/StatusPageSCIM.ts +469 -0
  4. package/Server/EnvironmentConfig.ts +9 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1754304193228-MigrationName.ts +67 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/1754315774827-MigrationName.ts +17 -0
  7. package/Server/Infrastructure/Postgres/SchemaMigrations/1754384418632-MigrationName.ts +63 -0
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
  9. package/Server/Infrastructure/Queue.ts +1 -1
  10. package/Server/Middleware/SCIMAuthorization.ts +127 -0
  11. package/Server/Services/ProjectSCIMService.ts +27 -0
  12. package/Server/Services/StatusPageSCIMService.ts +27 -0
  13. package/Server/Utils/StartServer.ts +10 -0
  14. package/build/dist/Models/DatabaseModels/Index.js +5 -0
  15. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  16. package/build/dist/Models/DatabaseModels/ProjectSCIM.js +467 -0
  17. package/build/dist/Models/DatabaseModels/ProjectSCIM.js.map +1 -0
  18. package/build/dist/Models/DatabaseModels/StatusPageSCIM.js +492 -0
  19. package/build/dist/Models/DatabaseModels/StatusPageSCIM.js.map +1 -0
  20. package/build/dist/Server/EnvironmentConfig.js +3 -1
  21. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  22. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754304193228-MigrationName.js +30 -0
  23. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754304193228-MigrationName.js.map +1 -0
  24. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754315774827-MigrationName.js +12 -0
  25. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754315774827-MigrationName.js.map +1 -0
  26. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754384418632-MigrationName.js +28 -0
  27. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754384418632-MigrationName.js.map +1 -0
  28. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
  29. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  30. package/build/dist/Server/Infrastructure/Queue.js +1 -1
  31. package/build/dist/Server/Middleware/SCIMAuthorization.js +111 -0
  32. package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -0
  33. package/build/dist/Server/Services/ProjectSCIMService.js +20 -0
  34. package/build/dist/Server/Services/ProjectSCIMService.js.map +1 -0
  35. package/build/dist/Server/Services/StatusPageSCIMService.js +20 -0
  36. package/build/dist/Server/Services/StatusPageSCIMService.js.map +1 -0
  37. package/build/dist/Server/Utils/StartServer.js +9 -0
  38. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  39. package/package.json +1 -1
@@ -114,6 +114,7 @@ import StatusPageOwnerTeam from "./StatusPageOwnerTeam";
114
114
  import StatusPageOwnerUser from "./StatusPageOwnerUser";
115
115
  import StatusPagePrivateUser from "./StatusPagePrivateUser";
116
116
  import StatusPageResource from "./StatusPageResource";
117
+ import StatusPageSCIM from "./StatusPageSCIM";
117
118
  import StatusPageSSO from "./StatusPageSso";
118
119
  import StatusPageSubscriber from "./StatusPageSubscriber";
119
120
  // Team
@@ -179,6 +180,7 @@ import ProjectUser from "./ProjectUser";
179
180
  import OnCallDutyPolicyUserOverride from "./OnCallDutyPolicyUserOverride";
180
181
  import MonitorFeed from "./MonitorFeed";
181
182
  import MetricType from "./MetricType";
183
+ import ProjectSCIM from "./ProjectSCIM";
182
184
 
183
185
  const AllModelTypes: Array<{
184
186
  new (): BaseModel;
@@ -276,6 +278,7 @@ const AllModelTypes: Array<{
276
278
 
277
279
  ProjectSSO,
278
280
  StatusPageSSO,
281
+ StatusPageSCIM,
279
282
 
280
283
  MonitorProbe,
281
284
 
@@ -380,6 +383,10 @@ const AllModelTypes: Array<{
380
383
  MetricType,
381
384
 
382
385
  OnCallDutyPolicyTimeLog,
386
+
387
+ ProjectSCIM,
388
+
389
+ StatusPageSCIM,
383
390
  ];
384
391
 
385
392
  const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
@@ -0,0 +1,451 @@
1
+ import Project from "./Project";
2
+ import Team from "./Team";
3
+ import User from "./User";
4
+ import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
5
+ import Route from "../../Types/API/Route";
6
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
7
+ import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
8
+ import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
9
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
10
+ import ColumnLength from "../../Types/Database/ColumnLength";
11
+ import ColumnType from "../../Types/Database/ColumnType";
12
+ import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
+ import TableColumn from "../../Types/Database/TableColumn";
14
+ import TableColumnType from "../../Types/Database/TableColumnType";
15
+ import TableMetadata from "../../Types/Database/TableMetadata";
16
+ import TenantColumn from "../../Types/Database/TenantColumn";
17
+ import UniqueColumnBy from "../../Types/Database/UniqueColumnBy";
18
+ import IconProp from "../../Types/Icon/IconProp";
19
+ import ObjectID from "../../Types/ObjectID";
20
+ import Permission from "../../Types/Permission";
21
+ import {
22
+ Column,
23
+ Entity,
24
+ Index,
25
+ JoinColumn,
26
+ JoinTable,
27
+ ManyToMany,
28
+ ManyToOne,
29
+ } from "typeorm";
30
+
31
+ @TableBillingAccessControl({
32
+ create: PlanType.Scale,
33
+ read: PlanType.Scale,
34
+ update: PlanType.Scale,
35
+ delete: PlanType.Scale,
36
+ })
37
+ @TenantColumn("projectId")
38
+ @TableAccessControl({
39
+ create: [
40
+ Permission.ProjectOwner,
41
+ Permission.ProjectAdmin,
42
+ Permission.CreateProjectSSO,
43
+ ],
44
+ read: [
45
+ Permission.ProjectOwner,
46
+ Permission.ProjectAdmin,
47
+ Permission.ProjectMember,
48
+ Permission.ReadProjectSSO,
49
+ ],
50
+ delete: [
51
+ Permission.ProjectOwner,
52
+ Permission.ProjectAdmin,
53
+ Permission.DeleteProjectSSO,
54
+ ],
55
+ update: [
56
+ Permission.ProjectOwner,
57
+ Permission.ProjectAdmin,
58
+ Permission.EditProjectSSO,
59
+ ],
60
+ })
61
+ @CrudApiEndpoint(new Route("/project-scim"))
62
+ @TableMetadata({
63
+ tableName: "ProjectSCIM",
64
+ singularName: "SCIM",
65
+ pluralName: "SCIM",
66
+ icon: IconProp.Lock,
67
+ tableDescription: "Manage SCIM auto-provisioning for your project",
68
+ })
69
+ @Entity({
70
+ name: "ProjectSCIM",
71
+ })
72
+ export default class ProjectSCIM extends BaseModel {
73
+ @ColumnAccessControl({
74
+ create: [
75
+ Permission.ProjectOwner,
76
+ Permission.ProjectAdmin,
77
+ Permission.CreateProjectSSO,
78
+ ],
79
+ read: [
80
+ Permission.ProjectOwner,
81
+ Permission.ProjectAdmin,
82
+ Permission.ProjectMember,
83
+ Permission.ReadProjectSSO,
84
+ ],
85
+ update: [],
86
+ })
87
+ @TableColumn({
88
+ manyToOneRelationColumn: "projectId",
89
+ type: TableColumnType.Entity,
90
+ modelType: Project,
91
+ title: "Project",
92
+ description: "Relation to Project Resource in which this object belongs",
93
+ })
94
+ @ManyToOne(
95
+ () => {
96
+ return Project;
97
+ },
98
+ {
99
+ eager: false,
100
+ nullable: true,
101
+ onDelete: "CASCADE",
102
+ orphanedRowAction: "nullify",
103
+ },
104
+ )
105
+ @JoinColumn({ name: "projectId" })
106
+ public project?: Project = undefined;
107
+
108
+ @ColumnAccessControl({
109
+ create: [
110
+ Permission.ProjectOwner,
111
+ Permission.ProjectAdmin,
112
+ Permission.CreateProjectSSO,
113
+ ],
114
+ read: [
115
+ Permission.ProjectOwner,
116
+ Permission.ProjectAdmin,
117
+ Permission.ProjectMember,
118
+ Permission.ReadProjectSSO,
119
+ ],
120
+ update: [],
121
+ })
122
+ @Index()
123
+ @TableColumn({
124
+ type: TableColumnType.ObjectID,
125
+ required: true,
126
+ canReadOnRelationQuery: true,
127
+ title: "Project ID",
128
+ description: "ID of your OneUptime Project in which this object belongs",
129
+ })
130
+ @Column({
131
+ type: ColumnType.ObjectID,
132
+ nullable: false,
133
+ transformer: ObjectID.getDatabaseTransformer(),
134
+ })
135
+ public projectId?: ObjectID = undefined;
136
+
137
+ @ColumnAccessControl({
138
+ create: [
139
+ Permission.ProjectOwner,
140
+ Permission.ProjectAdmin,
141
+ Permission.CreateProjectSSO,
142
+ ],
143
+ read: [
144
+ Permission.ProjectOwner,
145
+ Permission.ProjectAdmin,
146
+ Permission.ProjectMember,
147
+ Permission.ReadProjectSSO,
148
+ ],
149
+ update: [
150
+ Permission.ProjectOwner,
151
+ Permission.ProjectAdmin,
152
+ Permission.EditProjectSSO,
153
+ ],
154
+ })
155
+ @TableColumn({
156
+ required: true,
157
+ type: TableColumnType.ShortText,
158
+ canReadOnRelationQuery: true,
159
+ title: "Name",
160
+ description: "Any friendly name for this SCIM configuration",
161
+ })
162
+ @Column({
163
+ nullable: false,
164
+ type: ColumnType.ShortText,
165
+ length: ColumnLength.ShortText,
166
+ })
167
+ @UniqueColumnBy("projectId")
168
+ public name?: string = undefined;
169
+
170
+ @ColumnAccessControl({
171
+ create: [
172
+ Permission.ProjectOwner,
173
+ Permission.ProjectAdmin,
174
+ Permission.CreateProjectSSO,
175
+ ],
176
+ read: [
177
+ Permission.ProjectOwner,
178
+ Permission.ProjectAdmin,
179
+ Permission.ProjectMember,
180
+ Permission.ReadProjectSSO,
181
+ ],
182
+ update: [
183
+ Permission.ProjectOwner,
184
+ Permission.ProjectAdmin,
185
+ Permission.EditProjectSSO,
186
+ ],
187
+ })
188
+ @TableColumn({
189
+ required: false,
190
+ type: TableColumnType.LongText,
191
+ title: "Description",
192
+ description: "Friendly description to help you remember",
193
+ })
194
+ @Column({
195
+ nullable: true,
196
+ type: ColumnType.LongText,
197
+ length: ColumnLength.LongText,
198
+ })
199
+ public description?: string = undefined;
200
+
201
+ @ColumnAccessControl({
202
+ create: [
203
+ Permission.ProjectOwner,
204
+ Permission.ProjectAdmin,
205
+ Permission.CreateProjectSSO,
206
+ ],
207
+ read: [
208
+ Permission.ProjectOwner,
209
+ Permission.ProjectAdmin,
210
+ Permission.ReadProjectSSO,
211
+ ],
212
+ update: [
213
+ Permission.ProjectOwner,
214
+ Permission.ProjectAdmin,
215
+ Permission.EditProjectSSO,
216
+ ],
217
+ })
218
+ @TableColumn({
219
+ required: true,
220
+ type: TableColumnType.LongText,
221
+ title: "Bearer Token",
222
+ description: "Bearer token for SCIM authentication. Keep this secure.",
223
+ })
224
+ @Column({
225
+ nullable: false,
226
+ type: ColumnType.LongText,
227
+ length: ColumnLength.LongText,
228
+ })
229
+ public bearerToken?: string = undefined;
230
+
231
+ @ColumnAccessControl({
232
+ create: [
233
+ Permission.ProjectOwner,
234
+ Permission.ProjectAdmin,
235
+ Permission.CreateProjectSSO,
236
+ ],
237
+ read: [
238
+ Permission.ProjectOwner,
239
+ Permission.ProjectAdmin,
240
+ Permission.ProjectMember,
241
+ Permission.ReadProjectSSO,
242
+ ],
243
+ update: [
244
+ Permission.ProjectOwner,
245
+ Permission.ProjectAdmin,
246
+ Permission.EditProjectSSO,
247
+ ],
248
+ })
249
+ @TableColumn({
250
+ required: false,
251
+ type: TableColumnType.EntityArray,
252
+ modelType: Team,
253
+ title: "Default Teams",
254
+ description: "Default teams that new users will be added to via SCIM",
255
+ })
256
+ @ManyToMany(
257
+ () => {
258
+ return Team;
259
+ },
260
+ { eager: false },
261
+ )
262
+ @JoinTable({
263
+ name: "ProjectScimTeam",
264
+ inverseJoinColumn: {
265
+ name: "teamId",
266
+ referencedColumnName: "_id",
267
+ },
268
+ joinColumn: {
269
+ name: "projectScimId",
270
+ referencedColumnName: "_id",
271
+ },
272
+ })
273
+ public teams?: Array<Team> = undefined;
274
+
275
+ @ColumnAccessControl({
276
+ create: [
277
+ Permission.ProjectOwner,
278
+ Permission.ProjectAdmin,
279
+ Permission.CreateProjectSSO,
280
+ ],
281
+ read: [
282
+ Permission.ProjectOwner,
283
+ Permission.ProjectAdmin,
284
+ Permission.ProjectMember,
285
+ Permission.ReadProjectSSO,
286
+ ],
287
+ update: [
288
+ Permission.ProjectOwner,
289
+ Permission.ProjectAdmin,
290
+ Permission.EditProjectSSO,
291
+ ],
292
+ })
293
+ @TableColumn({
294
+ isDefaultValueColumn: true,
295
+ type: TableColumnType.Boolean,
296
+ title: "Auto Provision Users",
297
+ description: "Automatically create users when they are added via SCIM",
298
+ defaultValue: true,
299
+ })
300
+ @Column({
301
+ type: ColumnType.Boolean,
302
+ default: true,
303
+ })
304
+ public autoProvisionUsers?: boolean = undefined;
305
+
306
+ @ColumnAccessControl({
307
+ create: [
308
+ Permission.ProjectOwner,
309
+ Permission.ProjectAdmin,
310
+ Permission.CreateProjectSSO,
311
+ ],
312
+ read: [
313
+ Permission.ProjectOwner,
314
+ Permission.ProjectAdmin,
315
+ Permission.ProjectMember,
316
+ Permission.ReadProjectSSO,
317
+ ],
318
+ update: [
319
+ Permission.ProjectOwner,
320
+ Permission.ProjectAdmin,
321
+ Permission.EditProjectSSO,
322
+ ],
323
+ })
324
+ @TableColumn({
325
+ isDefaultValueColumn: true,
326
+ type: TableColumnType.Boolean,
327
+ title: "Auto Deprovision Users",
328
+ description: "Automatically remove users when they are removed via SCIM",
329
+ defaultValue: true,
330
+ })
331
+ @Column({
332
+ type: ColumnType.Boolean,
333
+ default: true,
334
+ })
335
+ public autoDeprovisionUsers?: boolean = undefined;
336
+
337
+ @ColumnAccessControl({
338
+ create: [],
339
+ read: [
340
+ Permission.ProjectOwner,
341
+ Permission.ProjectAdmin,
342
+ Permission.ProjectMember,
343
+ Permission.ReadProjectSSO,
344
+ ],
345
+ update: [],
346
+ })
347
+ @TableColumn({
348
+ manyToOneRelationColumn: "createdByUserId",
349
+ type: TableColumnType.Entity,
350
+ modelType: User,
351
+ title: "Created by User",
352
+ description:
353
+ "Relation to User who created this object (if this object was created by a User)",
354
+ })
355
+ @ManyToOne(
356
+ () => {
357
+ return User;
358
+ },
359
+ {
360
+ eager: false,
361
+ nullable: true,
362
+ onDelete: "SET NULL",
363
+ orphanedRowAction: "nullify",
364
+ },
365
+ )
366
+ @JoinColumn({ name: "createdByUserId" })
367
+ public createdByUser?: User = undefined;
368
+
369
+ @ColumnAccessControl({
370
+ create: [
371
+ Permission.ProjectOwner,
372
+ Permission.ProjectAdmin,
373
+ Permission.CreateProjectSSO,
374
+ ],
375
+ read: [
376
+ Permission.ProjectOwner,
377
+ Permission.ProjectAdmin,
378
+ Permission.ProjectMember,
379
+ Permission.ReadProjectSSO,
380
+ ],
381
+ update: [],
382
+ })
383
+ @TableColumn({
384
+ type: TableColumnType.ObjectID,
385
+ title: "Created by User ID",
386
+ description:
387
+ "User ID who created this object (if this object was created by a User)",
388
+ })
389
+ @Column({
390
+ type: ColumnType.ObjectID,
391
+ nullable: true,
392
+ transformer: ObjectID.getDatabaseTransformer(),
393
+ })
394
+ public createdByUserId?: ObjectID = undefined;
395
+
396
+ @ColumnAccessControl({
397
+ create: [],
398
+ read: [
399
+ Permission.ProjectOwner,
400
+ Permission.ProjectAdmin,
401
+ Permission.ProjectMember,
402
+ Permission.ReadProjectSSO,
403
+ ],
404
+ update: [],
405
+ })
406
+ @TableColumn({
407
+ manyToOneRelationColumn: "deletedByUserId",
408
+ type: TableColumnType.Entity,
409
+ modelType: User,
410
+ title: "Deleted by User",
411
+ description:
412
+ "Relation to User who deleted this object (if this object was deleted by a User)",
413
+ })
414
+ @ManyToOne(
415
+ () => {
416
+ return User;
417
+ },
418
+ {
419
+ cascade: false,
420
+ eager: false,
421
+ nullable: true,
422
+ onDelete: "SET NULL",
423
+ orphanedRowAction: "nullify",
424
+ },
425
+ )
426
+ @JoinColumn({ name: "deletedByUserId" })
427
+ public deletedByUser?: User = undefined;
428
+
429
+ @ColumnAccessControl({
430
+ create: [],
431
+ read: [
432
+ Permission.ProjectOwner,
433
+ Permission.ProjectAdmin,
434
+ Permission.ProjectMember,
435
+ Permission.ReadProjectSSO,
436
+ ],
437
+ update: [],
438
+ })
439
+ @TableColumn({
440
+ type: TableColumnType.ObjectID,
441
+ title: "Deleted by User ID",
442
+ description:
443
+ "User ID who deleted this object (if this object was deleted by a User)",
444
+ })
445
+ @Column({
446
+ type: ColumnType.ObjectID,
447
+ nullable: true,
448
+ transformer: ObjectID.getDatabaseTransformer(),
449
+ })
450
+ public deletedByUserId?: ObjectID = undefined;
451
+ }