feat: events system implementation (#4246)

* chore: save poc

* chore: save wip

* fix: undo cors

* fix: impl changes

* fix: PR changes

* fix: mocks

* fix: connection tracking and auth changes

* fix: PR changes

* fix: revert license

* feat: frontend change

* fix: revert docker compose.dev

* fix: duplicate publisher connection

* fix: pr changes

* chore: move event impl to `ee`

* fix: lint errors

* fix: check length of events

* fix: static permissions matching

* fix: secretPath

* fix: remove source prefix in bus event name

* fix: license check
This commit is contained in:
Sid
2025-08-01 01:20:45 +05:30
committed by GitHub
parent 79de7c5f08
commit 52f773c647
22 changed files with 943 additions and 227 deletions
@@ -21,7 +21,8 @@ export enum ProjectPermissionSecretActions {
ReadValue = "readValue",
Create = "create",
Edit = "edit",
Delete = "delete"
Delete = "delete",
Subscribe = "subscribe"
}
export enum ProjectPermissionDynamicSecretActions {
@@ -39,6 +39,14 @@ export const renderOperatorSelectItems = (type: string) => {
<SelectItem value={PermissionConditionOperators.$IN}>In</SelectItem>
</>
);
case "eventType":
return (
<>
<SelectItem value={PermissionConditionOperators.$EQ}>Equal</SelectItem>
<SelectItem value={PermissionConditionOperators.$NEQ}>Not Equal</SelectItem>
<SelectItem value={PermissionConditionOperators.$IN}>In</SelectItem>
</>
);
default:
return (
<>
@@ -54,7 +54,8 @@ const SecretPolicyActionSchema = z.object({
[ProjectPermissionSecretActions.ReadValue]: z.boolean().optional(),
[ProjectPermissionSecretActions.Edit]: z.boolean().optional(),
[ProjectPermissionSecretActions.Delete]: z.boolean().optional(),
[ProjectPermissionSecretActions.Create]: z.boolean().optional()
[ProjectPermissionSecretActions.Create]: z.boolean().optional(),
[ProjectPermissionSecretActions.Subscribe]: z.boolean().optional()
});
const ApprovalPolicyActionSchema = z.object({
@@ -588,6 +589,7 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
const canEdit = action.includes(ProjectPermissionSecretActions.Edit);
const canDelete = action.includes(ProjectPermissionSecretActions.Delete);
const canCreate = action.includes(ProjectPermissionSecretActions.Create);
const canSubscribe = action.includes(ProjectPermissionSecretActions.Subscribe);
// from above statement we are sure it won't be undefined
formVal[subject]!.push({
@@ -597,6 +599,7 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
create: canCreate,
edit: canEdit,
delete: canDelete,
subscribe: canSubscribe,
conditions: conditions ? convertCaslConditionToFormOperator(conditions) : [],
inverted
});
@@ -1111,7 +1114,8 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
{ label: "Read Value", value: ProjectPermissionSecretActions.ReadValue },
{ label: "Modify", value: ProjectPermissionSecretActions.Edit },
{ label: "Remove", value: ProjectPermissionSecretActions.Delete },
{ label: "Create", value: ProjectPermissionSecretActions.Create }
{ label: "Create", value: ProjectPermissionSecretActions.Create },
{ label: "Subscribe", value: ProjectPermissionSecretActions.Subscribe }
]
},
[ProjectPermissionSub.SecretFolders]: {
@@ -17,7 +17,8 @@ export const SecretPermissionConditions = ({ position = 0, isDisabled }: Props)
{ value: "environment", label: "Environment Slug" },
{ value: "secretPath", label: "Secret Path" },
{ value: "secretName", label: "Secret Name" },
{ value: "secretTags", label: "Secret Tags" }
{ value: "secretTags", label: "Secret Tags" },
{ value: "eventType", label: "Event Type" }
]}
/>
);