mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
@@ -220,12 +220,12 @@ async fn git_v() -> String {
|
||||
format!("CE {GIT_VERSION}")
|
||||
}
|
||||
|
||||
#[cfg(feature = "enterprise")]
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
async fn ee_license() -> &'static str {
|
||||
""
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
#[cfg(feature = "enterprise")]
|
||||
async fn ee_license() -> String {
|
||||
LICENSE_KEY
|
||||
.as_ref()
|
||||
|
||||
@@ -50,8 +50,15 @@ pub async fn audit_log<'c, E: sqlx::Executor<'c, Database = Postgres>>(
|
||||
resource: Option<&str>,
|
||||
parameters: Option<HashMap<&str, &str>>,
|
||||
) -> Result<()> {
|
||||
#[cfg(feature = "enterprise")]
|
||||
let p_json: serde_json::Value = serde_json::to_value(¶meters).unwrap();
|
||||
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
let p_json: serde_json::Value = serde_json::json!({"redacted": "-"});
|
||||
|
||||
#[cfg(not(feature = "enterprise"))]
|
||||
let resource: Option<&str> = Some("EE only");
|
||||
|
||||
tracing::info!(
|
||||
operation = operation,
|
||||
action_kind = ?action_kind,
|
||||
@@ -60,10 +67,11 @@ pub async fn audit_log<'c, E: sqlx::Executor<'c, Database = Postgres>>(
|
||||
workspace_id = w_id,
|
||||
username = username,
|
||||
);
|
||||
|
||||
sqlx::query(
|
||||
"INSERT INTO audit
|
||||
(workspace_id, username, operation, action_kind, resource, parameters)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)",
|
||||
(workspace_id, username, operation, action_kind, resource, parameters)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)",
|
||||
)
|
||||
.bind(w_id)
|
||||
.bind(username)
|
||||
@@ -73,6 +81,7 @@ pub async fn audit_log<'c, E: sqlx::Executor<'c, Database = Postgres>>(
|
||||
.bind(p_json)
|
||||
.execute(db)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { userWorkspaces, workspaceStore } from '$lib/stores'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons'
|
||||
import Icon from 'svelte-awesome'
|
||||
import { slide } from 'svelte/transition'
|
||||
import InlineCodeCopy from './InlineCodeCopy.svelte'
|
||||
|
||||
$: opened = false
|
||||
$: workspace = $userWorkspaces.find((e) => e.id === $workspaceStore)
|
||||
$: workspaceName = workspace?.name
|
||||
$: workspaceId = workspace?.id
|
||||
$: url = `${$page.url.protocol}//${$page.url.hostname}/`
|
||||
</script>
|
||||
|
||||
@@ -41,7 +38,7 @@
|
||||
>
|
||||
<li
|
||||
>Setup the wmill cli for this workspace & remote: <InlineCodeCopy
|
||||
content={`wmill workspace add ${workspaceName} ${workspaceId} ${url}`}
|
||||
content={`wmill workspace add ${workspaceStore} ${workspaceStore} ${url}`}
|
||||
/></li
|
||||
>
|
||||
<li>Follow the prompts in your terminal</li>
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface UserExt {
|
||||
|
||||
let persistedWorkspace = BROWSER && localStorage.getItem('workspace')
|
||||
|
||||
export const enterpriseLicense = writable<string | undefined>(undefined)
|
||||
export const workerTags = writable<string[] | undefined>(undefined)
|
||||
export const usageStore = writable<number>(0)
|
||||
export const runFormStore = writable<any>()
|
||||
@@ -40,7 +41,7 @@ export const userWorkspaces: Readable<
|
||||
const originalWorkspaces = store?.workspaces ?? []
|
||||
if (superadmin) {
|
||||
return [
|
||||
...originalWorkspaces.filter((x) => x.id != 'starter' && x.id != 'admins'),
|
||||
...originalWorkspaces.filter((x) => x.id != 'admins'),
|
||||
{
|
||||
id: 'admins',
|
||||
name: 'Admins',
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
import TableCustom from '$lib/components/TableCustom.svelte'
|
||||
import { Alert } from '$lib/components/common'
|
||||
import { AuditLog, AuditService, UserService } from '$lib/gen'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { enterpriseLicense, userStore, workspaceStore } from '$lib/stores'
|
||||
import { displayDate } from '$lib/utils'
|
||||
import { faCross, faEdit, faPlay, faPlus, faQuestion } from '@fortawesome/free-solid-svg-icons'
|
||||
import Icon from 'svelte-awesome'
|
||||
@@ -85,6 +86,12 @@
|
||||
tooltip="You can only see your own audit logs unless you are an admin."
|
||||
/>
|
||||
|
||||
{#if !$enterpriseLicense}
|
||||
<Alert title="Redacted audit logs" type="warning"
|
||||
>You need an enterprise license to see unredacted audit logs.</Alert
|
||||
>
|
||||
<div class="py-2" />
|
||||
{/if}
|
||||
<!-- Filtering -->
|
||||
<div class="flex flex-row my-3">
|
||||
<label>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { UserService, WorkspaceService } from '$lib/gen'
|
||||
import { SettingsService, UserService, WorkspaceService } from '$lib/gen'
|
||||
import { logoutWithRedirect } from '$lib/logout'
|
||||
import { superadmin, userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import {
|
||||
enterpriseLicense,
|
||||
superadmin,
|
||||
userStore,
|
||||
usersWorkspaceStore,
|
||||
workspaceStore
|
||||
} from '$lib/stores'
|
||||
import { getUserExt } from '$lib/user'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { onMount } from 'svelte'
|
||||
@@ -21,9 +27,19 @@
|
||||
'NetworkError when attempting to fetch resource.'
|
||||
]
|
||||
|
||||
async function setUserWorkspaceStore() {
|
||||
$usersWorkspaceStore = await WorkspaceService.listUserWorkspaces()
|
||||
}
|
||||
|
||||
async function setLicense() {
|
||||
const license = await SettingsService.getLicenseId()
|
||||
if (license) {
|
||||
$enterpriseLicense = license
|
||||
}
|
||||
}
|
||||
|
||||
async function loadUser() {
|
||||
try {
|
||||
$usersWorkspaceStore = await WorkspaceService.listUserWorkspaces()
|
||||
await refreshSuperadmin()
|
||||
|
||||
if ($workspaceStore) {
|
||||
@@ -35,7 +51,7 @@
|
||||
)
|
||||
} else {
|
||||
$userStore = await getUserExt($workspaceStore)
|
||||
if (!userStore) {
|
||||
if (!$userStore) {
|
||||
throw Error('Not logged in')
|
||||
}
|
||||
}
|
||||
@@ -108,7 +124,9 @@
|
||||
}
|
||||
}
|
||||
if ($page.url.pathname != '/user/login') {
|
||||
setUserWorkspaceStore()
|
||||
loadUser()
|
||||
setLicense()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user