mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
[EC-449] Event log user for SCIM events (#3643)
* [EC-449] Added EventSystemUser Enum and added systemUser property to eventResponse * [EC-449] Add systemUser property to BaseEventsComponent, EventExport and EventView * [EC-449] Set EventSystemUser as string on EventExport * [EC-449] Remove systemUser from EventExport * [EC-449] Rename EventSystemUser file to lowercase * [EC-449] Force git to rename EventSystemUser file * [EC-449] Rename EventSystemUser file to event-system-user.ts * [EC-449] Fix EventSystemUser reference on EventsComponent * [EC-449] Move installationId username logic to BaseEventsComponent * Update libs/common/src/enums/event-system-user.ts Add a note to warn about using the Enum key in the UI. Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [EC-449] Remove EventSystemUser from provider events. Remove nested condition on events component Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -132,12 +132,13 @@ export abstract class BaseEventsComponent {
|
|||||||
appIcon: eventInfo.appIcon,
|
appIcon: eventInfo.appIcon,
|
||||||
appName: eventInfo.appName,
|
appName: eventInfo.appName,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
userName: r.installationId != null ? `Installation: ${r.installationId}` : userName,
|
userName: userName,
|
||||||
userEmail: user != null ? user.email : "",
|
userEmail: user != null ? user.email : "",
|
||||||
date: r.date,
|
date: r.date,
|
||||||
ip: r.ipAddress,
|
ip: r.ipAddress,
|
||||||
type: r.type,
|
type: r.type,
|
||||||
installationId: r.installationId,
|
installationId: r.installationId,
|
||||||
|
systemUser: r.systemUser,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { ProviderService } from "@bitwarden/common/abstractions/provider.service";
|
import { ProviderService } from "@bitwarden/common/abstractions/provider.service";
|
||||||
|
import { EventSystemUser } from "@bitwarden/common/enums/event-system-user";
|
||||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||||
import { EventResponse } from "@bitwarden/common/models/response/event.response";
|
import { EventResponse } from "@bitwarden/common/models/response/event.response";
|
||||||
|
|
||||||
@@ -114,10 +115,11 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getUserName(r: EventResponse, userId: string) {
|
protected getUserName(r: EventResponse, userId: string) {
|
||||||
if (userId == null) {
|
if (r.installationId != null) {
|
||||||
return null;
|
return `Installation: ${r.installationId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userId != null) {
|
||||||
if (this.orgUsersUserIdMap.has(userId)) {
|
if (this.orgUsersUserIdMap.has(userId)) {
|
||||||
return this.orgUsersUserIdMap.get(userId);
|
return this.orgUsersUserIdMap.get(userId);
|
||||||
}
|
}
|
||||||
@@ -127,6 +129,13 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
|||||||
name: this.organization.providerName,
|
name: this.organization.providerName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r.systemUser != null) {
|
||||||
|
return {
|
||||||
|
name: EventSystemUser[r.systemUser],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,14 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getUserName(r: EventResponse, userId: string) {
|
protected getUserName(r: EventResponse, userId: string) {
|
||||||
return userId != null && this.providerUsersUserIdMap.has(userId)
|
if (r.installationId != null) {
|
||||||
? this.providerUsersUserIdMap.get(userId)
|
return `Installation: ${r.installationId}`;
|
||||||
: null;
|
}
|
||||||
|
|
||||||
|
if (userId != null && this.providerUsersUserIdMap.has(userId)) {
|
||||||
|
return this.providerUsersUserIdMap.get(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
libs/common/src/enums/event-system-user.ts
Normal file
4
libs/common/src/enums/event-system-user.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Note: the enum key is used to describe the EventSystemUser in the UI. Be careful about changing it.
|
||||||
|
export enum EventSystemUser {
|
||||||
|
SCIM = 1,
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { DeviceType } from "../../enums/deviceType";
|
import { DeviceType } from "../../enums/deviceType";
|
||||||
|
import { EventSystemUser } from "../../enums/event-system-user";
|
||||||
import { EventType } from "../../enums/eventType";
|
import { EventType } from "../../enums/eventType";
|
||||||
|
|
||||||
import { BaseResponse } from "./base.response";
|
import { BaseResponse } from "./base.response";
|
||||||
@@ -20,6 +21,7 @@ export class EventResponse extends BaseResponse {
|
|||||||
deviceType: DeviceType;
|
deviceType: DeviceType;
|
||||||
ipAddress: string;
|
ipAddress: string;
|
||||||
installationId: string;
|
installationId: string;
|
||||||
|
systemUser: EventSystemUser;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
super(response);
|
super(response);
|
||||||
@@ -39,5 +41,6 @@ export class EventResponse extends BaseResponse {
|
|||||||
this.deviceType = this.getResponseProperty("DeviceType");
|
this.deviceType = this.getResponseProperty("DeviceType");
|
||||||
this.ipAddress = this.getResponseProperty("IpAddress");
|
this.ipAddress = this.getResponseProperty("IpAddress");
|
||||||
this.installationId = this.getResponseProperty("InstallationId");
|
this.installationId = this.getResponseProperty("InstallationId");
|
||||||
|
this.systemUser = this.getResponseProperty("SystemUser");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { EventSystemUser } from "../../enums/event-system-user";
|
||||||
import { EventType } from "../../enums/eventType";
|
import { EventType } from "../../enums/eventType";
|
||||||
|
|
||||||
export class EventView {
|
export class EventView {
|
||||||
@@ -12,6 +13,7 @@ export class EventView {
|
|||||||
ip: string;
|
ip: string;
|
||||||
type: EventType;
|
type: EventType;
|
||||||
installationId: string;
|
installationId: string;
|
||||||
|
systemUser: EventSystemUser;
|
||||||
|
|
||||||
constructor(data: Required<EventView>) {
|
constructor(data: Required<EventView>) {
|
||||||
this.message = data.message;
|
this.message = data.message;
|
||||||
@@ -25,5 +27,6 @@ export class EventView {
|
|||||||
this.ip = data.ip;
|
this.ip = data.ip;
|
||||||
this.type = data.type;
|
this.type = data.type;
|
||||||
this.installationId = data.installationId;
|
this.installationId = data.installationId;
|
||||||
|
this.systemUser = data.systemUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user