feat: choose which checkers may check private addresses, check types per organization
Whether platform checkers may check private addresses, including the host's Docker socket, is now a platform setting; unset, it stays as before: allowed self-hosted, forbidden in the cloud edition. Each of an organization's checkers has its own switch, on by default, settable at creation and toggled in the checker list. Both apply from the checker's next poll. Organizations choose in their settings which of the platform's check types their members are offered; existing monitors keep running, and if the platform later switches off everything an organization kept, it is offered the platform's types again rather than none. Forms marked data-autosave are sent when a field changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
0b7f48a609
commit
465fda60dc
26 files changed
+984
-281
No files matched your search
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
const createOrg = `-- name: CreateOrg :one
|
||||
INSERT INTO orgs (id, slug, name) VALUES ($1, $2, $3)
|
||||
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days
|
||||
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types
|
||||
`
|
||||
|
||||
type CreateOrgParams struct {
|
||||
@@ -34,6 +34,7 @@ func (q *Queries) CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, erro
|
||||
&i.RequireTotp,
|
||||
&i.RequireSso,
|
||||
&i.ApiTokenMaxDays,
|
||||
&i.DisabledCheckTypes,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -51,7 +52,7 @@ func (q *Queries) DeleteOrg(ctx context.Context, id uuid.UUID) (int64, error) {
|
||||
}
|
||||
|
||||
const getOrg = `-- name: GetOrg :one
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days FROM orgs WHERE id = $1
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) {
|
||||
@@ -66,12 +67,13 @@ func (q *Queries) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) {
|
||||
&i.RequireTotp,
|
||||
&i.RequireSso,
|
||||
&i.ApiTokenMaxDays,
|
||||
&i.DisabledCheckTypes,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getOrgBySlug = `-- name: GetOrgBySlug :one
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days FROM orgs WHERE slug = $1
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs WHERE slug = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
||||
@@ -86,12 +88,13 @@ func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
||||
&i.RequireTotp,
|
||||
&i.RequireSso,
|
||||
&i.ApiTokenMaxDays,
|
||||
&i.DisabledCheckTypes,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listOrgs = `-- name: ListOrgs :many
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days FROM orgs ORDER BY name
|
||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs ORDER BY name
|
||||
`
|
||||
|
||||
func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
||||
@@ -112,6 +115,7 @@ func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
||||
&i.RequireTotp,
|
||||
&i.RequireSso,
|
||||
&i.ApiTokenMaxDays,
|
||||
&i.DisabledCheckTypes,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -123,10 +127,24 @@ func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const setOrgDisabledCheckTypes = `-- name: SetOrgDisabledCheckTypes :exec
|
||||
UPDATE orgs SET disabled_check_types = $2, updated_at = now() WHERE id = $1
|
||||
`
|
||||
|
||||
type SetOrgDisabledCheckTypesParams struct {
|
||||
ID uuid.UUID
|
||||
DisabledCheckTypes []string
|
||||
}
|
||||
|
||||
func (q *Queries) SetOrgDisabledCheckTypes(ctx context.Context, arg SetOrgDisabledCheckTypesParams) error {
|
||||
_, err := q.db.Exec(ctx, setOrgDisabledCheckTypes, arg.ID, arg.DisabledCheckTypes)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateOrgPolicy = `-- name: UpdateOrgPolicy :one
|
||||
UPDATE orgs SET require_totp = $2, require_sso = $3, api_token_max_days = $4, updated_at = now()
|
||||
WHERE id = $1
|
||||
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days
|
||||
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types
|
||||
`
|
||||
|
||||
type UpdateOrgPolicyParams struct {
|
||||
@@ -153,6 +171,7 @@ func (q *Queries) UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams
|
||||
&i.RequireTotp,
|
||||
&i.RequireSso,
|
||||
&i.ApiTokenMaxDays,
|
||||
&i.DisabledCheckTypes,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in new issue
Block a user