@oneuptime/common 12.0.27 → 12.0.29
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/AnalyticsModels/RumSessionChunk.ts +52 -0
- package/Models/DatabaseModels/CloudResource.ts +17 -1
- package/Models/DatabaseModels/DashboardDomain.ts +43 -0
- package/Models/DatabaseModels/MonitorTemplate.ts +15 -3
- package/Models/DatabaseModels/RumApplication.ts +35 -2
- package/Models/DatabaseModels/StatusPageDomain.ts +43 -0
- package/Server/API/DashboardDomainAPI.ts +74 -0
- package/Server/API/MicrosoftTeamsAPI.ts +81 -180
- package/Server/API/StatusPageDomainAPI.ts +74 -0
- package/Server/API/TelemetryAPI.ts +104 -15
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.ts +43 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.ts +40 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/ProjectAuthorization.ts +6 -1
- package/Server/Services/DashboardDomainService.ts +131 -0
- package/Server/Services/LogPipelineProcessorService.ts +88 -0
- package/Server/Services/MonitorTemplateService.ts +70 -11
- package/Server/Services/StatusPageDomainService.ts +163 -3
- package/Server/Services/StatusPagePrivateUserSessionService.ts +197 -56
- package/Server/Types/Domain.ts +17 -0
- package/Server/Utils/APIKey/AccessPermission.ts +24 -0
- package/Server/Utils/Greenlock/Greenlock.ts +156 -58
- package/Server/Utils/LogPipelineProcessorValidation.ts +112 -0
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.ts +1094 -45
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +153 -17
- package/Server/Utils/SessionReplay/SessionReplayGateCache.ts +12 -5
- package/Server/Utils/SessionReplay/SessionReplayIdentity.ts +102 -0
- package/Server/Utils/SessionReplay/SessionReplayReadService.ts +11 -2
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +0 -170
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.ts +158 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +35 -13
- package/Tests/App/Dashboard/MonitorTemplateColumnAndFacet.test.tsx +505 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeBootstrap.test.ts +106 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeUtil.test.ts +84 -0
- package/Tests/App/StatusPage/StatusPageRedirectSafety.test.ts +119 -0
- package/Tests/Models/DatabaseModels/SessionReplayModels.test.ts +81 -0
- package/Tests/Models/MonitorTemplateMonitorNameColumn.test.ts +258 -0
- package/Tests/Server/API/CustomDomainReissueSslAPI.test.ts +469 -0
- package/Tests/Server/API/MicrosoftTeamsBotMessagesEndpoint.test.ts +729 -0
- package/Tests/Server/API/MicrosoftTeamsBotTestEndpoint.test.ts +26 -0
- package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +402 -0
- package/Tests/Server/API/SessionReplayAPI.test.ts +232 -0
- package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +4 -0
- package/Tests/Server/Services/AddCertificateReissueRequestedAtToDomainsMigration.test.ts +287 -0
- package/Tests/Server/Services/CustomDomainCertificateReissue.test.ts +477 -0
- package/Tests/Server/Services/LogPipelineProcessorSaveValidation.test.ts +249 -0
- package/Tests/Server/Services/MonitorTemplateServiceBulkSync.test.ts +549 -0
- package/Tests/Server/Services/MonitorTemplateServiceNetworkDeviceSync.test.ts +16 -3
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +57 -0
- package/Tests/Server/Services/SecurityEventLastErrorColumnWidth.test.ts +151 -15
- package/Tests/Server/Services/StatusPagePrivateUserSessionService.test.ts +587 -0
- package/Tests/Server/Types/Database/Permissions/ApiKeyFileAccess.test.ts +286 -0
- package/Tests/Server/Types/Database/Permissions/MonitorTemplateColumnAccess.test.ts +328 -0
- package/Tests/Server/Types/Database/QueryHelperFindWithSameTextAndIsNull.test.ts +83 -0
- package/Tests/Server/Utils/AI/SRE/ConfidenceSignal.test.ts +377 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +16 -1
- package/Tests/Server/Utils/Greenlock/CertificateRenewalSchedule.test.ts +250 -0
- package/Tests/Server/Utils/LogPipelineProcessorValidation.test.ts +198 -0
- package/Tests/Server/Utils/SecurityEvent/ConnectorErrorMessage.test.ts +48 -9
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsAuth.test.ts +726 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsClient.test.ts +74 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsErrorHandling.test.ts +1107 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +20 -3
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerFailureTaxonomy.test.ts +51 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerHardening.test.ts +1246 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsRequestContract.test.ts +961 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsResponseParsing.test.ts +653 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +880 -0
- package/Tests/Types/API/HTTPResponse.test.ts +175 -0
- package/Tests/Types/API/Route.test.ts +36 -4
- package/Tests/Types/Database/DatabaseProperty.test.ts +171 -0
- package/Tests/Types/DateLocalShortDateTimeString.test.ts +518 -0
- package/Tests/Types/DateLocalTimeString.test.ts +259 -0
- package/Tests/Types/DateUserPrefers12HourFormat.test.ts +316 -0
- package/Tests/UI/Components/LogsHistogram.test.tsx +41 -2
- package/Tests/UI/Components/LogsViewerEmptyStateTimeRange.test.tsx +212 -0
- package/Tests/UI/Components/TelemetryChartClockFormat.test.tsx +359 -0
- package/Tests/UI/Components/TimeRangePickerClockFormat.test.tsx +422 -0
- package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +146 -8
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsMessagingEndpointGuidance.test.tsx +520 -0
- package/Tests/UI/Utils/Navigation.test.ts +82 -0
- package/Tests/Utils/Array.test.ts +100 -0
- package/Tests/Utils/CertificateReissue.test.ts +225 -0
- package/Tests/Utils/Grok/Grok.test.ts +492 -0
- package/Tests/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.test.ts +181 -13
- package/Types/API/Route.ts +20 -5
- package/Types/Date.ts +143 -13
- package/Types/Rum/SessionReplay.ts +76 -1
- package/UI/Components/Date/TimeRangePickerDropdown.tsx +9 -5
- package/UI/Components/LogsViewer/LogsViewer.tsx +12 -7
- package/UI/Components/LogsViewer/components/HistogramTooltip.tsx +18 -17
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +21 -28
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.tsx +17 -16
- package/UI/Utils/Navigation.ts +42 -0
- package/Utils/Array.ts +37 -0
- package/Utils/CertificateReissue.ts +128 -0
- package/Utils/Grok/Grok.ts +461 -0
- package/Utils/Grok/GrokPatterns.ts +118 -0
- package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +58 -6
- package/build/dist/Models/AnalyticsModels/RumSessionChunk.js +48 -0
- package/build/dist/Models/AnalyticsModels/RumSessionChunk.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CloudResource.js +19 -2
- package/build/dist/Models/DatabaseModels/CloudResource.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DashboardDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js +17 -4
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RumApplication.js +37 -3
- package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Server/API/DashboardDomainAPI.js +43 -1
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +74 -118
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js +43 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +67 -14
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js +28 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +6 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +104 -0
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
- package/build/dist/Server/Services/LogPipelineProcessorService.js +65 -0
- package/build/dist/Server/Services/LogPipelineProcessorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +57 -11
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +132 -3
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js +112 -32
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js.map +1 -1
- package/build/dist/Server/Types/Domain.js +16 -0
- package/build/dist/Server/Types/Domain.js.map +1 -1
- package/build/dist/Server/Utils/APIKey/AccessPermission.js +24 -0
- package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +110 -35
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js +77 -0
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js +777 -36
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +108 -17
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCache.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayIdentity.js +59 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayIdentity.js.map +1 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js +9 -2
- package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +0 -159
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js +128 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +25 -13
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/API/Route.js +16 -5
- package/build/dist/Types/API/Route.js.map +1 -1
- package/build/dist/Types/Date.js +115 -13
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplay.js +38 -0
- package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +9 -5
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +12 -7
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js +15 -14
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +17 -22
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +2 -4
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +2 -4
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js +15 -14
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +30 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/Utils/Array.js +25 -0
- package/build/dist/Utils/Array.js.map +1 -1
- package/build/dist/Utils/CertificateReissue.js +97 -0
- package/build/dist/Utils/CertificateReissue.js.map +1 -0
- package/build/dist/Utils/Grok/Grok.js +324 -0
- package/build/dist/Utils/Grok/Grok.js.map +1 -0
- package/build/dist/Utils/Grok/GrokPatterns.js +112 -0
- package/build/dist/Utils/Grok/GrokPatterns.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +63 -3
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
- package/package.json +1 -1
- package/UI/Utils/JsonWebToken.ts +0 -14
- package/build/dist/UI/Utils/JsonWebToken.js +0 -10
- package/build/dist/UI/Utils/JsonWebToken.js.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import Alert from "../../../../../Models/DatabaseModels/Alert";
|
|
2
|
+
import Incident from "../../../../../Models/DatabaseModels/Incident";
|
|
3
|
+
import DatabaseCommonInteractionProps from "../../../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
4
|
+
import NotAuthorizedException from "../../../../../Types/Exception/NotAuthorizedException";
|
|
5
|
+
import ObjectID from "../../../../../Types/ObjectID";
|
|
6
|
+
import AlertService from "../../../../Services/AlertService";
|
|
7
|
+
import IncidentService from "../../../../Services/IncidentService";
|
|
8
|
+
import ModelPermission from "../../../../Types/Database/Permissions/Index";
|
|
9
|
+
import Query from "../../../../Types/Database/Query";
|
|
10
|
+
import { applyAlertSelfPrivacyFilter } from "../../../Alert/AlertPrivacyFilter";
|
|
11
|
+
import { applyIncidentSelfPrivacyFilter } from "../../../Incident/IncidentPrivacyFilter";
|
|
12
|
+
import CaptureSpan from "../../../Telemetry/CaptureSpan";
|
|
13
|
+
|
|
14
|
+
export default class MicrosoftTeamsActionAuthorization {
|
|
15
|
+
@CaptureSpan()
|
|
16
|
+
public static async assertCanUpdateIncident(data: {
|
|
17
|
+
incidentId: ObjectID;
|
|
18
|
+
projectId: ObjectID;
|
|
19
|
+
props: DatabaseCommonInteractionProps;
|
|
20
|
+
}): Promise<void> {
|
|
21
|
+
const incident: Incident | null = await IncidentService.findOneBy({
|
|
22
|
+
query: {
|
|
23
|
+
_id: data.incidentId,
|
|
24
|
+
projectId: data.projectId,
|
|
25
|
+
},
|
|
26
|
+
select: {
|
|
27
|
+
_id: true,
|
|
28
|
+
labels: {
|
|
29
|
+
_id: true,
|
|
30
|
+
name: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
isRoot: true,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!incident) {
|
|
39
|
+
throw new NotAuthorizedException(
|
|
40
|
+
"You do not have permission to update this incident.",
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await ModelPermission.checkUpdatePermissionByModel({
|
|
45
|
+
modelType: Incident,
|
|
46
|
+
fetchModelWithAccessControlIds: async (): Promise<Incident> => {
|
|
47
|
+
return incident;
|
|
48
|
+
},
|
|
49
|
+
props: data.props,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const permittedQuery: Query<Incident> =
|
|
53
|
+
await ModelPermission.checkUpdateQueryPermissions(
|
|
54
|
+
Incident,
|
|
55
|
+
{
|
|
56
|
+
_id: data.incidentId,
|
|
57
|
+
projectId: data.projectId,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
currentIncidentStateId: ObjectID.getZeroObjectID(),
|
|
61
|
+
},
|
|
62
|
+
data.props,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const privacyScopedQuery: Query<Incident> = applyIncidentSelfPrivacyFilter(
|
|
66
|
+
permittedQuery,
|
|
67
|
+
data.props,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const permittedIncident: Incident | null = await IncidentService.findOneBy({
|
|
71
|
+
query: privacyScopedQuery,
|
|
72
|
+
select: {
|
|
73
|
+
_id: true,
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
isRoot: true,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (!permittedIncident) {
|
|
81
|
+
throw new NotAuthorizedException(
|
|
82
|
+
"You do not have permission to update this incident.",
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@CaptureSpan()
|
|
88
|
+
public static async assertCanUpdateAlert(data: {
|
|
89
|
+
alertId: ObjectID;
|
|
90
|
+
projectId: ObjectID;
|
|
91
|
+
props: DatabaseCommonInteractionProps;
|
|
92
|
+
}): Promise<void> {
|
|
93
|
+
const alert: Alert | null = await AlertService.findOneBy({
|
|
94
|
+
query: {
|
|
95
|
+
_id: data.alertId,
|
|
96
|
+
projectId: data.projectId,
|
|
97
|
+
},
|
|
98
|
+
select: {
|
|
99
|
+
_id: true,
|
|
100
|
+
labels: {
|
|
101
|
+
_id: true,
|
|
102
|
+
name: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
props: {
|
|
106
|
+
isRoot: true,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (!alert) {
|
|
111
|
+
throw new NotAuthorizedException(
|
|
112
|
+
"You do not have permission to update this alert.",
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await ModelPermission.checkUpdatePermissionByModel({
|
|
117
|
+
modelType: Alert,
|
|
118
|
+
fetchModelWithAccessControlIds: async (): Promise<Alert> => {
|
|
119
|
+
return alert;
|
|
120
|
+
},
|
|
121
|
+
props: data.props,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const permittedQuery: Query<Alert> =
|
|
125
|
+
await ModelPermission.checkUpdateQueryPermissions(
|
|
126
|
+
Alert,
|
|
127
|
+
{
|
|
128
|
+
_id: data.alertId,
|
|
129
|
+
projectId: data.projectId,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
currentAlertStateId: ObjectID.getZeroObjectID(),
|
|
133
|
+
},
|
|
134
|
+
data.props,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const privacyScopedQuery: Query<Alert> = applyAlertSelfPrivacyFilter(
|
|
138
|
+
permittedQuery,
|
|
139
|
+
data.props,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const permittedAlert: Alert | null = await AlertService.findOneBy({
|
|
143
|
+
query: privacyScopedQuery,
|
|
144
|
+
select: {
|
|
145
|
+
_id: true,
|
|
146
|
+
},
|
|
147
|
+
props: {
|
|
148
|
+
isRoot: true,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
if (!permittedAlert) {
|
|
153
|
+
throw new NotAuthorizedException(
|
|
154
|
+
"You do not have permission to update this alert.",
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -31,6 +31,8 @@ import SortOrder from "../../../../../Types/BaseDatabase/SortOrder";
|
|
|
31
31
|
import { LIMIT_PER_PROJECT } from "../../../../../Types/Database/LimitMax";
|
|
32
32
|
import BadDataException from "../../../../../Types/Exception/BadDataException";
|
|
33
33
|
import URL from "../../../../../Types/API/URL";
|
|
34
|
+
import DatabaseCommonInteractionProps from "../../../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
35
|
+
import MicrosoftTeamsActionAuthorization from "./Authorization";
|
|
34
36
|
|
|
35
37
|
export default class MicrosoftTeamsIncidentActions {
|
|
36
38
|
@CaptureSpan()
|
|
@@ -296,6 +298,7 @@ export default class MicrosoftTeamsIncidentActions {
|
|
|
296
298
|
value: JSONObject;
|
|
297
299
|
projectId: ObjectID;
|
|
298
300
|
oneUptimeUserId: ObjectID;
|
|
301
|
+
databaseProps: DatabaseCommonInteractionProps;
|
|
299
302
|
turnContext: TurnContext;
|
|
300
303
|
}): Promise<void> {
|
|
301
304
|
const {
|
|
@@ -304,6 +307,7 @@ export default class MicrosoftTeamsIncidentActions {
|
|
|
304
307
|
value,
|
|
305
308
|
projectId,
|
|
306
309
|
oneUptimeUserId,
|
|
310
|
+
databaseProps,
|
|
307
311
|
turnContext,
|
|
308
312
|
} = data;
|
|
309
313
|
|
|
@@ -315,10 +319,15 @@ export default class MicrosoftTeamsIncidentActions {
|
|
|
315
319
|
return;
|
|
316
320
|
}
|
|
317
321
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
const incidentId: ObjectID = new ObjectID(actionValue);
|
|
323
|
+
|
|
324
|
+
await MicrosoftTeamsActionAuthorization.assertCanUpdateIncident({
|
|
325
|
+
incidentId: incidentId,
|
|
326
|
+
projectId: projectId,
|
|
327
|
+
props: databaseProps,
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
await IncidentService.acknowledgeIncident(incidentId, oneUptimeUserId);
|
|
322
331
|
await turnContext.sendActivity("✅ Incident acknowledged.");
|
|
323
332
|
return;
|
|
324
333
|
}
|
|
@@ -331,10 +340,15 @@ export default class MicrosoftTeamsIncidentActions {
|
|
|
331
340
|
return;
|
|
332
341
|
}
|
|
333
342
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
const incidentId: ObjectID = new ObjectID(actionValue);
|
|
344
|
+
|
|
345
|
+
await MicrosoftTeamsActionAuthorization.assertCanUpdateIncident({
|
|
346
|
+
incidentId: incidentId,
|
|
347
|
+
projectId: projectId,
|
|
348
|
+
props: databaseProps,
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
await IncidentService.resolveIncident(incidentId, oneUptimeUserId);
|
|
338
352
|
await turnContext.sendActivity("✅ Incident resolved.");
|
|
339
353
|
return;
|
|
340
354
|
}
|
|
@@ -574,9 +588,7 @@ export default class MicrosoftTeamsIncidentActions {
|
|
|
574
588
|
data: {
|
|
575
589
|
currentIncidentStateId: new ObjectID(incidentStateId.toString()),
|
|
576
590
|
},
|
|
577
|
-
props:
|
|
578
|
-
isRoot: true,
|
|
579
|
-
},
|
|
591
|
+
props: databaseProps,
|
|
580
592
|
});
|
|
581
593
|
|
|
582
594
|
await turnContext.sendActivity(
|
|
@@ -111,6 +111,7 @@ import AccessTokenService from "../../../Services/AccessTokenService";
|
|
|
111
111
|
import AIService, { AI_DISABLED_MESSAGE } from "../../../Services/AIService";
|
|
112
112
|
import DatabaseCommonInteractionProps from "../../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
113
113
|
import { AIChatCitation } from "../../../../Types/AI/AIChatTypes";
|
|
114
|
+
import TeamMemberService from "../../../Services/TeamMemberService";
|
|
114
115
|
|
|
115
116
|
// Microsoft Teams apps should always be single-tenant
|
|
116
117
|
const MICROSOFT_TEAMS_APP_TYPE: string = "SingleTenant";
|
|
@@ -3999,27 +4000,48 @@ All monitoring checks are passing normally.`;
|
|
|
3999
4000
|
userLookupParamsRes,
|
|
4000
4001
|
);
|
|
4001
4002
|
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4003
|
+
const isIncidentAction: boolean =
|
|
4004
|
+
MicrosoftTeamsIncidentActions.isIncidentAction({ actionType });
|
|
4005
|
+
const isAlertAction: boolean = MicrosoftTeamsAlertActions.isAlertAction({
|
|
4006
|
+
actionType,
|
|
4007
|
+
});
|
|
4008
|
+
|
|
4009
|
+
if (isIncidentAction || isAlertAction) {
|
|
4010
|
+
const databaseProps: DatabaseCommonInteractionProps =
|
|
4011
|
+
await AccessTokenService.getDatabaseCommonInteractionPropsByUserAndProject(
|
|
4012
|
+
{
|
|
4013
|
+
userId: oneUptimeUserId,
|
|
4014
|
+
projectId: projectId,
|
|
4015
|
+
},
|
|
4016
|
+
);
|
|
4017
|
+
|
|
4018
|
+
databaseProps.userTeamIds = await TeamMemberService.getTeamIdsForUser(
|
|
4009
4019
|
oneUptimeUserId,
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4020
|
+
projectId,
|
|
4021
|
+
);
|
|
4022
|
+
|
|
4023
|
+
// Handle incident actions
|
|
4024
|
+
if (isIncidentAction) {
|
|
4025
|
+
await MicrosoftTeamsIncidentActions.handleBotIncidentAction({
|
|
4026
|
+
actionType,
|
|
4027
|
+
actionValue,
|
|
4028
|
+
value,
|
|
4029
|
+
projectId,
|
|
4030
|
+
oneUptimeUserId,
|
|
4031
|
+
databaseProps,
|
|
4032
|
+
turnContext: data.turnContext,
|
|
4033
|
+
});
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4014
4036
|
|
|
4015
|
-
|
|
4016
|
-
if (MicrosoftTeamsAlertActions.isAlertAction({ actionType })) {
|
|
4037
|
+
// Handle alert actions
|
|
4017
4038
|
await MicrosoftTeamsAlertActions.handleBotAlertAction({
|
|
4018
4039
|
actionType,
|
|
4019
4040
|
actionValue,
|
|
4020
4041
|
value,
|
|
4021
4042
|
projectId,
|
|
4022
4043
|
oneUptimeUserId,
|
|
4044
|
+
databaseProps,
|
|
4023
4045
|
turnContext: data.turnContext,
|
|
4024
4046
|
});
|
|
4025
4047
|
return;
|