Add viaScim to group events

This commit is contained in:
adrinr 2023-03-27 12:35:27 +01:00
parent 7821c637c6
commit 8a6400c7d0
2 changed files with 11 additions and 1 deletions

View File

@ -9,12 +9,13 @@ import {
GroupUsersDeletedEvent, GroupUsersDeletedEvent,
GroupAddedOnboardingEvent, GroupAddedOnboardingEvent,
GroupPermissionsEditedEvent, GroupPermissionsEditedEvent,
UserGroupRoles,
} from "@budibase/types" } from "@budibase/types"
import { context } from "../.."
async function created(group: UserGroup, timestamp?: number) { async function created(group: UserGroup, timestamp?: number) {
const properties: GroupCreatedEvent = { const properties: GroupCreatedEvent = {
groupId: group._id as string, groupId: group._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
name: group.name, name: group.name,
}, },
@ -25,6 +26,7 @@ async function created(group: UserGroup, timestamp?: number) {
async function updated(group: UserGroup) { async function updated(group: UserGroup) {
const properties: GroupUpdatedEvent = { const properties: GroupUpdatedEvent = {
groupId: group._id as string, groupId: group._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
name: group.name, name: group.name,
}, },
@ -35,6 +37,7 @@ async function updated(group: UserGroup) {
async function deleted(group: UserGroup) { async function deleted(group: UserGroup) {
const properties: GroupDeletedEvent = { const properties: GroupDeletedEvent = {
groupId: group._id as string, groupId: group._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
name: group.name, name: group.name,
}, },
@ -46,6 +49,7 @@ async function usersAdded(count: number, group: UserGroup) {
const properties: GroupUsersAddedEvent = { const properties: GroupUsersAddedEvent = {
count, count,
groupId: group._id as string, groupId: group._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
name: group.name, name: group.name,
}, },
@ -57,6 +61,7 @@ async function usersDeleted(count: number, group: UserGroup) {
const properties: GroupUsersDeletedEvent = { const properties: GroupUsersDeletedEvent = {
count, count,
groupId: group._id as string, groupId: group._id as string,
viaScim: context.isScimCall(),
audited: { audited: {
name: group.name, name: group.name,
}, },

View File

@ -2,6 +2,7 @@ import { BaseEvent } from "./event"
export interface GroupCreatedEvent extends BaseEvent { export interface GroupCreatedEvent extends BaseEvent {
groupId: string groupId: string
viaScim?: boolean
audited: { audited: {
name: string name: string
} }
@ -9,6 +10,7 @@ export interface GroupCreatedEvent extends BaseEvent {
export interface GroupUpdatedEvent extends BaseEvent { export interface GroupUpdatedEvent extends BaseEvent {
groupId: string groupId: string
viaScim?: boolean
audited: { audited: {
name: string name: string
} }
@ -16,6 +18,7 @@ export interface GroupUpdatedEvent extends BaseEvent {
export interface GroupDeletedEvent extends BaseEvent { export interface GroupDeletedEvent extends BaseEvent {
groupId: string groupId: string
viaScim?: boolean
audited: { audited: {
name: string name: string
} }
@ -24,6 +27,7 @@ export interface GroupDeletedEvent extends BaseEvent {
export interface GroupUsersAddedEvent extends BaseEvent { export interface GroupUsersAddedEvent extends BaseEvent {
count: number count: number
groupId: string groupId: string
viaScim?: boolean
audited: { audited: {
name: string name: string
} }
@ -32,6 +36,7 @@ export interface GroupUsersAddedEvent extends BaseEvent {
export interface GroupUsersDeletedEvent extends BaseEvent { export interface GroupUsersDeletedEvent extends BaseEvent {
count: number count: number
groupId: string groupId: string
viaScim?: boolean
audited: { audited: {
name: string name: string
} }