Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Moved audit logs to org-level entirely

Daniel Hougaard0f70c3ea9a90
diff --git a/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx b/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx
index 239ec7ff7f..2b6ec67447 100644
--- a/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx
+++ b/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx
@@ -1,6 +1,7 @@
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
import { withPermission } from "@app/hoc";
-import { LogsSection } from "@app/views/Project/AuditLogsPage/components";
+
+import { LogsSection } from "./components";
export const AuditLogsPage = withPermission(
() => {
@@ -16,5 +17,5 @@ export const AuditLogsPage = withPermission(
</div>
);
},
- { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Member } // TODO(Daniel): Create a permission for org audit logs
+ { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.AuditLogs }
);
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx
similarity index 94%
rename from frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx
index ba1b91a85f..cf00c9b0a8 100644
--- a/frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx
+++ b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx
@@ -199,7 +199,7 @@ export const LogsFilter = ({
<Controller
control={control}
name="userAgentType"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ render={({ field: { onChange, value, ...field }, fieldState: { error } }) => (
<FormControl
label="Source"
errorText={error?.message}
@@ -207,7 +207,7 @@ export const LogsFilter = ({
className="w-40"
>
<Select
- {...(field.value ? { value: field.value } : { placeholder: "All sources" })}
+ value={value === undefined ? "all" : value}
{...field}
onValueChange={(e) => {
if (e === "all") onChange(undefined);
@@ -215,14 +215,14 @@ export const LogsFilter = ({
}}
className={twMerge(
"w-full border border-mineshaft-500 bg-mineshaft-700 text-mineshaft-100",
- (field.value === "all" || field.value === undefined) && "text-mineshaft-400"
+ value === undefined && "text-mineshaft-400"
)}
>
<SelectItem value="all" key="all">
All sources
</SelectItem>
- {userAgentTypes.map(({ label, value }) => (
- <SelectItem value={String(value || "")} key={label}>
+ {userAgentTypes.map(({ label, value: userAgent }) => (
+ <SelectItem value={userAgent} key={label}>
{label}
</SelectItem>
))}
@@ -235,7 +235,7 @@ export const LogsFilter = ({
<Controller
control={control}
name="projectId"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ render={({ field: { onChange, value, ...field }, fieldState: { error } }) => (
<FormControl
label="Project"
errorText={error?.message}
@@ -243,7 +243,7 @@ export const LogsFilter = ({
className="w-40"
>
<Select
- {...(field.value ? { value: field.value } : { placeholder: "All projects" })}
+ value={value === undefined ? "all" : value}
{...field}
onValueChange={(e) => {
if (e === "all") onChange(undefined);
@@ -251,7 +251,7 @@ export const LogsFilter = ({
}}
className={twMerge(
"w-full border border-mineshaft-500 bg-mineshaft-700 text-mineshaft-100",
- (field.value === "all" || field.value === undefined) && "text-mineshaft-400"
+ value === undefined && "text-mineshaft-400"
)}
>
<SelectItem value="all" key="all">
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx
similarity index 99%
rename from frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx
index 83ae4d1df7..a184b0f5c0 100644
--- a/frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx
+++ b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx
@@ -47,6 +47,7 @@ export const LogsSection = ({
const { control, reset, watch } = useForm<AuditLogFilterFormData>({
resolver: yupResolver(auditLogFilterFormSchema),
defaultValues: {
+ projectId: undefined,
actor: presets?.actorId,
eventType: presets?.eventType || [],
page: 1,
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTable.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsTable.tsx
similarity index 100%
rename from frontend/src/views/Project/AuditLogsPage/components/LogsTable.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/LogsTable.tsx
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsTableRow.tsx
similarity index 100%
rename from frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/LogsTableRow.tsx
diff --git a/frontend/src/views/Project/AuditLogsPage/components/index.tsx b/frontend/src/views/Org/AuditLogsPage/components/index.tsx
similarity index 100%
rename from frontend/src/views/Project/AuditLogsPage/components/index.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/index.tsx
diff --git a/frontend/src/views/Project/AuditLogsPage/components/types.tsx b/frontend/src/views/Org/AuditLogsPage/components/types.tsx
similarity index 100%
rename from frontend/src/views/Project/AuditLogsPage/components/types.tsx
rename to frontend/src/views/Org/AuditLogsPage/components/types.tsx
diff --git a/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx b/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx
deleted file mode 100644
index e9b8504a2c..0000000000
--- a/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { withProjectPermission } from "@app/hoc";
-
-import { LogsSection } from "./components";
-
-export const AuditLogsPage = withProjectPermission(
- () => {
- return (
- <div className="flex h-full w-full justify-center bg-bunker-800 text-white">
- <div className="w-full max-w-7xl px-6">
- <div className="sticky top-0 z-10 bg-bunker-800 py-6">
- <p className="text-3xl font-semibold text-gray-200">Audit Logs</p>
- <div />
- </div>
- <LogsSection showFilters />
- </div>
- </div>
- );
- },
- { action: ProjectPermissionActions.Read, subject: ProjectPermissionSub.AuditLogs }
-);
diff --git a/frontend/src/views/Project/AuditLogsPage/index.tsx b/frontend/src/views/Project/AuditLogsPage/index.tsx
deleted file mode 100644
index 3864b14353..0000000000
--- a/frontend/src/views/Project/AuditLogsPage/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { AuditLogsPage } from "./AuditLogsPage";