- internal/ui/ui.go: add PGCred, Tags to AccountDetailData; register
PUT /accounts/{id}/pgcreds and PUT /accounts/{id}/tags routes; add
pgcreds_form.html and tags_editor.html to shared template set; remove
unused AccountTagsData; fix fieldalignment on PolicyRuleView, PoliciesData
- internal/ui/handlers_accounts.go: add handleSetPGCreds — encrypts
password via crypto.SealAESGCM, writes audit EventPGCredUpdated, renders
pgcreds_form fragment; password never echoed; load PG creds and tags in
handleAccountDetail
- internal/ui/handlers_policy.go: fix handleSetAccountTags to render with
AccountDetailData instead of removed AccountTagsData
- internal/ui/ui_test.go: add 5 PG credential UI tests
- web/templates/fragments/pgcreds_form.html: new fragment — metadata display
+ set/replace form; system accounts only; password write-only
- web/templates/fragments/tags_editor.html: new fragment — textarea editor
with HTMX PUT for atomic tag replacement
- web/templates/fragments/policy_form.html: rewrite to use structured fields
matching handleCreatePolicyRule (roles/account_types/actions multi-select,
resource_type, subject_uuid, service_names, required_tags, checkbox)
- web/templates/policies.html: new policies management page
- web/templates/fragments/policy_row.html: new HTMX table row with toggle
and delete
- web/templates/account_detail.html: add Tags card and PG Credentials card
- web/templates/base.html: add Policies nav link
- internal/server/server.go: remove ~220 lines of duplicate tag/policy
handler code (real implementations are in handlers_policy.go)
- internal/policy/engine_wrapper.go: fix corrupted source; use errors.New
- internal/db/policy_test.go: use model.AccountTypeHuman constant
- cmd/mciasctl/main.go: add nolint:gosec to int(os.Stdin.Fd()) calls
- gofmt/goimports: db/policy_test.go, policy/defaults.go,
policy/engine_test.go, ui/ui.go, cmd/mciasctl/main.go
- fieldalignment: model.PolicyRuleRecord, policy.Engine, policy.Rule,
policy.RuleBody, ui.PolicyRuleView
Security: PG password encrypted AES-256-GCM with fresh random nonce before
storage; plaintext never logged or returned in any response; audit event
written on every credential write.
48 lines
2.0 KiB
HTML
48 lines
2.0 KiB
HTML
{{define "account_detail"}}{{template "base" .}}{{end}}
|
|
{{define "title"}}{{.Account.Username}} — MCIAS{{end}}
|
|
{{define "content"}}
|
|
<div class="page-header d-flex align-center justify-between">
|
|
<div>
|
|
<h1>{{.Account.Username}}</h1>
|
|
<p class="text-muted text-small">{{.Account.UUID}}</p>
|
|
</div>
|
|
<a class="btn btn-secondary" href="/accounts">← Accounts</a>
|
|
</div>
|
|
<div class="card">
|
|
<h2 style="font-size:1rem;font-weight:600;margin-bottom:1rem">Account Info</h2>
|
|
<dl style="display:grid;grid-template-columns:140px 1fr;gap:.5rem .75rem;font-size:.9rem">
|
|
<dt class="text-muted">Type</dt><dd>{{.Account.AccountType}}</dd>
|
|
<dt class="text-muted">Status</dt>
|
|
<dd id="status-cell">{{template "account_status" .}}</dd>
|
|
<dt class="text-muted">TOTP</dt><dd>{{if .Account.TOTPRequired}}Enabled{{else}}Disabled{{end}}</dd>
|
|
<dt class="text-muted">Created</dt><dd class="text-small">{{formatTime .Account.CreatedAt}}</dd>
|
|
<dt class="text-muted">Updated</dt><dd class="text-small">{{formatTime .Account.UpdatedAt}}</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="card">
|
|
<h2 style="font-size:1rem;font-weight:600;margin-bottom:1rem">Roles</h2>
|
|
<div id="roles-editor">{{template "roles_editor" .}}</div>
|
|
</div>
|
|
<div class="card">
|
|
<div class="d-flex align-center justify-between" style="margin-bottom:1rem">
|
|
<h2 style="font-size:1rem;font-weight:600">Tokens</h2>
|
|
{{if eq (string .Account.AccountType) "system"}}
|
|
<button class="btn btn-sm btn-secondary"
|
|
hx-post="/accounts/{{.Account.UUID}}/token"
|
|
hx-target="#token-list" hx-swap="outerHTML">Issue Token</button>
|
|
{{end}}
|
|
</div>
|
|
{{template "token_list" .}}
|
|
</div>
|
|
{{if eq (string .Account.AccountType) "system"}}
|
|
<div class="card">
|
|
<h2 style="font-size:1rem;font-weight:600;margin-bottom:1rem">Postgres Credentials</h2>
|
|
{{template "pgcreds_form" .}}
|
|
</div>
|
|
{{end}}
|
|
<div class="card">
|
|
<h2 style="font-size:1rem;font-weight:600;margin-bottom:1rem">Tags</h2>
|
|
<div id="tags-editor">{{template "tags_editor" .}}</div>
|
|
</div>
|
|
{{end}}
|