@oneuptime/common 10.0.35 → 10.0.37
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/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/WorkspaceNotificationSummary.ts +819 -0
- package/Server/API/StatusPageAPI.ts +7 -0
- package/Server/API/WorkspaceNotificationSummaryAPI.ts +67 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/{1773761409952-MigrationName.ts → 1774000000001-MigrationName.ts} +2 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774355321449-MigrationName.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774357353502-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -2
- package/Server/Middleware/MasterAdminAuthorization.ts +55 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/WorkspaceNotificationSummaryService.ts +1450 -0
- package/Server/Types/Markdown.ts +11 -3
- package/Server/Utils/Greenlock/Greenlock.ts +1 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +4 -1
- package/Types/Code/CodeType.ts +1 -1
- package/Types/Metrics/MetricQueryConfigData.ts +1 -0
- package/Types/Monitor/CriteriaFilter.ts +19 -0
- package/Types/Monitor/KubernetesAlertTemplates.ts +703 -0
- package/Types/Monitor/KubernetesMetricCatalog.ts +347 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +86 -0
- package/Types/Monitor/MonitorStep.ts +36 -1
- package/Types/Monitor/MonitorStepKubernetesMonitor.ts +50 -0
- package/Types/Monitor/MonitorType.ts +14 -10
- package/Types/Permission.ts +42 -0
- package/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.ts +13 -0
- package/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryType.ts +8 -0
- package/UI/Components/AlertBanner/AlertBanner.tsx +69 -0
- package/UI/Components/ConditionsTable/ConditionsTable.tsx +149 -0
- package/UI/Components/Dictionary/DictionaryOfStingsViewer.tsx +35 -15
- package/UI/Components/ExpandableText/ExpandableText.tsx +42 -0
- package/UI/Components/FilterButtons/FilterButtons.tsx +60 -0
- package/UI/Components/GanttChart/Bar/Index.tsx +23 -5
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +4 -1
- package/UI/Components/ResourceUsageBar/ResourceUsageBar.tsx +58 -0
- package/UI/Components/StackedProgressBar/StackedProgressBar.tsx +81 -0
- package/UI/Components/StatusBadge/StatusBadge.tsx +44 -0
- package/UI/Components/Tabs/Tabs.tsx +36 -8
- package/UI/Utils/Dropdown.ts +2 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationSummary.js +857 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationSummary.js.map +1 -0
- package/build/dist/Server/API/StatusPageAPI.js +2 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/WorkspaceNotificationSummaryAPI.js +40 -0
- package/build/dist/Server/API/WorkspaceNotificationSummaryAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/{1773761409952-MigrationName.js → 1774000000001-MigrationName.js} +3 -3
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/{1773761409952-MigrationName.js.map → 1774000000001-MigrationName.js.map} +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774355321449-MigrationName.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774355321449-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774357353502-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774357353502-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -2
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js +25 -0
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -0
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +1122 -0
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -0
- package/build/dist/Server/Types/Markdown.js +10 -2
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +1 -0
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +2 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Types/Code/CodeType.js +1 -1
- package/build/dist/Types/Code/CodeType.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +18 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +594 -0
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -0
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js +311 -0
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +78 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +24 -1
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepKubernetesMonitor.js +30 -0
- package/build/dist/Types/Monitor/MonitorStepKubernetesMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +13 -10
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Permission.js +36 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js +14 -0
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryType.js +9 -0
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryType.js.map +1 -0
- package/build/dist/UI/Components/AlertBanner/AlertBanner.js +42 -0
- package/build/dist/UI/Components/AlertBanner/AlertBanner.js.map +1 -0
- package/build/dist/UI/Components/ConditionsTable/ConditionsTable.js +83 -0
- package/build/dist/UI/Components/ConditionsTable/ConditionsTable.js.map +1 -0
- package/build/dist/UI/Components/Dictionary/DictionaryOfStingsViewer.js +14 -8
- package/build/dist/UI/Components/Dictionary/DictionaryOfStingsViewer.js.map +1 -1
- package/build/dist/UI/Components/ExpandableText/ExpandableText.js +19 -0
- package/build/dist/UI/Components/ExpandableText/ExpandableText.js.map +1 -0
- package/build/dist/UI/Components/FilterButtons/FilterButtons.js +17 -0
- package/build/dist/UI/Components/FilterButtons/FilterButtons.js.map +1 -0
- package/build/dist/UI/Components/GanttChart/Bar/Index.js +15 -3
- package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +3 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
- package/build/dist/UI/Components/ResourceUsageBar/ResourceUsageBar.js +23 -0
- package/build/dist/UI/Components/ResourceUsageBar/ResourceUsageBar.js.map +1 -0
- package/build/dist/UI/Components/StackedProgressBar/StackedProgressBar.js +34 -0
- package/build/dist/UI/Components/StackedProgressBar/StackedProgressBar.js.map +1 -0
- package/build/dist/UI/Components/StatusBadge/StatusBadge.js +22 -0
- package/build/dist/UI/Components/StatusBadge/StatusBadge.js.map +1 -0
- package/build/dist/UI/Components/Tabs/Tabs.js +32 -9
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Utils/Dropdown.js +2 -1
- package/build/dist/UI/Utils/Dropdown.js.map +1 -1
- package/package.json +1 -1
|
@@ -718,6 +718,10 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
718
718
|
.getCrudApiPath()
|
|
719
719
|
?.toString()}/.well-known/acme-challenge/:token`,
|
|
720
720
|
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
721
|
+
logger.debug(
|
|
722
|
+
`ACME challenge validation request received for token: ${req.params["token"]} from host: ${req.headers["host"]}`,
|
|
723
|
+
);
|
|
724
|
+
|
|
721
725
|
const challenge: AcmeChallenge | null =
|
|
722
726
|
await AcmeChallengeService.findOneBy({
|
|
723
727
|
query: {
|
|
@@ -732,6 +736,9 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
732
736
|
});
|
|
733
737
|
|
|
734
738
|
if (!challenge) {
|
|
739
|
+
logger.error(
|
|
740
|
+
`ACME challenge not found for token: ${req.params["token"]} from host: ${req.headers["host"]}`,
|
|
741
|
+
);
|
|
735
742
|
return Response.sendErrorResponse(
|
|
736
743
|
req,
|
|
737
744
|
res,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
2
|
+
import WorkspaceNotificationSummaryService, {
|
|
3
|
+
Service as WorkspaceNotificationSummaryServiceType,
|
|
4
|
+
} from "../Services/WorkspaceNotificationSummaryService";
|
|
5
|
+
import {
|
|
6
|
+
ExpressRequest,
|
|
7
|
+
ExpressResponse,
|
|
8
|
+
NextFunction,
|
|
9
|
+
} from "../Utils/Express";
|
|
10
|
+
import Response from "../Utils/Response";
|
|
11
|
+
import BaseAPI from "./BaseAPI";
|
|
12
|
+
import CommonAPI from "./CommonAPI";
|
|
13
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
14
|
+
import WorkspaceNotificationSummary from "../../Models/DatabaseModels/WorkspaceNotificationSummary";
|
|
15
|
+
import ObjectID from "../../Types/ObjectID";
|
|
16
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
17
|
+
|
|
18
|
+
export default class WorkspaceNotificationSummaryAPI extends BaseAPI<
|
|
19
|
+
WorkspaceNotificationSummary,
|
|
20
|
+
WorkspaceNotificationSummaryServiceType
|
|
21
|
+
> {
|
|
22
|
+
public constructor() {
|
|
23
|
+
super(WorkspaceNotificationSummary, WorkspaceNotificationSummaryService);
|
|
24
|
+
|
|
25
|
+
this.router.post(
|
|
26
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/test/:workspaceNotificationSummaryId`,
|
|
27
|
+
UserMiddleware.getUserMiddleware,
|
|
28
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
29
|
+
try {
|
|
30
|
+
const databaseProps: DatabaseCommonInteractionProps =
|
|
31
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
32
|
+
|
|
33
|
+
const summaryId: ObjectID = new ObjectID(
|
|
34
|
+
req.params["workspaceNotificationSummaryId"] as string,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// Verify the summary belongs to the user's project
|
|
38
|
+
const summary: WorkspaceNotificationSummary | null =
|
|
39
|
+
await this.service.findOneById({
|
|
40
|
+
id: summaryId,
|
|
41
|
+
select: { projectId: true },
|
|
42
|
+
props: databaseProps,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (!summary) {
|
|
46
|
+
return Response.sendErrorResponse(
|
|
47
|
+
req,
|
|
48
|
+
res,
|
|
49
|
+
new BadDataException("Summary not found or access denied"),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
await this.service.testSummary({
|
|
54
|
+
summaryId: summaryId,
|
|
55
|
+
props: databaseProps,
|
|
56
|
+
projectId: databaseProps.tenantId!,
|
|
57
|
+
testByUserId: databaseProps.userId!,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return Response.sendEmptySuccessResponse(req, res);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
next(e);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
2
|
|
|
3
|
-
export class
|
|
4
|
-
public name = "
|
|
3
|
+
export class MigrationName1774000000001 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1774000000001";
|
|
5
5
|
|
|
6
6
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
7
|
await queryRunner.query(
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1774355321449 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1774355321449";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "WorkspaceNotificationSummary" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(500) NOT NULL, "description" character varying(500), "workspaceType" character varying(500) NOT NULL, "summaryType" character varying NOT NULL, "recurringInterval" jsonb NOT NULL, "numberOfDaysOfData" integer NOT NULL DEFAULT '7', "channelNames" jsonb NOT NULL, "teamName" character varying(500), "summaryItems" jsonb NOT NULL, "filters" jsonb, "filterCondition" character varying, "nextSendAt" TIMESTAMP WITH TIME ZONE, "lastSentAt" TIMESTAMP WITH TIME ZONE, "isEnabled" boolean NOT NULL DEFAULT true, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_c5bb0f644c5279e3781177ce819" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_d7f80977bcbac1b82c2beacc27" ON "WorkspaceNotificationSummary" ("projectId") `,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "WorkspaceNotificationSummary" ADD CONSTRAINT "FK_d7f80977bcbac1b82c2beacc271" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "WorkspaceNotificationSummary" ADD CONSTRAINT "FK_f9c24022445dbea5d8b2d104302" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "WorkspaceNotificationSummary" ADD CONSTRAINT "FK_a9f1c0c0d88abf1795d1c93c138" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "WorkspaceNotificationSummary" DROP CONSTRAINT "FK_a9f1c0c0d88abf1795d1c93c138"`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "WorkspaceNotificationSummary" DROP CONSTRAINT "FK_f9c24022445dbea5d8b2d104302"`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "WorkspaceNotificationSummary" DROP CONSTRAINT "FK_d7f80977bcbac1b82c2beacc271"`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`DROP INDEX "public"."IDX_d7f80977bcbac1b82c2beacc27"`,
|
|
48
|
+
);
|
|
49
|
+
await queryRunner.query(`DROP TABLE "WorkspaceNotificationSummary"`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1774357353502 implements MigrationInterface {
|
|
4
|
+
public name: string = "MigrationName1774357353502";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "WorkspaceNotificationSummary" ADD "sendFirstReportAt" TIMESTAMP WITH TIME ZONE`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "WorkspaceNotificationSummary" DROP COLUMN "sendFirstReportAt"`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -267,7 +267,9 @@ import { MigrationName1773344537755 } from "./1773344537755-MigrationName";
|
|
|
267
267
|
import { MigrationName1773402621107 } from "./1773402621107-MigrationName";
|
|
268
268
|
import { MigrationName1773676206197 } from "./1773676206197-MigrationName";
|
|
269
269
|
import { MigrationName1774000000000 } from "./1774000000000-MigrationName";
|
|
270
|
-
import {
|
|
270
|
+
import { MigrationName1774000000001 } from "./1774000000001-MigrationName";
|
|
271
|
+
import { MigrationName1774355321449 } from "./1774355321449-MigrationName";
|
|
272
|
+
import { MigrationName1774357353502 } from "./1774357353502-MigrationName";
|
|
271
273
|
|
|
272
274
|
export default [
|
|
273
275
|
InitialMigration,
|
|
@@ -539,5 +541,7 @@ export default [
|
|
|
539
541
|
MigrationName1773402621107,
|
|
540
542
|
MigrationName1773676206197,
|
|
541
543
|
MigrationName1774000000000,
|
|
542
|
-
|
|
544
|
+
MigrationName1774000000001,
|
|
545
|
+
MigrationName1774355321449,
|
|
546
|
+
MigrationName1774357353502,
|
|
543
547
|
];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import UserMiddleware from "./UserAuthorization";
|
|
2
|
+
import JSONWebToken from "../Utils/JsonWebToken";
|
|
3
|
+
import Response from "../Utils/Response";
|
|
4
|
+
import {
|
|
5
|
+
ExpressRequest,
|
|
6
|
+
ExpressResponse,
|
|
7
|
+
NextFunction,
|
|
8
|
+
} from "../Utils/Express";
|
|
9
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
10
|
+
import JSONWebTokenData from "../../Types/JsonWebTokenData";
|
|
11
|
+
|
|
12
|
+
export default class MasterAdminAuthorization {
|
|
13
|
+
public static async isAuthorizedMasterAdminMiddleware(
|
|
14
|
+
req: ExpressRequest,
|
|
15
|
+
res: ExpressResponse,
|
|
16
|
+
next: NextFunction,
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
try {
|
|
19
|
+
const accessToken: string | undefined =
|
|
20
|
+
UserMiddleware.getAccessTokenFromExpressRequest(req);
|
|
21
|
+
|
|
22
|
+
if (!accessToken) {
|
|
23
|
+
Response.sendErrorResponse(
|
|
24
|
+
req,
|
|
25
|
+
res,
|
|
26
|
+
new NotAuthorizedException("Unauthorized: Access token is required."),
|
|
27
|
+
);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const authData: JSONWebTokenData = JSONWebToken.decode(accessToken);
|
|
32
|
+
|
|
33
|
+
if (!authData.isMasterAdmin) {
|
|
34
|
+
Response.sendErrorResponse(
|
|
35
|
+
req,
|
|
36
|
+
res,
|
|
37
|
+
new NotAuthorizedException(
|
|
38
|
+
"Unauthorized: Only master admins can perform this action.",
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
next();
|
|
45
|
+
} catch {
|
|
46
|
+
Response.sendErrorResponse(
|
|
47
|
+
req,
|
|
48
|
+
res,
|
|
49
|
+
new NotAuthorizedException(
|
|
50
|
+
"Unauthorized: Invalid or expired access token.",
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/Server/Services/Index.ts
CHANGED
|
@@ -198,6 +198,7 @@ import WorkspaceUserAuthTokenService from "./WorkspaceUserAuthTokenService";
|
|
|
198
198
|
import WorkspaceSettingService from "./WorkspaceSettingService";
|
|
199
199
|
import WorkspaceNotificationRuleService from "./WorkspaceNotificationRuleService";
|
|
200
200
|
import WorkspaceNotificationLogService from "./WorkspaceNotificationLogService";
|
|
201
|
+
import WorkspaceNotificationSummaryService from "./WorkspaceNotificationSummaryService";
|
|
201
202
|
import OnCallDutyPolicyUserOverrideService from "./OnCallDutyPolicyUserOverrideService";
|
|
202
203
|
|
|
203
204
|
import MonitorLogService from "./MonitorLogService";
|
|
@@ -416,6 +417,7 @@ const services: Array<BaseService> = [
|
|
|
416
417
|
WorkspaceSettingService,
|
|
417
418
|
WorkspaceNotificationRuleService,
|
|
418
419
|
WorkspaceNotificationLogService,
|
|
420
|
+
WorkspaceNotificationSummaryService,
|
|
419
421
|
|
|
420
422
|
ProjectSCIMLogService,
|
|
421
423
|
StatusPageSCIMLogService,
|