Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of the Audit Log #705

Merged
merged 146 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
21c22e7
feat: deletion process logger
HunorTotBagi Jun 10, 2024
f83cc1b
tests: adapt existing tests for new changes
HunorTotBagi Jun 10, 2024
6f43004
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
HunorTotBagi Jun 11, 2024
87e78cc
feat: add wip implementation
NikolaVetnic Jun 12, 2024
b55d806
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
HunorTotBagi Jun 12, 2024
4a88578
tests: improve tests
HunorTotBagi Jun 12, 2024
7816ff6
fix: add AbstractTestsBase & formatting issues
HunorTotBagi Jun 12, 2024
98750aa
fix: add AbstractTestsBase to HandlerTests
HunorTotBagi Jun 12, 2024
d34278c
fix: remove LogDeletionProcessTests
HunorTotBagi Jun 12, 2024
f2b936f
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
HunorTotBagi Jun 13, 2024
f37bd88
chore: rename
HunorTotBagi Jun 13, 2024
6d9a1f9
tests: fix
HunorTotBagi Jun 13, 2024
c51c2a1
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
HunorTotBagi Jun 14, 2024
7d4c515
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
HunorTotBagi Jun 18, 2024
7e6fac3
fix: include github actions test logger
HunorTotBagi Jun 18, 2024
82920a8
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 18, 2024
6d0ae0a
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 18, 2024
bb749cc
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
HunorTotBagi Jun 20, 2024
aef6379
test: remove unused eventBus
HunorTotBagi Jun 20, 2024
5e643cf
fix: typo
HunorTotBagi Jun 20, 2024
17d51d7
fix: delete identity last
HunorTotBagi Jun 20, 2024
6ad12b0
test: rename
HunorTotBagi Jun 20, 2024
a25d565
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 24, 2024
74d08c2
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 24, 2024
721537a
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 24, 2024
25b5a23
test: improve tests
HunorTotBagi Jun 24, 2024
4921f10
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
HunorTotBagi Jun 24, 2024
394094f
fix: missing semicolon
HunorTotBagi Jun 24, 2024
1a6612c
chore: rename
HunorTotBagi Jun 24, 2024
cc14980
fix: update FakeItEasy to 8.3.0 in Challenges module
HunorTotBagi Jun 24, 2024
b590e5d
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 24, 2024
77e7a46
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 24, 2024
b53bb6a
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 26, 2024
323e53b
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 26, 2024
4778008
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 27, 2024
816785a
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jun 27, 2024
e3124ca
chore: log before command
HunorTotBagi Jul 1, 2024
5f0bb2f
chore: rearrange variables for better readability
HunorTotBagi Jul 1, 2024
83b02ad
refactor: extract method
HunorTotBagi Jul 1, 2024
d89aee9
chore: rename test variables
HunorTotBagi Jul 1, 2024
ce2f5d4
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 1, 2024
39931b0
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 1, 2024
0f82755
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 1, 2024
4b7000e
core: remove unnecessary deletion process logger
HunorTotBagi Jul 1, 2024
29d1398
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 1, 2024
c7c38ef
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 2, 2024
11ee721
chore: rename
HunorTotBagi Jul 2, 2024
ecb7501
chore: rename message keys for deletion purposes
HunorTotBagi Jul 2, 2024
66f0a37
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
HunorTotBagi Jul 2, 2024
f9e9282
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 2, 2024
507778b
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 2, 2024
5c899f1
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
tnotheis Jul 3, 2024
d54f188
fix: configure RelationshipAuditLog to cascade delete on relationship…
tnotheis Jul 3, 2024
197de16
test: move SaveEntity extensions to UnitTestTools and make them async
tnotheis Jul 3, 2024
137ada7
refactor: log AuditLogEntries during identity deletion via repository…
tnotheis Jul 3, 2024
3da7170
fix: anonymize recipients of messages as well
tnotheis Jul 3, 2024
8aaec84
fix: log after deletion
tnotheis Jul 3, 2024
73855c9
test: add integration tests Job.IdentityDeletion
tnotheis Jul 3, 2024
e333c74
feat: add "Integration" category to integration tests to exclude them…
tnotheis Jul 3, 2024
7a37214
ci: run integration test projects directly instead of filtering for tag
tnotheis Jul 4, 2024
da01b9b
ci: add appsettings for integration tests of identity deletion job
tnotheis Jul 4, 2024
8a040cc
ci: replace deprecated env var of docker/build-push-action
tnotheis Jul 4, 2024
08ffb88
ci: fix integrationTest scripts and run job tests first
tnotheis Jul 4, 2024
1f691d9
ci: replace configuration before build
tnotheis Jul 4, 2024
7d4d636
ci: fix test location
tnotheis Jul 4, 2024
c354092
ci: remove unnecessary installation of script dependencies
tnotheis Jul 4, 2024
0f1d352
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
tnotheis Jul 4, 2024
853acbf
test: do not migrate in ActualDeletionWorkerTests
tnotheis Jul 4, 2024
24bdb91
Merge branch 'nmshdb-124-extension-of-the-audit-log' of github.com:nm…
tnotheis Jul 4, 2024
69666b6
ci: run integration tests in separate steps
tnotheis Jul 4, 2024
f2903fb
ci: fix path to compose.test.capi.yml in transport tests
tnotheis Jul 4, 2024
01f7afd
ci: remove dependency from admin-cli to consumer-api
tnotheis Jul 4, 2024
8f6ec6b
ci: add dependency from admin-cli to database-migrator
tnotheis Jul 4, 2024
2656346
ci: fix path to compose.test.capi.yml in transport tests
tnotheis Jul 4, 2024
b260ed2
ci: add --wait to docker compose up commands
tnotheis Jul 4, 2024
7a82e4b
ci: try to use matrix build
tnotheis Jul 4, 2024
356c0b9
ci: remove single integration tests
tnotheis Jul 4, 2024
0a8b531
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 5, 2024
37fcc93
ci: fix pipeline?
tnotheis Jul 5, 2024
8cdc1f2
ci: archive logs
tnotheis Jul 5, 2024
4f0455b
ci: fix matrix parameters
tnotheis Jul 5, 2024
ec50f64
ci: let sse-server depend on database-migrator and rabbitmq
tnotheis Jul 5, 2024
d779bd3
ci: replace hardcoded sqlserver
tnotheis Jul 5, 2024
49e1685
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 5, 2024
3cadebe
ci: add capi to admin ui tests
tnotheis Jul 5, 2024
67de357
Merge branch 'nmshdb-124-extension-of-the-audit-log' of github.com:nm…
tnotheis Jul 5, 2024
32d6165
ci: set fail-fast to false
tnotheis Jul 5, 2024
e1facbb
ci: add remaining integration tests
tnotheis Jul 5, 2024
710ae8e
ci: create matrix for transport tests
tnotheis Jul 5, 2024
f585e04
ci: let admin-cli depend on consumer-api
tnotheis Jul 5, 2024
c722301
ci: use path instead of name for dotnet test command
tnotheis Jul 5, 2024
04d1603
ci: remove integrationTest script files
tnotheis Jul 5, 2024
f30ebca
ci: move capi and aui back to compose.test.yml
tnotheis Jul 5, 2024
610d134
ci: fix docker compose commands
tnotheis Jul 5, 2024
9c106f5
ci: change job names
tnotheis Jul 5, 2024
94bc3cd
test: formatting
tnotheis Jul 5, 2024
0599774
ci: remove redundant dependency from admin-cli to database-migrator
tnotheis Jul 5, 2024
ab7f49e
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 5, 2024
5d7e358
refactor: don't distinguish between _nonDeviceIdentityDeleters and _d…
tnotheis Jul 5, 2024
d268dae
chore: remove redundant project properties
tnotheis Jul 5, 2024
aa1672c
chore: add appsettings.override.json to identity deletion job tests
tnotheis Jul 5, 2024
3a8e6cc
chore: add appsettings.override.json to solution
tnotheis Jul 5, 2024
153aff0
chore: add .editorconfig to solution
tnotheis Jul 5, 2024
5835e62
Merge branch 'nmshdb-124-extension-of-the-audit-log' of github.com:nm…
tnotheis Jul 5, 2024
bc893f9
test: cleanup/simplify
tnotheis Jul 5, 2024
b262b10
chore: extract into separate files
HunorTotBagi Jul 8, 2024
ca51ceb
chore: extract into separate file
HunorTotBagi Jul 8, 2024
3c22088
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 8, 2024
b5109bd
Merge branch 'main' into nmshdb-124-extension-of-the-audit-log
mergify[bot] Jul 8, 2024
fe2b1be
chore: utilize A.Dummy for variables called dummy
HunorTotBagi Jul 8, 2024
c41155b
chore: utilize A.Dummy for variable called dummy
HunorTotBagi Jul 8, 2024
58e0fbf
refactor: inject deletion progress logger into each deleter
HunorTotBagi Jul 8, 2024
7255f9d
chore: add AccessControlAllowCredentials to appsettings.override.json
tnotheis Jul 8, 2024
ce69a7e
refactor: rename IdentityDeletionProcessAuditLogEntryDTO to IdentityD…
tnotheis Jul 8, 2024
955f48a
feat: add AdditionalData property to IdentityDeletionProcessAuditLogE…
tnotheis Jul 8, 2024
8e81187
chore: update deletion process logger to use string instead of enum f…
tnotheis Jul 8, 2024
fe8bf89
fix: compiler errors
tnotheis Jul 8, 2024
aad77b2
chore: update packages of Challenges.Application.Tests.csproj
tnotheis Jul 8, 2024
81080a8
fix: merge conflicts with incoming changes
HunorTotBagi Jul 8, 2024
5c0f6ee
fix: adapt moved code to separate files
HunorTotBagi Jul 8, 2024
bc7e6d6
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
HunorTotBagi Jul 8, 2024
2003f47
test: fix tests
HunorTotBagi Jul 8, 2024
db1459c
feat: add support for data deleted
stamenione Jul 8, 2024
2e1ab94
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
stamenione Jul 8, 2024
d580599
fix: replace indexed signature with record
stamenione Jul 8, 2024
8212321
tests: fix and improve job tests
HunorTotBagi Jul 8, 2024
353bb31
Merge branch 'nmshdb-124-extension-of-the-audit-log' of https://githu…
HunorTotBagi Jul 8, 2024
52e06cb
ci: use correct appsettings override file for identity deletion job i…
tnotheis Jul 9, 2024
5efc000
Merge branch 'nmshdb-124-extension-of-the-audit-log' of github.com:nm…
tnotheis Jul 9, 2024
e6516b6
ci: replace appsettings.override.json from root directory instead of …
tnotheis Jul 9, 2024
23b5131
ci: use correct appsettings override file for identity deletion job i…
tnotheis Jul 9, 2024
3aa9c95
chore: remove unnecessary AggregateType
tnotheis Jul 9, 2024
c69bc04
test: fix mock/fake naming
tnotheis Jul 9, 2024
40d68f3
fix: make the replacement generic
stamenione Jul 9, 2024
b5527d4
fix; add modifier
stamenione Jul 9, 2024
a64d46a
fix: add readonly
stamenione Jul 9, 2024
7615585
fix: naming-convention
stamenione Jul 9, 2024
18f5bdc
fix: remove console log
stamenione Jul 9, 2024
7aad0b9
refactor: extract getFormattedMessage and messageTemplate into a service
stamenione Jul 9, 2024
7f288c3
fix: revert the naming
stamenione Jul 9, 2024
f4ee73d
chore: change the rule
stamenione Jul 9, 2024
329d629
fix: rule
stamenione Jul 9, 2024
053164d
fix: remove console log
stamenione Jul 9, 2024
f58307b
fix: add eslint-enable
stamenione Jul 9, 2024
7516746
refactor: rename the method
stamenione Jul 9, 2024
c35ff30
chore: change the method call
stamenione Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,61 +68,6 @@ export class DeletionProcessAuditLogsDetailsComponent implements OnInit {
}

public getFormattedMessage(messageKey: string, additionalData: Record<string, string>): string {
let messageTemplate: string;

switch (messageKey) {
case "StartedByOwner":
messageTemplate = "The deletion process was started by the owner. It was automatically approved.";
break;
case "StartedBySupport":
messageTemplate = "The deletion process was started by support. It is now waiting for approval.";
break;
case "Approved":
messageTemplate = "The deletion process was approved.";
break;
case "Rejected":
messageTemplate = "The deletion process was rejected.";
break;
case "CancelledByOwner":
messageTemplate = "The deletion process was cancelled by the owner of the identity.";
break;
case "CancelledBySupport":
messageTemplate = "The deletion process was cancelled by a support employee.";
break;
case "CancelledAutomatically":
messageTemplate = "The deletion process was cancelled automatically, because it wasn't approved by the owner within the approval period.";
break;
case "ApprovalReminder1Sent":
messageTemplate = "The first approval reminder notification has been sent.";
break;
case "ApprovalReminder2Sent":
messageTemplate = "The second approval reminder notification has been sent.";
break;
case "ApprovalReminder3Sent":
messageTemplate = "The third approval reminder notification has been sent.";
break;
case "GracePeriodReminder1Sent":
messageTemplate = "The first grace period reminder notification has been sent.";
break;
case "GracePeriodReminder2Sent":
messageTemplate = "The second grace period reminder notification has been sent.";
break;
case "GracePeriodReminder3Sent":
messageTemplate = "The third grace period reminder notification has been sent.";
break;
case "DataDeleted":
const messages: string[] = [];
Object.keys(additionalData).forEach((key) => {
const message = `All ${additionalData[key]} have been deleted.`;
messages.push(message);
});
messageTemplate = messages.join("\n");
break;
default:
messageTemplate = "Unknown message key.";
break;
}

return messageTemplate;
return this.identityService.getFormattedMessage(messageKey, additionalData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h2 class="header-title">{{ header }}</h2>
<ng-container matColumnDef="message">
<th mat-header-cell *matHeaderCellDef>Message</th>
<td mat-cell *matCellDef="let AuditLog" data-label="Message:">
{{ replaceMessageKeyWithCorrespondingText(AuditLog.messageKey) }}
{{ getFormattedMessage(AuditLog.messageKey, AuditLog.additionalData) }}
</td>
</ng-container>
<ng-container matColumnDef="oldStatus">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,36 +111,7 @@ export class DeletionProcessDetailsComponent {
});
}

public replaceMessageKeyWithCorrespondingText(messageKey: string): string {
switch (messageKey) {
case "StartedByOwner":
return "The deletion process was started by the owner. It was automatically approved.";
case "StartedBySupport":
return "The deletion process was started by support. It is now waiting for approval.";
case "Approved":
return "The deletion process was approved.";
case "Rejected":
return "The deletion process was rejected.";
case "CancelledByOwner":
return "The deletion process was cancelled by the owner of the identity.";
case "CancelledBySupport":
return "The deletion process was cancelled by a support employee.";
case "CancelledAutomatically":
return "The deletion process was cancelled automatically, because it wasn't approved by the owner within the approval period.";
case "ApprovalReminder1Sent":
return "The first approval reminder notification has been sent.";
case "ApprovalReminder2Sent":
return "The second approval reminder notification has been sent.";
case "ApprovalReminder3Sent":
return "The third approval reminder notification has been sent.";
case "GracePeriodReminder1Sent":
return "The first grace period reminder notification has been sent.";
case "GracePeriodReminder2Sent":
return "The second grace period reminder notification has been sent.";
case "GracePeriodReminder3Sent":
return "The third grace period reminder notification has been sent.";
default:
return "Unknown message key.";
}
public getFormattedMessage(messageKey: string, additionalData: Record<string, string>): string {
return this.identityService.getFormattedMessage(messageKey, additionalData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@ export class IdentityService {
this.odataUrl = `${environment.odataUrl}/Identities`;
}

/* eslint-disable @typescript-eslint/naming-convention */
tnotheis marked this conversation as resolved.
Show resolved Hide resolved
public readonly messageTemplates: Record<string, string> = {
tnotheis marked this conversation as resolved.
Show resolved Hide resolved
StartedByOwner: "The deletion process was started by the owner. It was automatically approved.",
StartedBySupport: "The deletion process was started by support. It is now waiting for approval.",
Approved: "The deletion process was approved.",
Rejected: "The deletion process was rejected.",
CancelledByOwner: "The deletion process was cancelled by the owner of the identity.",
CancelledBySupport: "The deletion process was cancelled by a support employee.",
CancelledAutomatically: "The deletion process was cancelled automatically, because it wasn't approved by the owner within the approval period.",
ApprovalReminder1Sent: "The first approval reminder notification has been sent.",
ApprovalReminder2Sent: "The second approval reminder notification has been sent.",
ApprovalReminder3Sent: "The third approval reminder notification has been sent.",
GracePeriodReminder1Sent: "The first grace period reminder notification has been sent.",
GracePeriodReminder2Sent: "The second grace period reminder notification has been sent.",
GracePeriodReminder3Sent: "The third grace period reminder notification has been sent.",
DataDeleted: "All {aggregateType} have been deleted."
};

public getFormattedMessage(messageKey: string, additionalData: Record<string, string>): string {
tnotheis marked this conversation as resolved.
Show resolved Hide resolved
let messageTemplate = this.messageTemplates[messageKey];

if (!messageTemplate) {
return "Unknown message key.";
}

Object.keys(additionalData).forEach((key) => {
const placeholder = `{${key}}`;
messageTemplate = messageTemplate.replace(new RegExp(placeholder, "g"), additionalData[key]);
});

return messageTemplate;
}

public getIdentities(filter: IdentityOverviewFilter, pageNumber: number, pageSize: number): Observable<ODataResponseEnvelope<IdentityOverview[]>> {
const paginationFilter = `$top=${pageSize}&$skip=${pageNumber * pageSize}&$count=true`;
return this.http.get<any>(`${this.odataUrl}${this.buildODataFilter(filter, paginationFilter)}${this.buildODataExpand()}`).pipe(
Expand Down