feat: admins suspend or delete status pages, organizations and accounts #110
No files matched your search
@@ -123,6 +123,9 @@ func (s *Server) resolvePrincipal(c *gin.Context) (*principal, int, string, erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, "", err
|
return nil, 0, "", err
|
||||||
}
|
}
|
||||||
|
if p.Org.SuspendedAt != nil {
|
||||||
|
return nil, http.StatusForbidden, "org_suspended", nil
|
||||||
|
}
|
||||||
if code := policyViolation(p.Org, p.Grants.Owner, sess); code != "" {
|
if code := policyViolation(p.Org, p.Grants.Owner, sess); code != "" {
|
||||||
return nil, http.StatusForbidden, code, nil
|
return nil, http.StatusForbidden, code, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,6 +241,23 @@ var endpoints = []endpoint{
|
|||||||
{method: "PUT", path: "/api/v1/admin/checker-network", tag: "Platform", summary: "Let platform checkers check private addresses or not",
|
{method: "PUT", path: "/api/v1/admin/checker-network", tag: "Platform", summary: "Let platform checkers check private addresses or not",
|
||||||
description: "Unset, they may on self-hosted installations and may not in the cloud edition. Applies from each checker's next poll.",
|
description: "Unset, they may on self-hosted installations and may not in the cloud edition. Applies from each checker's next poll.",
|
||||||
perm: "platform admin", req: checkerNetwork{}, status: http.StatusNoContent},
|
perm: "platform admin", req: checkerNetwork{}, status: http.StatusNoContent},
|
||||||
|
{method: "GET", path: "/api/v1/admin/status-pages", tag: "Platform", summary: "Public and suspended status pages with organization and owner",
|
||||||
|
description: "Newest first, at most 500. `q` searches title, slug, domain, organization and owner email.",
|
||||||
|
perm: "platform admin", resp: obj{"status_pages": []moderatedPage{}}},
|
||||||
|
{method: "PUT", path: "/api/v1/admin/status-pages/:id/suspension", tag: "Platform", summary: "Suspend or reinstate a status page",
|
||||||
|
description: "A suspended page is not served; status page servers drop it when they next ask for it.",
|
||||||
|
perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent},
|
||||||
|
{method: "DELETE", path: "/api/v1/admin/status-pages/:id", tag: "Platform", summary: "Delete a status page", perm: "platform admin", status: http.StatusNoContent},
|
||||||
|
{method: "PUT", path: "/api/v1/admin/orgs/:id/suspension", tag: "Platform", summary: "Suspend or reinstate an organization",
|
||||||
|
description: "A suspended organization's monitors are not checked, its status pages are not served, heartbeats and Alertmanager webhooks are refused, and its members and API tokens get 403 org_suspended.",
|
||||||
|
perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent},
|
||||||
|
{method: "DELETE", path: "/api/v1/admin/orgs/:id", tag: "Platform", summary: "Delete an organization with all its data", perm: "platform admin", status: http.StatusNoContent},
|
||||||
|
{method: "PUT", path: "/api/v1/admin/users/:id/suspension", tag: "Platform", summary: "Suspend or reinstate an account",
|
||||||
|
description: "A suspended account is signed out everywhere and can neither sign in nor use its API tokens. Platform admins cannot be suspended.",
|
||||||
|
perm: "platform admin", req: suspensionRequest{}, status: http.StatusNoContent},
|
||||||
|
{method: "DELETE", path: "/api/v1/admin/users/:id", tag: "Platform", summary: "Delete an account",
|
||||||
|
description: "Organizations only the account belongs to are deleted with it; owning one shared with others gives 409 owns_shared_orgs. Platform admins cannot be deleted.",
|
||||||
|
perm: "platform admin", status: http.StatusNoContent},
|
||||||
{method: "GET", path: "/api/v1/admin/regions", tag: "Platform", summary: "List platform regions", perm: "platform admin",
|
{method: "GET", path: "/api/v1/admin/regions", tag: "Platform", summary: "List platform regions", perm: "platform admin",
|
||||||
resp: obj{"regions": []regionView{}}},
|
resp: obj{"regions": []regionView{}}},
|
||||||
{method: "POST", path: "/api/v1/admin/regions", tag: "Platform", summary: "Create a platform region", perm: "platform admin",
|
{method: "POST", path: "/api/v1/admin/regions", tag: "Platform", summary: "Create a platform region", perm: "platform admin",
|
||||||
|
|||||||
+16
-10
@@ -89,16 +89,22 @@ var auditActions = map[string]string{
|
|||||||
"POST /api/v1/org/tokens": "token.create",
|
"POST /api/v1/org/tokens": "token.create",
|
||||||
"DELETE /api/v1/org/tokens/:id": "token.delete",
|
"DELETE /api/v1/org/tokens/:id": "token.delete",
|
||||||
|
|
||||||
"PUT /api/v1/admin/legal/:kind": "platform.legal_update",
|
"PUT /api/v1/admin/legal/:kind": "platform.legal_update",
|
||||||
"PUT /api/v1/org/legal/:kind": "org.legal_update",
|
"PUT /api/v1/org/legal/:kind": "org.legal_update",
|
||||||
"PUT /api/v1/admin/check-types": "platform.check_types_update",
|
"PUT /api/v1/admin/check-types": "platform.check_types_update",
|
||||||
"PUT /api/v1/admin/checker-network": "platform.checker_network_update",
|
"PUT /api/v1/admin/checker-network": "platform.checker_network_update",
|
||||||
"PUT /api/v1/org/check-types": "org.check_types_update",
|
"PUT /api/v1/admin/status-pages/:id/suspension": "platform.status_page_suspension",
|
||||||
"PATCH /api/v1/org/agents/:id": "agent.update",
|
"DELETE /api/v1/admin/status-pages/:id": "platform.status_page_delete",
|
||||||
"POST /api/v1/admin/regions": "platform.region_create",
|
"PUT /api/v1/admin/orgs/:id/suspension": "platform.org_suspension",
|
||||||
"DELETE /api/v1/admin/regions/:id": "platform.region_delete",
|
"DELETE /api/v1/admin/orgs/:id": "platform.org_delete",
|
||||||
"POST /api/v1/admin/agents": "platform.agent_create",
|
"PUT /api/v1/admin/users/:id/suspension": "platform.user_suspension",
|
||||||
"DELETE /api/v1/admin/agents/:id": "platform.agent_delete",
|
"DELETE /api/v1/admin/users/:id": "platform.user_delete",
|
||||||
|
"PUT /api/v1/org/check-types": "org.check_types_update",
|
||||||
|
"PATCH /api/v1/org/agents/:id": "agent.update",
|
||||||
|
"POST /api/v1/admin/regions": "platform.region_create",
|
||||||
|
"DELETE /api/v1/admin/regions/:id": "platform.region_delete",
|
||||||
|
"POST /api/v1/admin/agents": "platform.agent_create",
|
||||||
|
"DELETE /api/v1/admin/agents/:id": "platform.agent_delete",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed attempts of these actions are recorded too.
|
// Failed attempts of these actions are recorded too.
|
||||||
|
|||||||
+10
-1
@@ -155,10 +155,15 @@ func (s *Server) login(c *gin.Context) {
|
|||||||
internalError(c, err)
|
internalError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !ok || user.DisabledAt != nil {
|
if !ok {
|
||||||
invalidCredentials(c)
|
invalidCredentials(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Only someone who knows the password learns of the suspension.
|
||||||
|
if user.DisabledAt != nil {
|
||||||
|
fail(c, http.StatusForbidden, "account_suspended")
|
||||||
|
return
|
||||||
|
}
|
||||||
if rehash {
|
if rehash {
|
||||||
s.rehashPassword(ctx, user.ID, req.Password)
|
s.rehashPassword(ctx, user.ID, req.Password)
|
||||||
}
|
}
|
||||||
@@ -243,6 +248,10 @@ func (s *Server) finishLogin(c *gin.Context, userID uuid.UUID, method auth.Metho
|
|||||||
internalError(c, err)
|
internalError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if user.DisabledAt != nil {
|
||||||
|
fail(c, http.StatusForbidden, "account_suspended")
|
||||||
|
return
|
||||||
|
}
|
||||||
var org uuid.UUID
|
var org uuid.UUID
|
||||||
if len(orgs) > 0 {
|
if len(orgs) > 0 {
|
||||||
org = orgs[0].ID
|
org = orgs[0].ID
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ func (s *Server) statusPagesView(c *gin.Context, p *principal, page web.Page, me
|
|||||||
}
|
}
|
||||||
v.Pages = append(v.Pages, web.PageRow{
|
v.Pages = append(v.Pages, web.PageRow{
|
||||||
ID: r.ID.String(), Title: r.Title, Slug: r.Slug, Published: r.Published,
|
ID: r.ID.String(), Title: r.Title, Slug: r.Slug, Published: r.Published,
|
||||||
URL: s.pageURL(r), Domain: deref(r.CustomDomain),
|
URL: s.pageURL(r), Domain: deref(r.CustomDomain), Suspended: r.SuspendedAt != nil,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return web.StatusPagesPage(page, me, v), nil
|
return web.StatusPagesPage(page, me, v), nil
|
||||||
@@ -865,6 +865,7 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
|||||||
e := web.PageEditor{
|
e := web.PageEditor{
|
||||||
ID: row.ID.String(), Title: row.Title, Slug: row.Slug, Description: row.Description,
|
ID: row.ID.String(), Title: row.Title, Slug: row.Slug, Description: row.Description,
|
||||||
Published: row.Published, ShowDetails: row.ShowComponentDetails,
|
Published: row.Published, ShowDetails: row.ShowComponentDetails,
|
||||||
|
Suspended: row.SuspendedAt != nil, SuspendedReason: row.SuspendedReason,
|
||||||
Accent: v.Theme.Accent, LogoURL: v.Theme.LogoURL, CSS: v.Theme.CSS,
|
Accent: v.Theme.Accent, LogoURL: v.Theme.LogoURL, CSS: v.Theme.CSS,
|
||||||
URL: s.pageURL(row), Domain: deref(row.CustomDomain), DomainVerified: v.DomainVerified,
|
URL: s.pageURL(row), Domain: deref(row.CustomDomain), DomainVerified: v.DomainVerified,
|
||||||
HasOrgGroups: len(orgGroups) > 0,
|
HasOrgGroups: len(orgGroups) > 0,
|
||||||
|
|||||||
+25
-16
@@ -609,8 +609,28 @@ func (s *Server) deleteAccount(c *gin.Context) {
|
|||||||
fail(c, http.StatusForbidden, "confirmation_failed")
|
fail(c, http.StatusForbidden, "confirmation_failed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var shared []string
|
shared, orgsDeleted, err := s.eraseAccount(ctx, u)
|
||||||
var orgsDeleted int
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(shared) > 0 {
|
||||||
|
c.JSON(http.StatusConflict, gin.H{
|
||||||
|
"error": "owns_shared_orgs", "message": i18n.T(ctx, "error.owns_shared_orgs"), "organizations": shared,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auth.ClearCookie(c)
|
||||||
|
// Kept as proof of erasure, without saying whose.
|
||||||
|
s.writeAudit(c, store.InsertAuditEventParams{Kind: "platform", Action: "account.delete", Status: http.StatusOK},
|
||||||
|
map[string]any{"organizations_deleted": orgsDeleted})
|
||||||
|
c.JSON(http.StatusOK, gin.H{"status": "deleted"})
|
||||||
|
}
|
||||||
|
|
||||||
|
// eraseAccount deletes u with the organizations only u belongs to and
|
||||||
|
// ends u's sessions. If u owns organizations shared with others, nothing
|
||||||
|
// is deleted and their slugs are returned.
|
||||||
|
func (s *Server) eraseAccount(ctx context.Context, u store.User) (shared []string, orgsDeleted int, err error) {
|
||||||
err = s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
err = s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
owned, err := q.OwnedOrgs(ctx, u.ID)
|
owned, err := q.OwnedOrgs(ctx, u.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -643,24 +663,13 @@ func (s *Server) deleteAccount(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil || len(shared) > 0 {
|
||||||
internalError(c, err)
|
return shared, 0, err
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(shared) > 0 {
|
|
||||||
c.JSON(http.StatusConflict, gin.H{
|
|
||||||
"error": "owns_shared_orgs", "message": i18n.T(ctx, "error.owns_shared_orgs"), "organizations": shared,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if err := s.sessions.DeleteAllForUser(ctx, u.ID); err != nil {
|
if err := s.sessions.DeleteAllForUser(ctx, u.ID); err != nil {
|
||||||
s.log.ErrorContext(ctx, "ending sessions of deleted account failed", "error", err)
|
s.log.ErrorContext(ctx, "ending sessions of deleted account failed", "error", err)
|
||||||
}
|
}
|
||||||
auth.ClearCookie(c)
|
return nil, orgsDeleted, nil
|
||||||
// Kept as proof of erasure, without saying whose.
|
|
||||||
s.writeAudit(c, store.InsertAuditEventParams{Kind: "platform", Action: "account.delete", Status: http.StatusOK},
|
|
||||||
map[string]any{"organizations_deleted": orgsDeleted})
|
|
||||||
c.JSON(http.StatusOK, gin.H{"status": "deleted"})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type orgDeletionRequest struct {
|
type orgDeletionRequest struct {
|
||||||
|
|||||||
@@ -0,0 +1,307 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Platform admins moderate public status pages and the organizations and
|
||||||
|
// accounts behind them: suspending hides or stops them and can be undone,
|
||||||
|
// deleting cannot. Suspended pages leave status page servers when these
|
||||||
|
// next ask for them, within half a minute.
|
||||||
|
|
||||||
|
type moderatedPage struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Published bool `json:"published"`
|
||||||
|
Domain string `json:"custom_domain,omitempty"`
|
||||||
|
SuspendedAt *time.Time `json:"suspended_at"`
|
||||||
|
Reason string `json:"suspended_reason,omitempty"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
Org moderatedOrg `json:"org"`
|
||||||
|
Owner *moderatedUser `json:"owner"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type moderatedOrg struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
SuspendedAt *time.Time `json:"suspended_at"`
|
||||||
|
Reason string `json:"suspended_reason,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type moderatedUser struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
SuspendedAt *time.Time `json:"suspended_at"`
|
||||||
|
Reason string `json:"suspended_reason,omitempty"`
|
||||||
|
// Admin marks platform admins, who cannot be suspended or deleted.
|
||||||
|
Admin bool `json:"admin,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
const moderationRows = 500
|
||||||
|
|
||||||
|
func (s *Server) moderatedPages(c *gin.Context) ([]moderatedPage, error) {
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
var rows []store.AdminListStatusPagesRow
|
||||||
|
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
rows, err = q.AdminListStatusPages(ctx, store.AdminListStatusPagesParams{
|
||||||
|
Search: truncate(strings.TrimSpace(c.Query("q")), 200), MaxRows: moderationRows,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
out := make([]moderatedPage, len(rows))
|
||||||
|
for i, r := range rows {
|
||||||
|
p := &out[i]
|
||||||
|
p.ID, p.Slug, p.Title, p.Published, p.SuspendedAt, p.Reason, p.CreatedAt = r.ID, r.Slug, r.Title, r.Published, r.SuspendedAt, r.SuspendedReason, r.CreatedAt
|
||||||
|
if r.CustomDomain != nil && r.DomainVerifiedAt != nil {
|
||||||
|
p.Domain = *r.CustomDomain
|
||||||
|
}
|
||||||
|
p.Org = moderatedOrg{r.OrgID, r.OrgSlug, r.OrgName, r.OrgSuspendedAt, r.OrgSuspendedReason}
|
||||||
|
if r.OwnerID != uuid.Nil {
|
||||||
|
p.Owner = &moderatedUser{r.OwnerID, r.OwnerEmail, r.OwnerDisabledAt, r.OwnerDisabledReason, r.OwnerIsAdmin}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminListStatusPages(c *gin.Context) {
|
||||||
|
pages, err := s.moderatedPages(c)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{"status_pages": pages})
|
||||||
|
}
|
||||||
|
|
||||||
|
type suspensionRequest struct {
|
||||||
|
Suspended bool `json:"suspended"`
|
||||||
|
Reason string `json:"reason" binding:"max=500"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// suspension binds a suspension request and the target ID.
|
||||||
|
func suspension(c *gin.Context) (uuid.UUID, suspensionRequest, bool) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return uuid.Nil, suspensionRequest{}, false
|
||||||
|
}
|
||||||
|
var req suspensionRequest
|
||||||
|
if !bind(c, &req) {
|
||||||
|
return uuid.Nil, req, false
|
||||||
|
}
|
||||||
|
req.Reason = strings.TrimSpace(req.Reason)
|
||||||
|
auditDetail(c, "suspended", req.Suspended)
|
||||||
|
if req.Reason != "" {
|
||||||
|
auditDetail(c, "reason", req.Reason)
|
||||||
|
}
|
||||||
|
return id, req, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// moderated finishes a moderation request: 404 for unknown targets.
|
||||||
|
func moderated(c *gin.Context, err error) bool {
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminSuspendStatusPage(c *gin.Context) {
|
||||||
|
id, req, ok := suspension(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
row, err := q.SuspendStatusPage(ctx, store.SuspendStatusPageParams{ID: id, Suspend: req.Suspended, Reason: req.Reason})
|
||||||
|
auditDetail(c, "slug", row.Slug)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if moderated(c, err) {
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminDeleteStatusPage(c *gin.Context) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
err = s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
page, err := q.GetStatusPage(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
auditDetail(c, "slug", page.Slug)
|
||||||
|
_, err = q.DeleteStatusPage(ctx, id)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if moderated(c, err) {
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminSuspendOrg(c *gin.Context) {
|
||||||
|
id, req, ok := suspension(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
row, err := q.SuspendOrg(ctx, store.SuspendOrgParams{ID: id, Suspend: req.Suspended, Reason: req.Reason})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
auditDetail(c, "slug", row.Slug)
|
||||||
|
if !req.Suspended {
|
||||||
|
return q.RestartHeartbeatWait(ctx, id)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if !moderated(c, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Monitors leave or rejoin the schedule with its next reconciliation.
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminDeleteOrg(c *gin.Context) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
err = s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
org, err := q.GetOrg(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
auditDetail(c, "slug", org.Slug)
|
||||||
|
auditDetail(c, "name", org.Name)
|
||||||
|
return purgeOrg(ctx, q, id)
|
||||||
|
})
|
||||||
|
if moderated(c, err) {
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// moderatedUser loads the target account, refusing platform admins: they
|
||||||
|
// would otherwise lock each other, or themselves, out.
|
||||||
|
func (s *Server) moderatedUser(c *gin.Context) (store.User, bool) {
|
||||||
|
id, err := uuid.Parse(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
fail(c, http.StatusNotFound, "not_found")
|
||||||
|
return store.User{}, false
|
||||||
|
}
|
||||||
|
u, err := s.loadUser(c.Request.Context(), id)
|
||||||
|
if !moderated(c, err) {
|
||||||
|
return u, false
|
||||||
|
}
|
||||||
|
auditDetail(c, "email", u.Email)
|
||||||
|
if u.IsAdmin {
|
||||||
|
fail(c, http.StatusConflict, "target_is_admin")
|
||||||
|
return u, false
|
||||||
|
}
|
||||||
|
return u, true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminSuspendUser(c *gin.Context) {
|
||||||
|
id, req, ok := suspension(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
u, ok := s.moderatedUser(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
_, err := q.SuspendUser(ctx, store.SuspendUserParams{ID: id, Suspend: req.Suspended, Reason: req.Reason})
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
if !moderated(c, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if req.Suspended {
|
||||||
|
if err := s.sessions.DeleteAllForUser(ctx, u.ID); err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) adminDeleteUser(c *gin.Context) {
|
||||||
|
u, ok := s.moderatedUser(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := c.Request.Context()
|
||||||
|
shared, orgsDeleted, err := s.eraseAccount(ctx, u)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(shared) > 0 {
|
||||||
|
c.JSON(http.StatusConflict, gin.H{
|
||||||
|
"error": "owns_shared_orgs", "message": i18n.T(ctx, "error.user_owns_shared_orgs"), "organizations": shared,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auditDetail(c, "organizations_deleted", orgsDeleted)
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) moderationView(c *gin.Context) (web.ModerationView, error) {
|
||||||
|
pages, err := s.moderatedPages(c)
|
||||||
|
v := web.ModerationView{Search: strings.TrimSpace(c.Query("q")), Limited: len(pages) == moderationRows}
|
||||||
|
state := func(at *time.Time, reason string) string {
|
||||||
|
switch {
|
||||||
|
case at == nil:
|
||||||
|
return ""
|
||||||
|
case reason == "":
|
||||||
|
return "-"
|
||||||
|
}
|
||||||
|
return reason
|
||||||
|
}
|
||||||
|
for _, p := range pages {
|
||||||
|
u := strings.TrimSuffix(s.cfg.StatusPageURL, "/") + "/" + p.Slug
|
||||||
|
if p.Domain != "" {
|
||||||
|
u = "https://" + p.Domain + "/"
|
||||||
|
}
|
||||||
|
mp := web.ModeratedPage{
|
||||||
|
ID: p.ID.String(), Title: p.Title, Slug: p.Slug, URL: u, Created: p.CreatedAt.Format(time.DateOnly),
|
||||||
|
Published: p.Published, Suspended: state(p.SuspendedAt, p.Reason),
|
||||||
|
Org: web.ModeratedTarget{ID: p.Org.ID.String(), Name: p.Org.Name, Detail: p.Org.Slug, Suspended: state(p.Org.SuspendedAt, p.Org.Reason)},
|
||||||
|
}
|
||||||
|
if p.Domain != "" {
|
||||||
|
mp.Slug = p.Domain
|
||||||
|
}
|
||||||
|
if p.Owner != nil {
|
||||||
|
mp.Owner = &web.ModeratedTarget{ID: p.Owner.ID.String(), Name: p.Owner.Email, Suspended: state(p.Owner.SuspendedAt, p.Owner.Reason), Admin: p.Owner.Admin}
|
||||||
|
}
|
||||||
|
v.Pages = append(v.Pages, mp)
|
||||||
|
}
|
||||||
|
return v, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package api_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||||
|
)
|
||||||
|
|
||||||
|
const testPassword = "correct horse battery"
|
||||||
|
|
||||||
|
func TestModeration(t *testing.T) {
|
||||||
|
e := newEnv(t)
|
||||||
|
ctx := context.Background()
|
||||||
|
admin := e.browser(t)
|
||||||
|
admin.signup("admin@"+uniq("mod")+".test", uniq("mod-admin-"))
|
||||||
|
if err := tenant.New(e.dbPool).Tx(ctx, tenant.Global(), func(q *store.Queries) error {
|
||||||
|
return q.MakeAdmin(ctx, admin.userIDSelf())
|
||||||
|
}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ownerEmail := "owner@" + uniq("mod") + ".test"
|
||||||
|
owner := e.browser(t)
|
||||||
|
owner.signup(ownerEmail, uniq("mod-org-"))
|
||||||
|
slug := uniq("acme-")
|
||||||
|
_, page := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": slug, "title": "Acme Status", "published": true})
|
||||||
|
_, draft := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": uniq("draft-"), "title": "Draft", "published": false})
|
||||||
|
_, hb := owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "Backup", "type": "heartbeat", "interval_seconds": 3600})
|
||||||
|
_, region := e.platformChecker(t, uniq("eu-"))
|
||||||
|
_, web := owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "Web", "type": "tcp", "target": "example.com:443", "interval_seconds": 60, "regions": []string{region}})
|
||||||
|
scheduled := func() bool {
|
||||||
|
var rows []store.ListEnabledMonitorsForScheduleRow
|
||||||
|
_ = tenant.New(e.dbPool).Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||||
|
var err error
|
||||||
|
rows, err = q.ListEnabledMonitorsForSchedule(ctx)
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
for _, r := range rows {
|
||||||
|
if r.ID.String() == web["id"] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
_, tok := owner.do("POST", "/api/v1/org/tokens", map[string]any{"name": "ci", "permissions": []string{"monitors.read"}})
|
||||||
|
api := &browser{t: t, base: owner.base, hc: e.srv.Client(), bearer: tok["token"].(string)}
|
||||||
|
sp := e.statuspageClient(t, nil)
|
||||||
|
served := func() bool {
|
||||||
|
_, err := sp.Page(ctx, "", slug)
|
||||||
|
if err != nil && !errors.Is(err, agentapi.ErrNotFound) {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return err == nil
|
||||||
|
}
|
||||||
|
// Pings of paused monitors are answered, so cron jobs do not fail, but
|
||||||
|
// not recorded.
|
||||||
|
recorded := func() bool {
|
||||||
|
resp, err := e.srv.Client().Post(e.srv.URL+"/hb/"+hb["target"].(string), "text/plain", nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
b, _ := io.ReadAll(resp.Body)
|
||||||
|
_ = resp.Body.Close()
|
||||||
|
return resp.StatusCode == http.StatusOK && !strings.Contains(string(b), "paused")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only admins see the list; it holds published pages with their
|
||||||
|
// organization and owner, and search narrows it.
|
||||||
|
if st, _ := owner.do("GET", "/api/v1/admin/status-pages", nil); st != http.StatusForbidden {
|
||||||
|
t.Errorf("non-admin listing = %d", st)
|
||||||
|
}
|
||||||
|
_, list := admin.do("GET", "/api/v1/admin/status-pages?q="+slug, nil)
|
||||||
|
raw := mustJSON(list)
|
||||||
|
if !strings.Contains(raw, slug) || !strings.Contains(raw, ownerEmail) || strings.Contains(raw, draft["slug"].(string)) {
|
||||||
|
t.Fatalf("list = %s", raw)
|
||||||
|
}
|
||||||
|
pg := list["status_pages"].([]any)[0].(map[string]any)
|
||||||
|
orgID := pg["org"].(map[string]any)["id"].(string)
|
||||||
|
userID := pg["owner"].(map[string]any)["id"].(string)
|
||||||
|
if _, other := admin.do("GET", "/api/v1/admin/status-pages?q=no-such-page-"+slug, nil); len(other["status_pages"].([]any)) != 0 {
|
||||||
|
t.Error("search does not narrow the list")
|
||||||
|
}
|
||||||
|
if !served() {
|
||||||
|
t.Fatal("the page is not served before suspension")
|
||||||
|
}
|
||||||
|
|
||||||
|
// A suspended page goes offline and its organization learns why.
|
||||||
|
suspend := func(path string, on bool, reason string) {
|
||||||
|
t.Helper()
|
||||||
|
if st, body := admin.do("PUT", "/api/v1/admin/"+path+"/suspension", map[string]any{"suspended": on, "reason": reason}); st != http.StatusNoContent {
|
||||||
|
t.Fatalf("suspend %s = %d %v", path, st, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
suspend("status-pages/"+page["id"].(string), true, "phishing")
|
||||||
|
if served() {
|
||||||
|
t.Error("a suspended page is served")
|
||||||
|
}
|
||||||
|
_, pages := owner.do("GET", "/api/v1/org/statuspages", nil)
|
||||||
|
if raw := mustJSON(pages); !strings.Contains(raw, `"suspended":true`) || !strings.Contains(raw, `"suspended_reason":"phishing"`) {
|
||||||
|
t.Errorf("the organization does not see the suspension: %s", raw)
|
||||||
|
}
|
||||||
|
if _, _, html := owner.page("/statuspages"); !strings.Contains(html, "suspended by the operator") {
|
||||||
|
t.Error("the page list does not mark the suspension")
|
||||||
|
}
|
||||||
|
suspend("status-pages/"+page["id"].(string), false, "")
|
||||||
|
if !served() {
|
||||||
|
t.Error("a reinstated page is not served")
|
||||||
|
}
|
||||||
|
|
||||||
|
// A suspended organization is locked out, checks and pages stop.
|
||||||
|
suspend("orgs/"+orgID, true, "unpaid")
|
||||||
|
st, body := owner.do("GET", "/api/v1/org/monitors", nil)
|
||||||
|
expect(t, "member of a suspended org", st, body, http.StatusForbidden, "org_suspended")
|
||||||
|
st, body = api.do("GET", "/api/v1/org/monitors", nil)
|
||||||
|
expect(t, "token of a suspended org", st, body, http.StatusForbidden, "org_suspended")
|
||||||
|
if served() {
|
||||||
|
t.Error("a suspended organization's page is served")
|
||||||
|
}
|
||||||
|
if recorded() {
|
||||||
|
t.Error("a heartbeat of a suspended org is recorded")
|
||||||
|
}
|
||||||
|
if scheduled() {
|
||||||
|
t.Error("monitors of a suspended org are scheduled")
|
||||||
|
}
|
||||||
|
if _, _, html := owner.page("/"); !strings.Contains(html, "The operator suspended this organization") || !strings.Contains(html, "unpaid") {
|
||||||
|
t.Error("the console does not explain the suspension")
|
||||||
|
}
|
||||||
|
suspend("orgs/"+orgID, false, "")
|
||||||
|
if st, _ := owner.do("GET", "/api/v1/org/monitors", nil); st != http.StatusOK || !scheduled() {
|
||||||
|
t.Errorf("member of a reinstated org = %d, scheduled = %v", st, scheduled())
|
||||||
|
}
|
||||||
|
if !recorded() {
|
||||||
|
t.Error("a heartbeat after reinstatement is not recorded")
|
||||||
|
}
|
||||||
|
|
||||||
|
// A suspended account is signed out and kept out, tokens included.
|
||||||
|
suspend("users/"+userID, true, "")
|
||||||
|
if st, _ := owner.do("GET", "/api/v1/me", nil); st != http.StatusUnauthorized {
|
||||||
|
t.Errorf("session of a suspended account = %d", st)
|
||||||
|
}
|
||||||
|
if st, _ := api.do("GET", "/api/v1/org/monitors", nil); st != http.StatusUnauthorized {
|
||||||
|
t.Errorf("token of a suspended account = %d", st)
|
||||||
|
}
|
||||||
|
fresh := e.browser(t)
|
||||||
|
st, body = fresh.do("POST", "/api/v1/auth/login", map[string]any{"email": ownerEmail, "password": testPassword})
|
||||||
|
expect(t, "sign-in of a suspended account", st, body, http.StatusForbidden, "account_suspended")
|
||||||
|
if st, _ := e.browser(t).do("POST", "/api/v1/auth/login", map[string]any{"email": ownerEmail, "password": "wrong password"}); st != http.StatusUnauthorized {
|
||||||
|
t.Error("a wrong password reveals the suspension")
|
||||||
|
}
|
||||||
|
suspend("users/"+userID, false, "")
|
||||||
|
if st, _ := fresh.do("POST", "/api/v1/auth/login", map[string]any{"email": ownerEmail, "password": testPassword}); st != http.StatusOK {
|
||||||
|
t.Errorf("sign-in after reinstatement = %d", st)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admins are out of reach, also for themselves.
|
||||||
|
st, body = admin.do("PUT", "/api/v1/admin/users/"+admin.userIDSelf().String()+"/suspension", map[string]any{"suspended": true})
|
||||||
|
expect(t, "suspend an admin", st, body, http.StatusConflict, "target_is_admin")
|
||||||
|
st, body = admin.do("DELETE", "/api/v1/admin/users/"+admin.userIDSelf().String(), nil)
|
||||||
|
expect(t, "delete an admin", st, body, http.StatusConflict, "target_is_admin")
|
||||||
|
|
||||||
|
// An owner of a shared organization cannot be deleted before it.
|
||||||
|
fresh.do("POST", "/api/v1/me/org", map[string]any{"org_id": orgID})
|
||||||
|
e.joinVia(t, fresh.invite("m@"+uniq("mod")+".test", fresh.roleID("viewer")))
|
||||||
|
st, body = admin.do("DELETE", "/api/v1/admin/users/"+userID, nil)
|
||||||
|
expect(t, "delete the owner of a shared org", st, body, http.StatusConflict, "owns_shared_orgs")
|
||||||
|
|
||||||
|
// Deleting: page, organization, account.
|
||||||
|
if st, _ := admin.do("DELETE", "/api/v1/admin/status-pages/"+page["id"].(string), nil); st != http.StatusNoContent || served() {
|
||||||
|
t.Errorf("delete page = %d", st)
|
||||||
|
}
|
||||||
|
if st, _ := admin.do("DELETE", "/api/v1/admin/orgs/"+orgID, nil); st != http.StatusNoContent {
|
||||||
|
t.Errorf("delete org = %d", st)
|
||||||
|
}
|
||||||
|
if st, body := admin.do("DELETE", "/api/v1/admin/users/"+userID, nil); st != http.StatusNoContent {
|
||||||
|
t.Errorf("delete account = %d %v", st, body)
|
||||||
|
}
|
||||||
|
if st, _ := e.browser(t).do("POST", "/api/v1/auth/login", map[string]any{"email": ownerEmail, "password": testPassword}); st != http.StatusUnauthorized {
|
||||||
|
t.Error("the deleted account can still sign in")
|
||||||
|
}
|
||||||
|
if st, _ := admin.do("DELETE", "/api/v1/admin/orgs/"+orgID, nil); st != http.StatusNotFound {
|
||||||
|
t.Error("deleting a deleted org is not 404")
|
||||||
|
}
|
||||||
|
|
||||||
|
// The admin page shows the list.
|
||||||
|
if _, _, html := admin.page("/admin"); !strings.Contains(html, `id="moderation"`) {
|
||||||
|
t.Error("the admin page lacks the status page list")
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-2
@@ -50,7 +50,7 @@ var flashErrors = map[ssoError]bool{
|
|||||||
"sso_unavailable": true, "sso_provider_error": true, "sso_expired": true,
|
"sso_unavailable": true, "sso_provider_error": true, "sso_expired": true,
|
||||||
"sso_denied": true, "sso_not_member": true, "sso_not_provisioned": true,
|
"sso_denied": true, "sso_not_member": true, "sso_not_provisioned": true,
|
||||||
"sso_link_required": true, "sso_identity_taken": true, "invalid_credentials": true,
|
"sso_link_required": true, "sso_identity_taken": true, "invalid_credentials": true,
|
||||||
"totp_required_by_org": true, "sso_required_by_org": true,
|
"totp_required_by_org": true, "sso_required_by_org": true, "account_suspended": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) pageFor(c *gin.Context, titleID string) web.Page {
|
func (s *Server) pageFor(c *gin.Context, titleID string) web.Page {
|
||||||
@@ -134,6 +134,10 @@ func (s *Server) consoleMe(c *gin.Context, sess *auth.Session) (web.Me, *princip
|
|||||||
if err != nil || !member {
|
if err != nil || !member {
|
||||||
return me, nil, err
|
return me, nil, err
|
||||||
}
|
}
|
||||||
|
if p.Org.SuspendedAt != nil {
|
||||||
|
me.OrgSuspended, me.SuspendedReason = true, p.Org.SuspendedReason
|
||||||
|
return me, nil, nil
|
||||||
|
}
|
||||||
for _, perm := range authz.All {
|
for _, perm := range authz.All {
|
||||||
me.Can[string(perm)] = p.Grants.Can(perm)
|
me.Can[string(perm)] = p.Grants.Can(perm)
|
||||||
}
|
}
|
||||||
@@ -502,7 +506,12 @@ func (s *Server) adminPage(c *gin.Context) {
|
|||||||
for _, t := range check.Types {
|
for _, t := range check.Types {
|
||||||
types = append(types, web.CheckTypeOption{Type: string(t), Enabled: !off[string(t)]})
|
types = append(types, web.CheckTypeOption{Type: string(t), Enabled: !off[string(t)]})
|
||||||
}
|
}
|
||||||
web.Render(c, http.StatusOK, web.AdminPage(s.pageFor(c, "admin.title"), me, v, storageView(c, stats), types, s.platformPrivate(ctx)))
|
mod, err := s.moderationView(c)
|
||||||
|
if err != nil {
|
||||||
|
internalError(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
web.Render(c, http.StatusOK, web.AdminPage(s.pageFor(c, "admin.title"), me, v, storageView(c, stats), types, s.platformPrivate(ctx), mod))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) buildRegionsView(ctx context.Context, regions []store.Region, agents []store.ListAgentsRow, apiBase, next string, manageable func(store.Region) bool) (web.RegionsView, error) {
|
func (s *Server) buildRegionsView(ctx context.Context, regions []store.Region, agents []store.ListAgentsRow, apiBase, next string, manageable func(store.Region) bool) (web.RegionsView, error) {
|
||||||
|
|||||||
@@ -167,6 +167,13 @@ func (s *Server) Mount(r gin.IRouter) {
|
|||||||
admin.GET("/check-types", s.adminListCheckTypes)
|
admin.GET("/check-types", s.adminListCheckTypes)
|
||||||
admin.PUT("/check-types", s.adminSetCheckTypes)
|
admin.PUT("/check-types", s.adminSetCheckTypes)
|
||||||
admin.GET("/checker-network", s.adminGetCheckerNetwork)
|
admin.GET("/checker-network", s.adminGetCheckerNetwork)
|
||||||
|
admin.GET("/status-pages", s.adminListStatusPages)
|
||||||
|
admin.PUT("/status-pages/:id/suspension", s.adminSuspendStatusPage)
|
||||||
|
admin.DELETE("/status-pages/:id", s.adminDeleteStatusPage)
|
||||||
|
admin.PUT("/orgs/:id/suspension", s.adminSuspendOrg)
|
||||||
|
admin.DELETE("/orgs/:id", s.adminDeleteOrg)
|
||||||
|
admin.PUT("/users/:id/suspension", s.adminSuspendUser)
|
||||||
|
admin.DELETE("/users/:id", s.adminDeleteUser)
|
||||||
admin.PUT("/checker-network", s.adminSetCheckerNetwork)
|
admin.PUT("/checker-network", s.adminSetCheckerNetwork)
|
||||||
admin.GET("/legal", s.adminListLegal)
|
admin.GET("/legal", s.adminListLegal)
|
||||||
admin.PUT("/legal/:kind", s.adminSaveLegal)
|
admin.PUT("/legal/:kind", s.adminSaveLegal)
|
||||||
|
|||||||
+1
-1
@@ -255,7 +255,7 @@ func (s *Server) ssoCallback(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user.DisabledAt != nil {
|
if user.DisabledAt != nil {
|
||||||
s.ssoAbort(c, uuid.Nil, "invalid_credentials")
|
s.ssoAbort(c, uuid.Nil, "account_suspended")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if old := auth.Current(c); old != nil {
|
if old := auth.Current(c); old != nil {
|
||||||
|
|||||||
@@ -392,6 +392,10 @@ type statusPageView struct {
|
|||||||
DomainVerified bool `json:"domain_verified"`
|
DomainVerified bool `json:"domain_verified"`
|
||||||
// DomainRecord is the TXT record that proves control of CustomDomain.
|
// DomainRecord is the TXT record that proves control of CustomDomain.
|
||||||
DomainRecord *dnsRecord `json:"domain_record,omitempty"`
|
DomainRecord *dnsRecord `json:"domain_record,omitempty"`
|
||||||
|
// Suspended is set when platform admins took the page offline; it is
|
||||||
|
// not served whatever Published says.
|
||||||
|
Suspended bool `json:"suspended,omitempty"`
|
||||||
|
SuspendedReason string `json:"suspended_reason,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type dnsRecord struct {
|
type dnsRecord struct {
|
||||||
@@ -405,6 +409,7 @@ func viewStatusPage(p store.StatusPage) statusPageView {
|
|||||||
ID: p.ID, Slug: p.Slug, Title: p.Title, Description: p.Description,
|
ID: p.ID, Slug: p.Slug, Title: p.Title, Description: p.Description,
|
||||||
Published: p.Published, ShowComponentDetails: p.ShowComponentDetails,
|
Published: p.Published, ShowComponentDetails: p.ShowComponentDetails,
|
||||||
CustomDomain: p.CustomDomain, DomainVerified: p.DomainVerifiedAt != nil,
|
CustomDomain: p.CustomDomain, DomainVerified: p.DomainVerifiedAt != nil,
|
||||||
|
Suspended: p.SuspendedAt != nil, SuspendedReason: p.SuspendedReason,
|
||||||
}
|
}
|
||||||
_ = json.Unmarshal(p.Theme, &v.Theme)
|
_ = json.Unmarshal(p.Theme, &v.Theme)
|
||||||
if p.CustomDomain != nil {
|
if p.CustomDomain != nil {
|
||||||
|
|||||||
@@ -79,6 +79,16 @@ func (s *Server) tokenPrincipal(ctx context.Context, tok string) (*principal, in
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, "", err
|
return nil, 0, "", err
|
||||||
}
|
}
|
||||||
|
if p.Org.SuspendedAt != nil {
|
||||||
|
return nil, http.StatusForbidden, "org_suspended", nil
|
||||||
|
}
|
||||||
|
// Tokens act for their creator and stop with the creator's account.
|
||||||
|
if u, err := s.loadUser(ctx, row.UserID); err != nil || u.DisabledAt != nil {
|
||||||
|
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
return nil, 0, "", err
|
||||||
|
}
|
||||||
|
return nil, http.StatusUnauthorized, "unauthenticated", nil
|
||||||
|
}
|
||||||
p.UserID, p.TokenID = row.UserID, row.ID
|
p.UserID, p.TokenID = row.UserID, row.ID
|
||||||
p.Grants = p.Grants.Restrict(authz.NewSet(row.Permissions...))
|
p.Grants = p.Grants.Restrict(authz.NewSet(row.Permissions...))
|
||||||
return p, 0, "", nil
|
return p, 0, "", nil
|
||||||
|
|||||||
+22
-19
@@ -152,25 +152,28 @@ func TestEveryMailEventHasTexts(t *testing.T) {
|
|||||||
func TestDynamicFamilies(t *testing.T) {
|
func TestDynamicFamilies(t *testing.T) {
|
||||||
en := catalogKeys(t)["en"]
|
en := catalogKeys(t)["en"]
|
||||||
families := map[string][]string{
|
families := map[string][]string{
|
||||||
"status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"},
|
"status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"},
|
||||||
"monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "mqtt", "kafka", "rabbitmq", "grpc", "smtp", "radius", "snmp", "steam", "minecraft", "docker", "heartbeat", "alertmanager"},
|
"monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "mqtt", "kafka", "rabbitmq", "grpc", "smtp", "radius", "snmp", "steam", "minecraft", "docker", "heartbeat", "alertmanager"},
|
||||||
"agents.kind_": {"checker", "statuspage"},
|
"agents.kind_": {"checker", "statuspage"},
|
||||||
"page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"},
|
"page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"},
|
||||||
"page.component.": {"operational", "degraded", "outage", "unknown", "maintenance"},
|
"page.component.": {"operational", "degraded", "outage", "unknown", "maintenance"},
|
||||||
"storage.level_": {"raw", "1h", "1d"},
|
"storage.level_": {"raw", "1h", "1d"},
|
||||||
"legal.": {"imprint", "privacy"},
|
"legal.": {"imprint", "privacy"},
|
||||||
"monitors.op_": {"eq", "ne", "gt", "ge", "lt", "le", "contains", "exists", "absent"},
|
"monitors.op_": {"eq", "ne", "gt", "ge", "lt", "le", "contains", "exists", "absent"},
|
||||||
"evidence.stage_": {"dns", "connect", "tls", "response", "body"},
|
"evidence.stage_": {"dns", "connect", "tls", "response", "body"},
|
||||||
"evidence.phase_": {"dns", "connect", "tls", "wait", "download"},
|
"evidence.phase_": {"dns", "connect", "tls", "wait", "download"},
|
||||||
"monitors.db_database_": {"postgres", "mysql", "mssql", "mongodb", "redis"},
|
"monitors.db_database_": {"postgres", "mysql", "mssql", "mongodb", "redis"},
|
||||||
"monitors.broker_hint_": {"mqtt", "kafka", "rabbitmq"},
|
"monitors.broker_hint_": {"mqtt", "kafka", "rabbitmq"},
|
||||||
"monitors.snmp_cond_": {"any", "eq", "ne", "contains", "gt", "ge", "lt", "le"},
|
"monitors.snmp_cond_": {"any", "eq", "ne", "contains", "gt", "ge", "lt", "le"},
|
||||||
"monitors.minecraft_": {"java", "bedrock", "hint", "edition"},
|
"monitors.minecraft_": {"java", "bedrock", "hint", "edition"},
|
||||||
"monitors.db_tls_": {"require", "verify", "disable"},
|
"monitors.db_tls_": {"require", "verify", "disable"},
|
||||||
"weekday.": {"0", "1", "2", "3", "4", "5", "6"},
|
"moderation.target_": {"page", "org", "owner"},
|
||||||
"md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"},
|
"moderation.delete_": {"page", "org", "owner"},
|
||||||
"maintenance.recurrence_": {"none", "daily", "weekly", "monthly"},
|
"moderation.delete_confirm_": {"page", "org", "owner"},
|
||||||
"storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"},
|
"weekday.": {"0", "1", "2", "3", "4", "5", "6"},
|
||||||
|
"md.": {"heading", "bold", "italic", "strike", "link", "ul", "ol", "quote", "code", "codeblock", "table", "hr"},
|
||||||
|
"maintenance.recurrence_": {"none", "daily", "weekly", "monthly"},
|
||||||
|
"storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"},
|
||||||
}
|
}
|
||||||
// Notification services name their type, group and settings.
|
// Notification services name their type, group and settings.
|
||||||
families["channels.type_"] = []string{"webhook", "email"}
|
families["channels.type_"] = []string{"webhook", "email"}
|
||||||
|
|||||||
@@ -97,8 +97,14 @@
|
|||||||
"audit.action.platform.check_types_update": "Check-Typen geändert",
|
"audit.action.platform.check_types_update": "Check-Typen geändert",
|
||||||
"audit.action.platform.checker_network_update": "Checker-Netzwerk geändert",
|
"audit.action.platform.checker_network_update": "Checker-Netzwerk geändert",
|
||||||
"audit.action.platform.legal_update": "Rechtstext der Plattform geändert",
|
"audit.action.platform.legal_update": "Rechtstext der Plattform geändert",
|
||||||
|
"audit.action.platform.org_delete": "Organisation durch Admin gelöscht",
|
||||||
|
"audit.action.platform.org_suspension": "Organisation gesperrt oder entsperrt",
|
||||||
"audit.action.platform.region_create": "Plattform-Region erstellt",
|
"audit.action.platform.region_create": "Plattform-Region erstellt",
|
||||||
"audit.action.platform.region_delete": "Plattform-Region gelöscht",
|
"audit.action.platform.region_delete": "Plattform-Region gelöscht",
|
||||||
|
"audit.action.platform.status_page_delete": "Statusseite durch Admin gelöscht",
|
||||||
|
"audit.action.platform.status_page_suspension": "Statusseite gesperrt oder entsperrt",
|
||||||
|
"audit.action.platform.user_delete": "Account durch Admin gelöscht",
|
||||||
|
"audit.action.platform.user_suspension": "Account gesperrt oder entsperrt",
|
||||||
"audit.action.region.create": "Region erstellt",
|
"audit.action.region.create": "Region erstellt",
|
||||||
"audit.action.region.delete": "Region gelöscht",
|
"audit.action.region.delete": "Region gelöscht",
|
||||||
"audit.action.role.create": "Rolle erstellt",
|
"audit.action.role.create": "Rolle erstellt",
|
||||||
@@ -448,7 +454,9 @@
|
|||||||
"console.nav.settings": "Einstellungen",
|
"console.nav.settings": "Einstellungen",
|
||||||
"console.nav.sso": "SSO",
|
"console.nav.sso": "SSO",
|
||||||
"console.nav.tokens": "API-Tokens",
|
"console.nav.tokens": "API-Tokens",
|
||||||
|
"console.org_suspended": "Der Betreiber hat diese Organisation gesperrt: Ihre Monitore werden nicht geprüft und ihre Statusseiten sind offline.",
|
||||||
"console.sso_required_action": "Mit SSO anmelden",
|
"console.sso_required_action": "Mit SSO anmelden",
|
||||||
|
"console.suspended_reason": "Grund: {{.Reason}}",
|
||||||
"console.totp_missing_action": "Jetzt einrichten",
|
"console.totp_missing_action": "Jetzt einrichten",
|
||||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) ist in allen Regionen nicht erreichbar seit {{.Since}}.\n\nLetzte Fehler:\n{{.Cause}}\n\nDu erhältst diese Nachricht, weil ein Benachrichtigungskanal deiner Organisation diese Adresse nutzt.",
|
"email.opened.body": "{{.Monitor}} ({{.Target}}) ist in allen Regionen nicht erreichbar seit {{.Since}}.\n\nLetzte Fehler:\n{{.Cause}}\n\nDu erhältst diese Nachricht, weil ein Benachrichtigungskanal deiner Organisation diese Adresse nutzt.",
|
||||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||||
@@ -456,6 +464,7 @@
|
|||||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||||
"email.test.body": "Dies ist ein Test. Wenn du ihn lesen kannst, funktioniert der Kanal.",
|
"email.test.body": "Dies ist ein Test. Wenn du ihn lesen kannst, funktioniert der Kanal.",
|
||||||
"email.test.subject": "Testbenachrichtigung von UptimeSebi",
|
"email.test.subject": "Testbenachrichtigung von UptimeSebi",
|
||||||
|
"error.account_suspended": "Dieser Account ist gesperrt. Wende dich an den Betreiber.",
|
||||||
"error.agent_protocol_unsupported": "Diese Agent-Version wird von der API nicht unterstützt. Bitte den Agent aktualisieren.",
|
"error.agent_protocol_unsupported": "Diese Agent-Version wird von der API nicht unterstützt. Bitte den Agent aktualisieren.",
|
||||||
"error.alert_group_not_deletable": "Die Gruppe existiert nicht oder ist die geschützte Standardgruppe.",
|
"error.alert_group_not_deletable": "Die Gruppe existiert nicht oder ist die geschützte Standardgruppe.",
|
||||||
"error.all_check_types_disabled": "Lass mindestens einen Check-Typ eingeschaltet.",
|
"error.all_check_types_disabled": "Lass mindestens einen Check-Typ eingeschaltet.",
|
||||||
@@ -499,8 +508,8 @@
|
|||||||
"error.invalid_method": "Nur GET- und HEAD-Anfragen werden unterstützt.",
|
"error.invalid_method": "Nur GET- und HEAD-Anfragen werden unterstützt.",
|
||||||
"error.invalid_monitor": "Einer der Monitore existiert nicht oder ist doppelt aufgeführt.",
|
"error.invalid_monitor": "Einer der Monitore existiert nicht oder ist doppelt aufgeführt.",
|
||||||
"error.invalid_permissions": "Mindestens eine Berechtigung auswählen.",
|
"error.invalid_permissions": "Mindestens eine Berechtigung auswählen.",
|
||||||
"error.invalid_quiet_hours": "Prüfe Startzeit, Endzeit und Wochentage der Ruhezeiten.",
|
|
||||||
"error.invalid_query": "Gib eine PromQL-Abfrage mit höchstens 2000 Zeichen ein.",
|
"error.invalid_query": "Gib eine PromQL-Abfrage mit höchstens 2000 Zeichen ein.",
|
||||||
|
"error.invalid_quiet_hours": "Prüfe Startzeit, Endzeit und Wochentage der Ruhezeiten.",
|
||||||
"error.invalid_record": "Nicht unterstützter DNS-Record-Typ.",
|
"error.invalid_record": "Nicht unterstützter DNS-Record-Typ.",
|
||||||
"error.invalid_region": "Unbekannte Region.",
|
"error.invalid_region": "Unbekannte Region.",
|
||||||
"error.invalid_region_key": "Regions-Schlüssel haben 1–40 Zeichen: a–z, 0–9 und Bindestrich.",
|
"error.invalid_region_key": "Regions-Schlüssel haben 1–40 Zeichen: a–z, 0–9 und Bindestrich.",
|
||||||
@@ -524,6 +533,7 @@
|
|||||||
"error.no_password": "Konto ohne Passwort.",
|
"error.no_password": "Konto ohne Passwort.",
|
||||||
"error.not_found": "Nicht gefunden.",
|
"error.not_found": "Nicht gefunden.",
|
||||||
"error.org_not_found": "Organisation nicht gefunden.",
|
"error.org_not_found": "Organisation nicht gefunden.",
|
||||||
|
"error.org_suspended": "Der Betreiber hat diese Organisation gesperrt.",
|
||||||
"error.owner_cannot_be_removed": "Der Owner kann nicht entfernt werden.",
|
"error.owner_cannot_be_removed": "Der Owner kann nicht entfernt werden.",
|
||||||
"error.owner_has_all_permissions": "Der Owner hat bereits alle Berechtigungen.",
|
"error.owner_has_all_permissions": "Der Owner hat bereits alle Berechtigungen.",
|
||||||
"error.owns_shared_orgs": "Du besitzt Organisationen mit weiteren Mitgliedern. Übergib oder lösche sie zuerst.",
|
"error.owns_shared_orgs": "Du besitzt Organisationen mit weiteren Mitgliedern. Übergib oder lösche sie zuerst.",
|
||||||
@@ -553,6 +563,7 @@
|
|||||||
"error.sso_provider_error": "Der Identity Provider konnte die Anmeldung nicht abschließen.",
|
"error.sso_provider_error": "Der Identity Provider konnte die Anmeldung nicht abschließen.",
|
||||||
"error.sso_required_by_org": "Diese Organisation verlangt die Anmeldung über ihren SSO-Provider.",
|
"error.sso_required_by_org": "Diese Organisation verlangt die Anmeldung über ihren SSO-Provider.",
|
||||||
"error.sso_unavailable": "Für diese Organisation ist kein Single Sign-on verfügbar.",
|
"error.sso_unavailable": "Für diese Organisation ist kein Single Sign-on verfügbar.",
|
||||||
|
"error.target_is_admin": "Plattform-Admins können hier nicht gesperrt oder gelöscht werden.",
|
||||||
"error.token_lifetime_exceeds_policy": {
|
"error.token_lifetime_exceeds_policy": {
|
||||||
"one": "Tokens in dieser Organisation müssen innerhalb von {{.Count}} Tag ablaufen.",
|
"one": "Tokens in dieser Organisation müssen innerhalb von {{.Count}} Tag ablaufen.",
|
||||||
"other": "Tokens in dieser Organisation müssen innerhalb von {{.Count}} Tagen ablaufen."
|
"other": "Tokens in dieser Organisation müssen innerhalb von {{.Count}} Tagen ablaufen."
|
||||||
@@ -562,6 +573,7 @@
|
|||||||
"error.totp_setup_expired": "Einrichtung abgelaufen, bitte neu starten.",
|
"error.totp_setup_expired": "Einrichtung abgelaufen, bitte neu starten.",
|
||||||
"error.unauthenticated": "Anmeldung erforderlich.",
|
"error.unauthenticated": "Anmeldung erforderlich.",
|
||||||
"error.unsupported_locale": "Sprache wird nicht unterstützt.",
|
"error.unsupported_locale": "Sprache wird nicht unterstützt.",
|
||||||
|
"error.user_owns_shared_orgs": "Dem Account gehören Organisationen mit weiteren Mitgliedern. Lösche diese zuerst oder übertrage sie.",
|
||||||
"evidence.body": "Antwort-Body",
|
"evidence.body": "Antwort-Body",
|
||||||
"evidence.body_binary": "Binärer Inhalt, nicht gespeichert.",
|
"evidence.body_binary": "Binärer Inhalt, nicht gespeichert.",
|
||||||
"evidence.body_empty": "Leer.",
|
"evidence.body_empty": "Leer.",
|
||||||
@@ -805,6 +817,31 @@
|
|||||||
"members.scope_org": "gesamte Organisation",
|
"members.scope_org": "gesamte Organisation",
|
||||||
"members.title": "Mitglieder",
|
"members.title": "Mitglieder",
|
||||||
"members.unassign": "Rolle entfernen",
|
"members.unassign": "Rolle entfernen",
|
||||||
|
"moderation.actions": "Sperren oder löschen …",
|
||||||
|
"moderation.created": "Erstellt",
|
||||||
|
"moderation.delete_confirm_org": "Organisation {{.Name}} mit allen Monitoren, Ergebnissen und Statusseiten endgültig löschen?",
|
||||||
|
"moderation.delete_confirm_owner": "Account {{.Name}} endgültig löschen? Organisationen, in denen nur er Mitglied ist, werden mitgelöscht.",
|
||||||
|
"moderation.delete_confirm_page": "Statusseite {{.Name}} endgültig löschen?",
|
||||||
|
"moderation.delete_org": "Organisation löschen",
|
||||||
|
"moderation.delete_owner": "Account löschen",
|
||||||
|
"moderation.delete_page": "Statusseite löschen",
|
||||||
|
"moderation.intro": "Alle veröffentlichten Statusseiten und alle gesperrten Seiten, Organisationen und Accounts, jeweils mit Organisation und Inhaber. Sperren lässt sich rückgängig machen und zeigt der Organisation den Grund; Löschen ist endgültig.",
|
||||||
|
"moderation.limited": "Nur die neuesten 500 werden angezeigt; die Suche grenzt ein.",
|
||||||
|
"moderation.none": "Keine Statusseite gefunden.",
|
||||||
|
"moderation.org": "Organisation",
|
||||||
|
"moderation.owner": "Inhaber",
|
||||||
|
"moderation.owner_is_admin": "Der Inhaber ist Plattform-Admin und kann hier nicht gesperrt oder gelöscht werden.",
|
||||||
|
"moderation.page": "Statusseite",
|
||||||
|
"moderation.reason": "Grund (optional)",
|
||||||
|
"moderation.reinstate": "Entsperren",
|
||||||
|
"moderation.search": "Titel, Adresse, Organisation oder E-Mail",
|
||||||
|
"moderation.search_button": "Suchen",
|
||||||
|
"moderation.suspend": "Sperren",
|
||||||
|
"moderation.suspended": "Gesperrt",
|
||||||
|
"moderation.target_org": "Organisation",
|
||||||
|
"moderation.target_owner": "Inhaber-Account",
|
||||||
|
"moderation.target_page": "Statusseite",
|
||||||
|
"moderation.title": "Öffentliche Statusseiten",
|
||||||
"monitors.alertmanager_hint": "Ausgefallen, solange ein Alert feuert, der alle Matcher erfüllt. Alerts kommen über einen Empfänger:",
|
"monitors.alertmanager_hint": "Ausgefallen, solange ein Alert feuert, der alle Matcher erfüllt. Alerts kommen über einen Empfänger:",
|
||||||
"monitors.assertion_op": "Operator",
|
"monitors.assertion_op": "Operator",
|
||||||
"monitors.assertion_path": "Pfad",
|
"monitors.assertion_path": "Pfad",
|
||||||
@@ -1031,6 +1068,8 @@
|
|||||||
"pages.show_details": "Monitor-Details beim Anklicken anzeigen",
|
"pages.show_details": "Monitor-Details beim Anklicken anzeigen",
|
||||||
"pages.show_details_hint": "Erlaubt Besuchern eine Detailansicht mit 24h-Verlauf, Latenz, SLA und Regionen-Status. Ziele, Fehlermeldungen und Zugangsdaten bleiben immer privat.",
|
"pages.show_details_hint": "Erlaubt Besuchern eine Detailansicht mit 24h-Verlauf, Latenz, SLA und Regionen-Status. Ziele, Fehlermeldungen und Zugangsdaten bleiben immer privat.",
|
||||||
"pages.slug": "Kurzname (URL)",
|
"pages.slug": "Kurzname (URL)",
|
||||||
|
"pages.suspended": "vom Betreiber gesperrt",
|
||||||
|
"pages.suspended_notice": "Der Betreiber hat diese Statusseite gesperrt; sie bleibt offline, bis er sie wieder freigibt.",
|
||||||
"pages.theme": "Theme",
|
"pages.theme": "Theme",
|
||||||
"pages.title": "Statuspages",
|
"pages.title": "Statuspages",
|
||||||
"pages.value": "Wert",
|
"pages.value": "Wert",
|
||||||
|
|||||||
@@ -97,8 +97,14 @@
|
|||||||
"audit.action.platform.check_types_update": "Check types changed",
|
"audit.action.platform.check_types_update": "Check types changed",
|
||||||
"audit.action.platform.checker_network_update": "Checker network changed",
|
"audit.action.platform.checker_network_update": "Checker network changed",
|
||||||
"audit.action.platform.legal_update": "Platform legal document changed",
|
"audit.action.platform.legal_update": "Platform legal document changed",
|
||||||
|
"audit.action.platform.org_delete": "Organization deleted by admin",
|
||||||
|
"audit.action.platform.org_suspension": "Organization suspended or reinstated",
|
||||||
"audit.action.platform.region_create": "Platform region created",
|
"audit.action.platform.region_create": "Platform region created",
|
||||||
"audit.action.platform.region_delete": "Platform region deleted",
|
"audit.action.platform.region_delete": "Platform region deleted",
|
||||||
|
"audit.action.platform.status_page_delete": "Status page deleted by admin",
|
||||||
|
"audit.action.platform.status_page_suspension": "Status page suspended or reinstated",
|
||||||
|
"audit.action.platform.user_delete": "Account deleted by admin",
|
||||||
|
"audit.action.platform.user_suspension": "Account suspended or reinstated",
|
||||||
"audit.action.region.create": "Region created",
|
"audit.action.region.create": "Region created",
|
||||||
"audit.action.region.delete": "Region deleted",
|
"audit.action.region.delete": "Region deleted",
|
||||||
"audit.action.role.create": "Role created",
|
"audit.action.role.create": "Role created",
|
||||||
@@ -448,7 +454,9 @@
|
|||||||
"console.nav.settings": "Settings",
|
"console.nav.settings": "Settings",
|
||||||
"console.nav.sso": "SSO",
|
"console.nav.sso": "SSO",
|
||||||
"console.nav.tokens": "API tokens",
|
"console.nav.tokens": "API tokens",
|
||||||
|
"console.org_suspended": "The operator suspended this organization: its monitors are not checked and its status pages are offline.",
|
||||||
"console.sso_required_action": "Sign in with SSO",
|
"console.sso_required_action": "Sign in with SSO",
|
||||||
|
"console.suspended_reason": "Reason: {{.Reason}}",
|
||||||
"console.totp_missing_action": "Set up now",
|
"console.totp_missing_action": "Set up now",
|
||||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) is down in all of its regions since {{.Since}}.\n\nLast errors:\n{{.Cause}}\n\nYou receive this because a notification channel of your organization is set up for this address.",
|
"email.opened.body": "{{.Monitor}} ({{.Target}}) is down in all of its regions since {{.Since}}.\n\nLast errors:\n{{.Cause}}\n\nYou receive this because a notification channel of your organization is set up for this address.",
|
||||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||||
@@ -456,6 +464,7 @@
|
|||||||
"email.resolved.subject": "[UP] {{.Monitor}}",
|
"email.resolved.subject": "[UP] {{.Monitor}}",
|
||||||
"email.test.body": "This is a test. If you can read it, the channel works.",
|
"email.test.body": "This is a test. If you can read it, the channel works.",
|
||||||
"email.test.subject": "Test notification from UptimeSebi",
|
"email.test.subject": "Test notification from UptimeSebi",
|
||||||
|
"error.account_suspended": "This account is suspended. Contact the operator.",
|
||||||
"error.agent_protocol_unsupported": "This agent version is not supported by the API. Please update the agent.",
|
"error.agent_protocol_unsupported": "This agent version is not supported by the API. Please update the agent.",
|
||||||
"error.alert_group_not_deletable": "The group does not exist or is the protected default group.",
|
"error.alert_group_not_deletable": "The group does not exist or is the protected default group.",
|
||||||
"error.all_check_types_disabled": "Leave at least one check type on.",
|
"error.all_check_types_disabled": "Leave at least one check type on.",
|
||||||
@@ -499,8 +508,8 @@
|
|||||||
"error.invalid_method": "Only GET and HEAD requests are supported.",
|
"error.invalid_method": "Only GET and HEAD requests are supported.",
|
||||||
"error.invalid_monitor": "One of the monitors does not exist or is listed twice.",
|
"error.invalid_monitor": "One of the monitors does not exist or is listed twice.",
|
||||||
"error.invalid_permissions": "Choose at least one permission.",
|
"error.invalid_permissions": "Choose at least one permission.",
|
||||||
"error.invalid_quiet_hours": "Check start time, end time and weekdays of the quiet hours.",
|
|
||||||
"error.invalid_query": "Enter a PromQL query of at most 2000 characters.",
|
"error.invalid_query": "Enter a PromQL query of at most 2000 characters.",
|
||||||
|
"error.invalid_quiet_hours": "Check start time, end time and weekdays of the quiet hours.",
|
||||||
"error.invalid_record": "Unsupported DNS record type.",
|
"error.invalid_record": "Unsupported DNS record type.",
|
||||||
"error.invalid_region": "Unknown region.",
|
"error.invalid_region": "Unknown region.",
|
||||||
"error.invalid_region_key": "Region keys use 1–40 characters: a–z, 0–9 and hyphen.",
|
"error.invalid_region_key": "Region keys use 1–40 characters: a–z, 0–9 and hyphen.",
|
||||||
@@ -524,6 +533,7 @@
|
|||||||
"error.no_password": "This account has no password.",
|
"error.no_password": "This account has no password.",
|
||||||
"error.not_found": "Not found.",
|
"error.not_found": "Not found.",
|
||||||
"error.org_not_found": "Organization not found.",
|
"error.org_not_found": "Organization not found.",
|
||||||
|
"error.org_suspended": "The operator suspended this organization.",
|
||||||
"error.owner_cannot_be_removed": "The owner cannot be removed.",
|
"error.owner_cannot_be_removed": "The owner cannot be removed.",
|
||||||
"error.owner_has_all_permissions": "The owner already has every permission.",
|
"error.owner_has_all_permissions": "The owner already has every permission.",
|
||||||
"error.owns_shared_orgs": "You own organizations with other members. Hand them over or delete them first.",
|
"error.owns_shared_orgs": "You own organizations with other members. Hand them over or delete them first.",
|
||||||
@@ -553,6 +563,7 @@
|
|||||||
"error.sso_provider_error": "The identity provider could not complete the sign-in.",
|
"error.sso_provider_error": "The identity provider could not complete the sign-in.",
|
||||||
"error.sso_required_by_org": "This organization requires signing in through its SSO provider.",
|
"error.sso_required_by_org": "This organization requires signing in through its SSO provider.",
|
||||||
"error.sso_unavailable": "Single sign-on is not available for this organization.",
|
"error.sso_unavailable": "Single sign-on is not available for this organization.",
|
||||||
|
"error.target_is_admin": "Platform admins cannot be suspended or deleted here.",
|
||||||
"error.token_lifetime_exceeds_policy": {
|
"error.token_lifetime_exceeds_policy": {
|
||||||
"one": "Tokens in this organization must expire within {{.Count}} day.",
|
"one": "Tokens in this organization must expire within {{.Count}} day.",
|
||||||
"other": "Tokens in this organization must expire within {{.Count}} days."
|
"other": "Tokens in this organization must expire within {{.Count}} days."
|
||||||
@@ -562,6 +573,7 @@
|
|||||||
"error.totp_setup_expired": "Setup expired, please start again.",
|
"error.totp_setup_expired": "Setup expired, please start again.",
|
||||||
"error.unauthenticated": "Authentication required.",
|
"error.unauthenticated": "Authentication required.",
|
||||||
"error.unsupported_locale": "Unsupported language.",
|
"error.unsupported_locale": "Unsupported language.",
|
||||||
|
"error.user_owns_shared_orgs": "The account owns organizations with other members. Delete those or hand them over first.",
|
||||||
"evidence.body": "Response body",
|
"evidence.body": "Response body",
|
||||||
"evidence.body_binary": "Binary content, not stored.",
|
"evidence.body_binary": "Binary content, not stored.",
|
||||||
"evidence.body_empty": "Empty.",
|
"evidence.body_empty": "Empty.",
|
||||||
@@ -805,6 +817,31 @@
|
|||||||
"members.scope_org": "whole organization",
|
"members.scope_org": "whole organization",
|
||||||
"members.title": "Members",
|
"members.title": "Members",
|
||||||
"members.unassign": "Remove role",
|
"members.unassign": "Remove role",
|
||||||
|
"moderation.actions": "Suspend or delete …",
|
||||||
|
"moderation.created": "Created",
|
||||||
|
"moderation.delete_confirm_org": "Delete the organization {{.Name}} with all its monitors, results and status pages for good?",
|
||||||
|
"moderation.delete_confirm_owner": "Delete the account {{.Name}} for good? Organizations only it belongs to go with it.",
|
||||||
|
"moderation.delete_confirm_page": "Delete the status page {{.Name}} for good?",
|
||||||
|
"moderation.delete_org": "Delete organization",
|
||||||
|
"moderation.delete_owner": "Delete account",
|
||||||
|
"moderation.delete_page": "Delete status page",
|
||||||
|
"moderation.intro": "Every published status page, and every page, organization or account that is suspended, with the organization and its owner behind it. Suspending can be undone and shows the reason to the organization; deleting cannot be undone.",
|
||||||
|
"moderation.limited": "Only the newest 500 are shown; search to narrow down.",
|
||||||
|
"moderation.none": "No status page matches.",
|
||||||
|
"moderation.org": "Organization",
|
||||||
|
"moderation.owner": "Owner",
|
||||||
|
"moderation.owner_is_admin": "The owner is a platform admin and cannot be suspended or deleted here.",
|
||||||
|
"moderation.page": "Status page",
|
||||||
|
"moderation.reason": "Reason (optional)",
|
||||||
|
"moderation.reinstate": "Reinstate",
|
||||||
|
"moderation.search": "Title, address, organization or email",
|
||||||
|
"moderation.search_button": "Search",
|
||||||
|
"moderation.suspend": "Suspend",
|
||||||
|
"moderation.suspended": "Suspended",
|
||||||
|
"moderation.target_org": "Organization",
|
||||||
|
"moderation.target_owner": "Owner account",
|
||||||
|
"moderation.target_page": "Status page",
|
||||||
|
"moderation.title": "Public status pages",
|
||||||
"monitors.alertmanager_hint": "Down while an alert matching all matchers fires. Alerts arrive through a receiver:",
|
"monitors.alertmanager_hint": "Down while an alert matching all matchers fires. Alerts arrive through a receiver:",
|
||||||
"monitors.assertion_op": "Operator",
|
"monitors.assertion_op": "Operator",
|
||||||
"monitors.assertion_path": "Path",
|
"monitors.assertion_path": "Path",
|
||||||
@@ -1031,6 +1068,8 @@
|
|||||||
"pages.show_details": "Show component details on click",
|
"pages.show_details": "Show component details on click",
|
||||||
"pages.show_details_hint": "Lets visitors open a detail view with 24h history, latency, SLA and region status. Targets, errors and credentials always stay private.",
|
"pages.show_details_hint": "Lets visitors open a detail view with 24h history, latency, SLA and region status. Targets, errors and credentials always stay private.",
|
||||||
"pages.slug": "Short name (URL)",
|
"pages.slug": "Short name (URL)",
|
||||||
|
"pages.suspended": "suspended by the operator",
|
||||||
|
"pages.suspended_notice": "The operator suspended this status page; it is offline until they reinstate it.",
|
||||||
"pages.theme": "Theme",
|
"pages.theme": "Theme",
|
||||||
"pages.title": "Status pages",
|
"pages.title": "Status pages",
|
||||||
"pages.value": "Value",
|
"pages.value": "Value",
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- +goose Up
|
||||||
|
-- Platform admins suspend status pages, organizations and accounts, for
|
||||||
|
-- instance over abuse. Suspension hides or stops them without deleting
|
||||||
|
-- anything; users.disabled_at already marks suspended accounts.
|
||||||
|
ALTER TABLE status_pages ADD COLUMN suspended_at timestamptz;
|
||||||
|
ALTER TABLE status_pages ADD COLUMN suspended_reason text NOT NULL DEFAULT '' CHECK (length(suspended_reason) <= 500);
|
||||||
|
ALTER TABLE orgs ADD COLUMN suspended_at timestamptz;
|
||||||
|
ALTER TABLE orgs ADD COLUMN suspended_reason text NOT NULL DEFAULT '' CHECK (length(suspended_reason) <= 500);
|
||||||
|
ALTER TABLE users ADD COLUMN disabled_reason text NOT NULL DEFAULT '' CHECK (length(disabled_reason) <= 500);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE users DROP COLUMN disabled_reason;
|
||||||
|
ALTER TABLE orgs DROP COLUMN suspended_reason;
|
||||||
|
ALTER TABLE orgs DROP COLUMN suspended_at;
|
||||||
|
ALTER TABLE status_pages DROP COLUMN suspended_reason;
|
||||||
|
ALTER TABLE status_pages DROP COLUMN suspended_at;
|
||||||
@@ -17,6 +17,7 @@ SELECT m.id, m.org_id, m.name, m.group_id, m.interval_seconds, m.confirmations,
|
|||||||
coalesce((SELECT max(r.time) FROM check_results r
|
coalesce((SELECT max(r.time) FROM check_results r
|
||||||
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '2 days'), 'epoch')::timestamptz AS last_result
|
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '2 days'), 'epoch')::timestamptz AS last_result
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.type = 'alertmanager' AND m.enabled AND ($1::uuid IS NULL OR m.org_id = $1)
|
WHERE m.type = 'alertmanager' AND m.enabled AND ($1::uuid IS NULL OR m.org_id = $1)
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ func (q *Queries) AlertmanagerMonitors(ctx context.Context, orgID *uuid.UUID) ([
|
|||||||
const alertmanagerReceiverByHash = `-- name: AlertmanagerReceiverByHash :one
|
const alertmanagerReceiverByHash = `-- name: AlertmanagerReceiverByHash :one
|
||||||
UPDATE alertmanager_receivers SET last_received_at = now()
|
UPDATE alertmanager_receivers SET last_received_at = now()
|
||||||
WHERE token_hash = $1
|
WHERE token_hash = $1
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = alertmanager_receivers.org_id AND o.suspended_at IS NOT NULL)
|
||||||
RETURNING id, org_id
|
RETURNING id, org_id
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const heartbeatMonitor = `-- name: HeartbeatMonitor :one
|
const heartbeatMonitor = `-- name: HeartbeatMonitor :one
|
||||||
SELECT id, org_id, interval_seconds, confirmations, enabled
|
SELECT m.id, m.org_id, m.interval_seconds, m.confirmations, coalesce(m.enabled AND o.suspended_at IS NULL, false)::boolean AS enabled
|
||||||
FROM monitors WHERE type = 'heartbeat' AND target = $1
|
FROM monitors m JOIN orgs o ON o.id = m.org_id
|
||||||
|
WHERE m.type = 'heartbeat' AND m.target = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
type HeartbeatMonitorRow struct {
|
type HeartbeatMonitorRow struct {
|
||||||
@@ -45,6 +46,7 @@ SELECT m.id, m.org_id, m.interval_seconds, m.confirmations,
|
|||||||
greatest(m.updated_at, coalesce((SELECT max(r.time) FROM check_results r
|
greatest(m.updated_at, coalesce((SELECT max(r.time) FROM check_results r
|
||||||
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '3 days'), m.updated_at))::timestamptz AS waiting_since
|
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '3 days'), m.updated_at))::timestamptz AS waiting_since
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.type = 'heartbeat' AND m.enabled
|
WHERE m.type = 'heartbeat' AND m.enabled
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
+16
-11
@@ -284,6 +284,8 @@ type Org struct {
|
|||||||
RequireSso bool
|
RequireSso bool
|
||||||
ApiTokenMaxDays *int32
|
ApiTokenMaxDays *int32
|
||||||
DisabledCheckTypes []string
|
DisabledCheckTypes []string
|
||||||
|
SuspendedAt *time.Time
|
||||||
|
SuspendedReason string
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlatformSetting struct {
|
type PlatformSetting struct {
|
||||||
@@ -357,6 +359,8 @@ type StatusPage struct {
|
|||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
ShowComponentDetails bool
|
ShowComponentDetails bool
|
||||||
|
SuspendedAt *time.Time
|
||||||
|
SuspendedReason string
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusPageGroup struct {
|
type StatusPageGroup struct {
|
||||||
@@ -381,17 +385,18 @@ type StatusPageMonitor struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID uuid.UUID
|
ID uuid.UUID
|
||||||
Email string
|
Email string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
PasswordHash *string
|
PasswordHash *string
|
||||||
DisabledAt *time.Time
|
DisabledAt *time.Time
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
TotpSecret []byte
|
TotpSecret []byte
|
||||||
TotpEnabledAt *time.Time
|
TotpEnabledAt *time.Time
|
||||||
Locale *string
|
Locale *string
|
||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
|
DisabledReason string
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserIdentity struct {
|
type UserIdentity struct {
|
||||||
|
|||||||
@@ -0,0 +1,201 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.31.1
|
||||||
|
// source: moderation.sql
|
||||||
|
|
||||||
|
package store
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
const adminListStatusPages = `-- name: AdminListStatusPages :many
|
||||||
|
SELECT p.id, p.slug, p.title, p.published, p.custom_domain, p.domain_verified_at,
|
||||||
|
p.suspended_at, p.suspended_reason, p.created_at,
|
||||||
|
o.id AS org_id, o.slug AS org_slug, o.name AS org_name, o.suspended_at AS org_suspended_at, o.suspended_reason AS org_suspended_reason,
|
||||||
|
coalesce(ow.id, '00000000-0000-0000-0000-000000000000'::uuid)::uuid AS owner_id,
|
||||||
|
coalesce(ow.email::text, '')::text AS owner_email, ow.disabled_at AS owner_disabled_at,
|
||||||
|
coalesce(ow.disabled_reason, '')::text AS owner_disabled_reason, coalesce(ow.is_admin, false)::boolean AS owner_is_admin
|
||||||
|
FROM status_pages p
|
||||||
|
JOIN orgs o ON o.id = p.org_id
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT u.id, u.email, u.disabled_at, u.disabled_reason, u.is_admin FROM memberships m JOIN users u ON u.id = m.user_id
|
||||||
|
WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1
|
||||||
|
) ow ON true
|
||||||
|
WHERE (p.published OR p.suspended_at IS NOT NULL OR o.suspended_at IS NOT NULL)
|
||||||
|
AND ($1::text = ''
|
||||||
|
OR p.title ILIKE '%' || $1 || '%' OR p.slug::text ILIKE '%' || $1 || '%'
|
||||||
|
OR coalesce(p.custom_domain::text, '') ILIKE '%' || $1 || '%'
|
||||||
|
OR o.name ILIKE '%' || $1 || '%' OR o.slug::text ILIKE '%' || $1 || '%'
|
||||||
|
OR coalesce(ow.email::text, '') ILIKE '%' || $1 || '%')
|
||||||
|
ORDER BY p.created_at DESC
|
||||||
|
LIMIT $2
|
||||||
|
`
|
||||||
|
|
||||||
|
type AdminListStatusPagesParams struct {
|
||||||
|
Search string
|
||||||
|
MaxRows int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminListStatusPagesRow struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
Slug string
|
||||||
|
Title string
|
||||||
|
Published bool
|
||||||
|
CustomDomain *string
|
||||||
|
DomainVerifiedAt *time.Time
|
||||||
|
SuspendedAt *time.Time
|
||||||
|
SuspendedReason string
|
||||||
|
CreatedAt time.Time
|
||||||
|
OrgID uuid.UUID
|
||||||
|
OrgSlug string
|
||||||
|
OrgName string
|
||||||
|
OrgSuspendedAt *time.Time
|
||||||
|
OrgSuspendedReason string
|
||||||
|
OwnerID uuid.UUID
|
||||||
|
OwnerEmail string
|
||||||
|
OwnerDisabledAt *time.Time
|
||||||
|
OwnerDisabledReason string
|
||||||
|
OwnerIsAdmin bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// System scope: public status pages and suspended ones, with their
|
||||||
|
// organization and its owner, newest first, matching search in title,
|
||||||
|
// slug, domain, organization or owner email.
|
||||||
|
func (q *Queries) AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error) {
|
||||||
|
rows, err := q.db.Query(ctx, adminListStatusPages, arg.Search, arg.MaxRows)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
items := []AdminListStatusPagesRow{}
|
||||||
|
for rows.Next() {
|
||||||
|
var i AdminListStatusPagesRow
|
||||||
|
if err := rows.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.Slug,
|
||||||
|
&i.Title,
|
||||||
|
&i.Published,
|
||||||
|
&i.CustomDomain,
|
||||||
|
&i.DomainVerifiedAt,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.OrgID,
|
||||||
|
&i.OrgSlug,
|
||||||
|
&i.OrgName,
|
||||||
|
&i.OrgSuspendedAt,
|
||||||
|
&i.OrgSuspendedReason,
|
||||||
|
&i.OwnerID,
|
||||||
|
&i.OwnerEmail,
|
||||||
|
&i.OwnerDisabledAt,
|
||||||
|
&i.OwnerDisabledReason,
|
||||||
|
&i.OwnerIsAdmin,
|
||||||
|
); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
items = append(items, i)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
const restartHeartbeatWait = `-- name: RestartHeartbeatWait :exec
|
||||||
|
UPDATE monitors SET updated_at = now() WHERE org_id = $1 AND type = 'heartbeat'
|
||||||
|
`
|
||||||
|
|
||||||
|
// Heartbeats of an organization wait afresh after its suspension, during
|
||||||
|
// which pings were refused.
|
||||||
|
func (q *Queries) RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error {
|
||||||
|
_, err := q.db.Exec(ctx, restartHeartbeatWait, orgID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const suspendOrg = `-- name: SuspendOrg :one
|
||||||
|
UPDATE orgs SET suspended_at = CASE WHEN $1::boolean THEN coalesce(suspended_at, now()) END,
|
||||||
|
suspended_reason = CASE WHEN $1::boolean THEN $2::text ELSE '' END
|
||||||
|
WHERE id = $3
|
||||||
|
RETURNING id, slug, name
|
||||||
|
`
|
||||||
|
|
||||||
|
type SuspendOrgParams struct {
|
||||||
|
Suspend bool
|
||||||
|
Reason string
|
||||||
|
ID uuid.UUID
|
||||||
|
}
|
||||||
|
|
||||||
|
type SuspendOrgRow struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
Slug string
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) SuspendOrg(ctx context.Context, arg SuspendOrgParams) (SuspendOrgRow, error) {
|
||||||
|
row := q.db.QueryRow(ctx, suspendOrg, arg.Suspend, arg.Reason, arg.ID)
|
||||||
|
var i SuspendOrgRow
|
||||||
|
err := row.Scan(&i.ID, &i.Slug, &i.Name)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const suspendStatusPage = `-- name: SuspendStatusPage :one
|
||||||
|
UPDATE status_pages SET suspended_at = CASE WHEN $1::boolean THEN coalesce(suspended_at, now()) END,
|
||||||
|
suspended_reason = CASE WHEN $1::boolean THEN $2::text ELSE '' END
|
||||||
|
WHERE id = $3
|
||||||
|
RETURNING id, org_id, slug, custom_domain
|
||||||
|
`
|
||||||
|
|
||||||
|
type SuspendStatusPageParams struct {
|
||||||
|
Suspend bool
|
||||||
|
Reason string
|
||||||
|
ID uuid.UUID
|
||||||
|
}
|
||||||
|
|
||||||
|
type SuspendStatusPageRow struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
OrgID uuid.UUID
|
||||||
|
Slug string
|
||||||
|
CustomDomain *string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) SuspendStatusPage(ctx context.Context, arg SuspendStatusPageParams) (SuspendStatusPageRow, error) {
|
||||||
|
row := q.db.QueryRow(ctx, suspendStatusPage, arg.Suspend, arg.Reason, arg.ID)
|
||||||
|
var i SuspendStatusPageRow
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.OrgID,
|
||||||
|
&i.Slug,
|
||||||
|
&i.CustomDomain,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const suspendUser = `-- name: SuspendUser :one
|
||||||
|
UPDATE users SET disabled_at = CASE WHEN $1::boolean THEN coalesce(disabled_at, now()) END,
|
||||||
|
disabled_reason = CASE WHEN $1::boolean THEN $2::text ELSE '' END
|
||||||
|
WHERE id = $3
|
||||||
|
RETURNING id, email, is_admin
|
||||||
|
`
|
||||||
|
|
||||||
|
type SuspendUserParams struct {
|
||||||
|
Suspend bool
|
||||||
|
Reason string
|
||||||
|
ID uuid.UUID
|
||||||
|
}
|
||||||
|
|
||||||
|
type SuspendUserRow struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
Email string
|
||||||
|
IsAdmin bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) SuspendUser(ctx context.Context, arg SuspendUserParams) (SuspendUserRow, error) {
|
||||||
|
row := q.db.QueryRow(ctx, suspendUser, arg.Suspend, arg.Reason, arg.ID)
|
||||||
|
var i SuspendUserRow
|
||||||
|
err := row.Scan(&i.ID, &i.Email, &i.IsAdmin)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
@@ -156,6 +156,7 @@ const listEnabledMonitorsForSchedule = `-- name: ListEnabledMonitorsForSchedule
|
|||||||
SELECT m.id, m.interval_seconds, array_agg(r.region_id::text ORDER BY r.region_id)::text[] AS regions
|
SELECT m.id, m.interval_seconds, array_agg(r.region_id::text ORDER BY r.region_id)::text[] AS regions
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id
|
JOIN monitor_regions r ON r.monitor_id = m.id
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.enabled
|
WHERE m.enabled
|
||||||
GROUP BY m.id, m.interval_seconds
|
GROUP BY m.id, m.interval_seconds
|
||||||
`
|
`
|
||||||
@@ -253,6 +254,7 @@ func (q *Queries) MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uu
|
|||||||
const monitorsForJobs = `-- name: MonitorsForJobs :many
|
const monitorsForJobs = `-- name: MonitorsForJobs :many
|
||||||
SELECT m.id, m.org_id, m.name, m.type, m.target, m.interval_seconds, m.timeout_ms, m.config, m.enabled, m.created_at, m.updated_at, m.confirmations, m.group_id FROM monitors m
|
SELECT m.id, m.org_id, m.name, m.type, m.target, m.interval_seconds, m.timeout_ms, m.config, m.enabled, m.created_at, m.updated_at, m.confirmations, m.group_id FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = $1
|
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = $1
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.id = ANY ($2::uuid[]) AND m.enabled
|
WHERE m.id = ANY ($2::uuid[]) AND m.enabled
|
||||||
AND ($3::uuid IS NULL OR m.org_id = $3)
|
AND ($3::uuid IS NULL OR m.org_id = $3)
|
||||||
`
|
`
|
||||||
@@ -305,6 +307,7 @@ SELECT m.id, m.org_id, m.name, m.target, m.interval_seconds, m.confirmations,
|
|||||||
(SELECT array_agg(r2.region_id::text ORDER BY r2.region_id) FROM monitor_regions r2 WHERE r2.monitor_id = m.id)::text[] AS regions
|
(SELECT array_agg(r2.region_id::text ORDER BY r2.region_id) FROM monitor_regions r2 WHERE r2.monitor_id = m.id)::text[] AS regions
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = $1
|
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = $1
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.id = ANY ($2::uuid[]) AND m.enabled
|
WHERE m.id = ANY ($2::uuid[]) AND m.enabled
|
||||||
AND ($3::uuid IS NULL OR m.org_id = $3)
|
AND ($3::uuid IS NULL OR m.org_id = $3)
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
const createOrg = `-- name: CreateOrg :one
|
const createOrg = `-- name: CreateOrg :one
|
||||||
INSERT INTO orgs (id, slug, name) VALUES ($1, $2, $3)
|
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, disabled_check_types
|
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types, suspended_at, suspended_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateOrgParams struct {
|
type CreateOrgParams struct {
|
||||||
@@ -35,6 +35,8 @@ func (q *Queries) CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, erro
|
|||||||
&i.RequireSso,
|
&i.RequireSso,
|
||||||
&i.ApiTokenMaxDays,
|
&i.ApiTokenMaxDays,
|
||||||
&i.DisabledCheckTypes,
|
&i.DisabledCheckTypes,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -52,7 +54,7 @@ func (q *Queries) DeleteOrg(ctx context.Context, id uuid.UUID) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getOrg = `-- name: GetOrg :one
|
const getOrg = `-- name: GetOrg :one
|
||||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs WHERE id = $1
|
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types, suspended_at, suspended_reason FROM orgs WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) {
|
func (q *Queries) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) {
|
||||||
@@ -68,12 +70,14 @@ func (q *Queries) GetOrg(ctx context.Context, id uuid.UUID) (Org, error) {
|
|||||||
&i.RequireSso,
|
&i.RequireSso,
|
||||||
&i.ApiTokenMaxDays,
|
&i.ApiTokenMaxDays,
|
||||||
&i.DisabledCheckTypes,
|
&i.DisabledCheckTypes,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOrgBySlug = `-- name: GetOrgBySlug :one
|
const getOrgBySlug = `-- name: GetOrgBySlug :one
|
||||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs WHERE slug = $1
|
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types, suspended_at, suspended_reason FROM orgs WHERE slug = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
||||||
@@ -89,12 +93,14 @@ func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
|||||||
&i.RequireSso,
|
&i.RequireSso,
|
||||||
&i.ApiTokenMaxDays,
|
&i.ApiTokenMaxDays,
|
||||||
&i.DisabledCheckTypes,
|
&i.DisabledCheckTypes,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const listOrgs = `-- name: ListOrgs :many
|
const listOrgs = `-- name: ListOrgs :many
|
||||||
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types FROM orgs ORDER BY name
|
SELECT id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types, suspended_at, suspended_reason FROM orgs ORDER BY name
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
||||||
@@ -116,6 +122,8 @@ func (q *Queries) ListOrgs(ctx context.Context) ([]Org, error) {
|
|||||||
&i.RequireSso,
|
&i.RequireSso,
|
||||||
&i.ApiTokenMaxDays,
|
&i.ApiTokenMaxDays,
|
||||||
&i.DisabledCheckTypes,
|
&i.DisabledCheckTypes,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -144,7 +152,7 @@ func (q *Queries) SetOrgDisabledCheckTypes(ctx context.Context, arg SetOrgDisabl
|
|||||||
const updateOrgPolicy = `-- name: UpdateOrgPolicy :one
|
const updateOrgPolicy = `-- name: UpdateOrgPolicy :one
|
||||||
UPDATE orgs SET require_totp = $2, require_sso = $3, api_token_max_days = $4, updated_at = now()
|
UPDATE orgs SET require_totp = $2, require_sso = $3, api_token_max_days = $4, updated_at = now()
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types
|
RETURNING id, slug, name, created_at, updated_at, require_totp, require_sso, api_token_max_days, disabled_check_types, suspended_at, suspended_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type UpdateOrgPolicyParams struct {
|
type UpdateOrgPolicyParams struct {
|
||||||
@@ -172,6 +180,8 @@ func (q *Queries) UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams
|
|||||||
&i.RequireSso,
|
&i.RequireSso,
|
||||||
&i.ApiTokenMaxDays,
|
&i.ApiTokenMaxDays,
|
||||||
&i.DisabledCheckTypes,
|
&i.DisabledCheckTypes,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,10 @@ type Querier interface {
|
|||||||
AddMonitorAlertGroup(ctx context.Context, arg AddMonitorAlertGroupParams) (int64, error)
|
AddMonitorAlertGroup(ctx context.Context, arg AddMonitorAlertGroupParams) (int64, error)
|
||||||
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
|
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
|
||||||
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
|
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
|
||||||
|
// System scope: public status pages and suspended ones, with their
|
||||||
|
// organization and its owner, newest first, matching search in title,
|
||||||
|
// slug, domain, organization or owner email.
|
||||||
|
AdminListStatusPages(ctx context.Context, arg AdminListStatusPagesParams) ([]AdminListStatusPagesRow, error)
|
||||||
AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error)
|
AgentInstancesByID(ctx context.Context, ids []uuid.UUID) ([]AgentInstancesByIDRow, error)
|
||||||
// System scope: enabled alertmanager monitors of org, with when they last
|
// System scope: enabled alertmanager monitors of org, with when they last
|
||||||
// recorded a result.
|
// recorded a result.
|
||||||
@@ -251,6 +255,9 @@ type Querier interface {
|
|||||||
ReparentStatusPageGroupChildren(ctx context.Context, arg ReparentStatusPageGroupChildrenParams) error
|
ReparentStatusPageGroupChildren(ctx context.Context, arg ReparentStatusPageGroupChildrenParams) error
|
||||||
ReparentStatusPageGroupMonitors(ctx context.Context, arg ReparentStatusPageGroupMonitorsParams) error
|
ReparentStatusPageGroupMonitors(ctx context.Context, arg ReparentStatusPageGroupMonitorsParams) error
|
||||||
ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (Incident, error)
|
ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (Incident, error)
|
||||||
|
// Heartbeats of an organization wait afresh after its suspension, during
|
||||||
|
// which pings were refused.
|
||||||
|
RestartHeartbeatWait(ctx context.Context, orgID uuid.UUID) error
|
||||||
// The organization's latest results run by one checker instance.
|
// The organization's latest results run by one checker instance.
|
||||||
ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
|
ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
|
||||||
ScrubAuditEmail(ctx context.Context, email string) error
|
ScrubAuditEmail(ctx context.Context, email string) error
|
||||||
@@ -271,6 +278,9 @@ type Querier interface {
|
|||||||
StorageGet(ctx context.Context, arg StorageGetParams) (StorageGetRow, error)
|
StorageGet(ctx context.Context, arg StorageGetParams) (StorageGetRow, error)
|
||||||
StorageList(ctx context.Context, arg StorageListParams) ([]StorageListRow, error)
|
StorageList(ctx context.Context, arg StorageListParams) ([]StorageListRow, error)
|
||||||
StoragePut(ctx context.Context, arg StoragePutParams) error
|
StoragePut(ctx context.Context, arg StoragePutParams) error
|
||||||
|
SuspendOrg(ctx context.Context, arg SuspendOrgParams) (SuspendOrgRow, error)
|
||||||
|
SuspendStatusPage(ctx context.Context, arg SuspendStatusPageParams) (SuspendStatusPageRow, error)
|
||||||
|
SuspendUser(ctx context.Context, arg SuspendUserParams) (SuspendUserRow, error)
|
||||||
TouchAPIToken(ctx context.Context, id uuid.UUID) error
|
TouchAPIToken(ctx context.Context, id uuid.UUID) error
|
||||||
TouchAgent(ctx context.Context, arg TouchAgentParams) error
|
TouchAgent(ctx context.Context, arg TouchAgentParams) error
|
||||||
// Writes at most once a minute per instance; agents poll far more often.
|
// Writes at most once a minute per instance; agents poll far more often.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ DELETE FROM alertmanager_receivers WHERE id = $1;
|
|||||||
-- System scope: the receiver a webhook token belongs to.
|
-- System scope: the receiver a webhook token belongs to.
|
||||||
UPDATE alertmanager_receivers SET last_received_at = now()
|
UPDATE alertmanager_receivers SET last_received_at = now()
|
||||||
WHERE token_hash = $1
|
WHERE token_hash = $1
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = alertmanager_receivers.org_id AND o.suspended_at IS NOT NULL)
|
||||||
RETURNING id, org_id;
|
RETURNING id, org_id;
|
||||||
|
|
||||||
-- name: UpsertAlertmanagerAlert :exec
|
-- name: UpsertAlertmanagerAlert :exec
|
||||||
@@ -41,6 +42,7 @@ SELECT m.id, m.org_id, m.name, m.group_id, m.interval_seconds, m.confirmations,
|
|||||||
coalesce((SELECT max(r.time) FROM check_results r
|
coalesce((SELECT max(r.time) FROM check_results r
|
||||||
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '2 days'), 'epoch')::timestamptz AS last_result
|
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '2 days'), 'epoch')::timestamptz AS last_result
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.type = 'alertmanager' AND m.enabled AND (sqlc.narg(org_id)::uuid IS NULL OR m.org_id = sqlc.narg(org_id));
|
WHERE m.type = 'alertmanager' AND m.enabled AND (sqlc.narg(org_id)::uuid IS NULL OR m.org_id = sqlc.narg(org_id));
|
||||||
|
|
||||||
-- name: LatestResultForMonitor :one
|
-- name: LatestResultForMonitor :one
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
-- name: HeartbeatMonitor :one
|
-- name: HeartbeatMonitor :one
|
||||||
-- System scope: the monitor a ping token belongs to.
|
-- System scope: the monitor a ping token belongs to.
|
||||||
SELECT id, org_id, interval_seconds, confirmations, enabled
|
SELECT m.id, m.org_id, m.interval_seconds, m.confirmations, coalesce(m.enabled AND o.suspended_at IS NULL, false)::boolean AS enabled
|
||||||
FROM monitors WHERE type = 'heartbeat' AND target = $1;
|
FROM monitors m JOIN orgs o ON o.id = m.org_id
|
||||||
|
WHERE m.type = 'heartbeat' AND m.target = $1;
|
||||||
|
|
||||||
-- name: HeartbeatsDue :many
|
-- name: HeartbeatsDue :many
|
||||||
-- System scope: enabled heartbeat monitors with their grace period and
|
-- System scope: enabled heartbeat monitors with their grace period and
|
||||||
@@ -13,4 +14,5 @@ SELECT m.id, m.org_id, m.interval_seconds, m.confirmations,
|
|||||||
greatest(m.updated_at, coalesce((SELECT max(r.time) FROM check_results r
|
greatest(m.updated_at, coalesce((SELECT max(r.time) FROM check_results r
|
||||||
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '3 days'), m.updated_at))::timestamptz AS waiting_since
|
WHERE r.org_id = m.org_id AND r.monitor_id = m.id AND r.time > now() - interval '3 days'), m.updated_at))::timestamptz AS waiting_since
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.type = 'heartbeat' AND m.enabled;
|
WHERE m.type = 'heartbeat' AND m.enabled;
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
-- name: AdminListStatusPages :many
|
||||||
|
-- System scope: public status pages and suspended ones, with their
|
||||||
|
-- organization and its owner, newest first, matching search in title,
|
||||||
|
-- slug, domain, organization or owner email.
|
||||||
|
SELECT p.id, p.slug, p.title, p.published, p.custom_domain, p.domain_verified_at,
|
||||||
|
p.suspended_at, p.suspended_reason, p.created_at,
|
||||||
|
o.id AS org_id, o.slug AS org_slug, o.name AS org_name, o.suspended_at AS org_suspended_at, o.suspended_reason AS org_suspended_reason,
|
||||||
|
coalesce(ow.id, '00000000-0000-0000-0000-000000000000'::uuid)::uuid AS owner_id,
|
||||||
|
coalesce(ow.email::text, '')::text AS owner_email, ow.disabled_at AS owner_disabled_at,
|
||||||
|
coalesce(ow.disabled_reason, '')::text AS owner_disabled_reason, coalesce(ow.is_admin, false)::boolean AS owner_is_admin
|
||||||
|
FROM status_pages p
|
||||||
|
JOIN orgs o ON o.id = p.org_id
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT u.id, u.email, u.disabled_at, u.disabled_reason, u.is_admin FROM memberships m JOIN users u ON u.id = m.user_id
|
||||||
|
WHERE m.org_id = o.id AND m.is_owner ORDER BY m.created_at LIMIT 1
|
||||||
|
) ow ON true
|
||||||
|
WHERE (p.published OR p.suspended_at IS NOT NULL OR o.suspended_at IS NOT NULL)
|
||||||
|
AND (sqlc.arg(search)::text = ''
|
||||||
|
OR p.title ILIKE '%' || sqlc.arg(search) || '%' OR p.slug::text ILIKE '%' || sqlc.arg(search) || '%'
|
||||||
|
OR coalesce(p.custom_domain::text, '') ILIKE '%' || sqlc.arg(search) || '%'
|
||||||
|
OR o.name ILIKE '%' || sqlc.arg(search) || '%' OR o.slug::text ILIKE '%' || sqlc.arg(search) || '%'
|
||||||
|
OR coalesce(ow.email::text, '') ILIKE '%' || sqlc.arg(search) || '%')
|
||||||
|
ORDER BY p.created_at DESC
|
||||||
|
LIMIT sqlc.arg(max_rows);
|
||||||
|
|
||||||
|
-- name: SuspendStatusPage :one
|
||||||
|
UPDATE status_pages SET suspended_at = CASE WHEN sqlc.arg(suspend)::boolean THEN coalesce(suspended_at, now()) END,
|
||||||
|
suspended_reason = CASE WHEN sqlc.arg(suspend)::boolean THEN sqlc.arg(reason)::text ELSE '' END
|
||||||
|
WHERE id = sqlc.arg(id)
|
||||||
|
RETURNING id, org_id, slug, custom_domain;
|
||||||
|
|
||||||
|
-- name: SuspendOrg :one
|
||||||
|
UPDATE orgs SET suspended_at = CASE WHEN sqlc.arg(suspend)::boolean THEN coalesce(suspended_at, now()) END,
|
||||||
|
suspended_reason = CASE WHEN sqlc.arg(suspend)::boolean THEN sqlc.arg(reason)::text ELSE '' END
|
||||||
|
WHERE id = sqlc.arg(id)
|
||||||
|
RETURNING id, slug, name;
|
||||||
|
|
||||||
|
-- name: SuspendUser :one
|
||||||
|
UPDATE users SET disabled_at = CASE WHEN sqlc.arg(suspend)::boolean THEN coalesce(disabled_at, now()) END,
|
||||||
|
disabled_reason = CASE WHEN sqlc.arg(suspend)::boolean THEN sqlc.arg(reason)::text ELSE '' END
|
||||||
|
WHERE id = sqlc.arg(id)
|
||||||
|
RETURNING id, email, is_admin;
|
||||||
|
|
||||||
|
-- name: RestartHeartbeatWait :exec
|
||||||
|
-- Heartbeats of an organization wait afresh after its suspension, during
|
||||||
|
-- which pings were refused.
|
||||||
|
UPDATE monitors SET updated_at = now() WHERE org_id = $1 AND type = 'heartbeat';
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ INSERT INTO monitor_regions (monitor_id, org_id, region_id) VALUES ($1, $2, $3);
|
|||||||
SELECT m.id, m.interval_seconds, array_agg(r.region_id::text ORDER BY r.region_id)::text[] AS regions
|
SELECT m.id, m.interval_seconds, array_agg(r.region_id::text ORDER BY r.region_id)::text[] AS regions
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id
|
JOIN monitor_regions r ON r.monitor_id = m.id
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.enabled
|
WHERE m.enabled
|
||||||
GROUP BY m.id, m.interval_seconds;
|
GROUP BY m.id, m.interval_seconds;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ GROUP BY m.id, m.interval_seconds;
|
|||||||
-- org-owned checker only ever sees its org's monitors.
|
-- org-owned checker only ever sees its org's monitors.
|
||||||
SELECT m.* FROM monitors m
|
SELECT m.* FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = sqlc.arg(region_id)
|
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = sqlc.arg(region_id)
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.enabled
|
WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.enabled
|
||||||
AND (sqlc.narg(agent_org)::uuid IS NULL OR m.org_id = sqlc.narg(agent_org));
|
AND (sqlc.narg(agent_org)::uuid IS NULL OR m.org_id = sqlc.narg(agent_org));
|
||||||
|
|
||||||
@@ -55,5 +57,6 @@ SELECT m.id, m.org_id, m.name, m.target, m.interval_seconds, m.confirmations,
|
|||||||
(SELECT array_agg(r2.region_id::text ORDER BY r2.region_id) FROM monitor_regions r2 WHERE r2.monitor_id = m.id)::text[] AS regions
|
(SELECT array_agg(r2.region_id::text ORDER BY r2.region_id) FROM monitor_regions r2 WHERE r2.monitor_id = m.id)::text[] AS regions
|
||||||
FROM monitors m
|
FROM monitors m
|
||||||
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = sqlc.arg(region_id)
|
JOIN monitor_regions r ON r.monitor_id = m.id AND r.region_id = sqlc.arg(region_id)
|
||||||
|
JOIN orgs o ON o.id = m.org_id AND o.suspended_at IS NULL
|
||||||
WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.enabled
|
WHERE m.id = ANY (sqlc.arg(ids)::uuid[]) AND m.enabled
|
||||||
AND (sqlc.narg(agent_org)::uuid IS NULL OR m.org_id = sqlc.narg(agent_org));
|
AND (sqlc.narg(agent_org)::uuid IS NULL OR m.org_id = sqlc.narg(agent_org));
|
||||||
@@ -89,6 +89,7 @@ DELETE FROM status_page_groups WHERE page_id = $1;
|
|||||||
-- System scope: resolves a request to a page by verified custom domain or
|
-- System scope: resolves a request to a page by verified custom domain or
|
||||||
-- by slug.
|
-- by slug.
|
||||||
SELECT * FROM status_pages
|
SELECT * FROM status_pages
|
||||||
WHERE published
|
WHERE published AND suspended_at IS NULL
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = status_pages.org_id AND o.suspended_at IS NOT NULL)
|
||||||
AND ((sqlc.narg(host)::citext IS NOT NULL AND custom_domain = sqlc.narg(host) AND domain_verified_at IS NOT NULL)
|
AND ((sqlc.narg(host)::citext IS NOT NULL AND custom_domain = sqlc.narg(host) AND domain_verified_at IS NOT NULL)
|
||||||
OR (sqlc.narg(slug)::citext IS NOT NULL AND slug = sqlc.narg(slug)));
|
OR (sqlc.narg(slug)::citext IS NOT NULL AND slug = sqlc.narg(slug)));
|
||||||
@@ -60,7 +60,7 @@ func (q *Queries) ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID)
|
|||||||
const createStatusPage = `-- name: CreateStatusPage :one
|
const createStatusPage = `-- name: CreateStatusPage :one
|
||||||
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme)
|
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details
|
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateStatusPageParams struct {
|
type CreateStatusPageParams struct {
|
||||||
@@ -100,6 +100,8 @@ func (q *Queries) CreateStatusPage(ctx context.Context, arg CreateStatusPagePara
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -170,8 +172,9 @@ func (q *Queries) DeleteStatusPageGroup(ctx context.Context, arg DeleteStatusPag
|
|||||||
}
|
}
|
||||||
|
|
||||||
const findPublishedPage = `-- name: FindPublishedPage :one
|
const findPublishedPage = `-- name: FindPublishedPage :one
|
||||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details FROM status_pages
|
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages
|
||||||
WHERE published
|
WHERE published AND suspended_at IS NULL
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = status_pages.org_id AND o.suspended_at IS NOT NULL)
|
||||||
AND (($1::citext IS NOT NULL AND custom_domain = $1 AND domain_verified_at IS NOT NULL)
|
AND (($1::citext IS NOT NULL AND custom_domain = $1 AND domain_verified_at IS NOT NULL)
|
||||||
OR ($2::citext IS NOT NULL AND slug = $2))
|
OR ($2::citext IS NOT NULL AND slug = $2))
|
||||||
`
|
`
|
||||||
@@ -200,12 +203,14 @@ func (q *Queries) FindPublishedPage(ctx context.Context, arg FindPublishedPagePa
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getStatusPage = `-- name: GetStatusPage :one
|
const getStatusPage = `-- name: GetStatusPage :one
|
||||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details FROM status_pages WHERE id = $1
|
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error) {
|
func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error) {
|
||||||
@@ -225,6 +230,8 @@ func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage,
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -265,7 +272,7 @@ func (q *Queries) ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([
|
|||||||
}
|
}
|
||||||
|
|
||||||
const listStatusPages = `-- name: ListStatusPages :many
|
const listStatusPages = `-- name: ListStatusPages :many
|
||||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details FROM status_pages ORDER BY title
|
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages ORDER BY title
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
||||||
@@ -291,6 +298,8 @@ func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -349,7 +358,7 @@ UPDATE status_pages SET
|
|||||||
domain_verified_at = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_verified_at END,
|
domain_verified_at = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_verified_at END,
|
||||||
updated_at = now()
|
updated_at = now()
|
||||||
WHERE id = $2
|
WHERE id = $2
|
||||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details
|
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type SetStatusPageDomainParams struct {
|
type SetStatusPageDomainParams struct {
|
||||||
@@ -375,6 +384,8 @@ func (q *Queries) SetStatusPageDomain(ctx context.Context, arg SetStatusPageDoma
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -460,7 +471,7 @@ SET slug = $2,
|
|||||||
theme = $7,
|
theme = $7,
|
||||||
updated_at = now()
|
updated_at = now()
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details
|
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type UpdateStatusPageParams struct {
|
type UpdateStatusPageParams struct {
|
||||||
@@ -498,6 +509,8 @@ func (q *Queries) UpdateStatusPage(ctx context.Context, arg UpdateStatusPagePara
|
|||||||
&i.CreatedAt,
|
&i.CreatedAt,
|
||||||
&i.UpdatedAt,
|
&i.UpdatedAt,
|
||||||
&i.ShowComponentDetails,
|
&i.ShowComponentDetails,
|
||||||
|
&i.SuspendedAt,
|
||||||
|
&i.SuspendedReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func (q *Queries) AnyUserExists(ctx context.Context) (bool, error) {
|
|||||||
|
|
||||||
const createUser = `-- name: CreateUser :one
|
const createUser = `-- name: CreateUser :one
|
||||||
INSERT INTO users (email, display_name, password_hash, locale) VALUES ($1, $2, $3, $4)
|
INSERT INTO users (email, display_name, password_hash, locale) VALUES ($1, $2, $3, $4)
|
||||||
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin
|
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason
|
||||||
`
|
`
|
||||||
|
|
||||||
type CreateUserParams struct {
|
type CreateUserParams struct {
|
||||||
@@ -54,6 +54,7 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
|||||||
&i.TotpEnabledAt,
|
&i.TotpEnabledAt,
|
||||||
&i.Locale,
|
&i.Locale,
|
||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
|
&i.DisabledReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,7 @@ func (q *Queries) EnableTOTP(ctx context.Context, arg EnableTOTPParams) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getUser = `-- name: GetUser :one
|
const getUser = `-- name: GetUser :one
|
||||||
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin FROM users WHERE id = $1
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason FROM users WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
||||||
@@ -112,12 +113,13 @@ func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
|||||||
&i.TotpEnabledAt,
|
&i.TotpEnabledAt,
|
||||||
&i.Locale,
|
&i.Locale,
|
||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
|
&i.DisabledReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getUserByEmail = `-- name: GetUserByEmail :one
|
const getUserByEmail = `-- name: GetUserByEmail :one
|
||||||
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin FROM users WHERE email = $1
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at, totp_secret, totp_enabled_at, locale, is_admin, disabled_reason FROM users WHERE email = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
||||||
@@ -135,6 +137,7 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error
|
|||||||
&i.TotpEnabledAt,
|
&i.TotpEnabledAt,
|
||||||
&i.Locale,
|
&i.Locale,
|
||||||
&i.IsAdmin,
|
&i.IsAdmin,
|
||||||
|
&i.DisabledReason,
|
||||||
)
|
)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ type Me struct {
|
|||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
// HasPassword is false for accounts that only sign in through SSO.
|
// HasPassword is false for accounts that only sign in through SSO.
|
||||||
HasPassword bool
|
HasPassword bool
|
||||||
|
// OrgSuspended is set when platform admins suspended the active
|
||||||
|
// organization, with SuspendedReason as they gave it.
|
||||||
|
OrgSuspended bool
|
||||||
|
SuspendedReason string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Org is one entry of the organization switcher.
|
// Org is one entry of the organization switcher.
|
||||||
@@ -67,6 +71,16 @@ templ consoleShell(p Page, me Me) {
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
if me.OrgSuspended {
|
||||||
|
<div class="border-b border-down bg-down/10" role="alert">
|
||||||
|
<p class="mx-auto max-w-5xl px-6 py-3 text-sm">
|
||||||
|
<strong>{ i18n.T(ctx, "console.org_suspended") }</strong>
|
||||||
|
if me.SuspendedReason != "" {
|
||||||
|
{ " " + i18n.T(ctx, "console.suspended_reason", "Reason", me.SuspendedReason) }
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
switch me.Policy {
|
switch me.Policy {
|
||||||
case "totp_required_by_org":
|
case "totp_required_by_org":
|
||||||
@policyBanner("error.totp_required_by_org", "console.totp_missing_action", "/settings/security")
|
@policyBanner("error.totp_required_by_org", "console.totp_missing_action", "/settings/security")
|
||||||
|
|||||||
+250
-208
@@ -32,6 +32,10 @@ type Me struct {
|
|||||||
IsAdmin bool
|
IsAdmin bool
|
||||||
// HasPassword is false for accounts that only sign in through SSO.
|
// HasPassword is false for accounts that only sign in through SSO.
|
||||||
HasPassword bool
|
HasPassword bool
|
||||||
|
// OrgSuspended is set when platform admins suspended the active
|
||||||
|
// organization, with SuspendedReason as they gave it.
|
||||||
|
OrgSuspended bool
|
||||||
|
SuspendedReason string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Org is one entry of the organization switcher.
|
// Org is one entry of the organization switcher.
|
||||||
@@ -93,7 +97,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(o.ID).Resolve(ctx)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(o.ID).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 44, Col: 27}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 48, Col: 27}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -116,7 +120,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(o.Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 44, Col: 73}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 48, Col: 73}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -139,7 +143,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(me.Orgs[0].Name)
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(me.Orgs[0].Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 48, Col: 47}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 52, Col: 47}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -157,7 +161,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var6 string
|
var templ_7745c5c3_Var6 string
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 51, Col: 90}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 55, Col: 90}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -175,7 +179,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.title"))
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pages.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 53, Col: 91}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 57, Col: 91}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -194,7 +198,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.title"))
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 56, Col: 93}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 60, Col: 93}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -207,7 +211,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var9 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.title"))
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "maintenance.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 57, Col: 97}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 61, Col: 97}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -225,7 +229,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var10 string
|
var templ_7745c5c3_Var10 string
|
||||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.settings"))
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.settings"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 61, Col: 96}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 65, Col: 96}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -243,7 +247,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var11 string
|
var templ_7745c5c3_Var11 string
|
||||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.admin"))
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.admin"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 63, Col: 93}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 67, Col: 93}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -261,7 +265,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
var templ_7745c5c3_Var12 string
|
var templ_7745c5c3_Var12 string
|
||||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 65, Col: 94}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 69, Col: 94}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@@ -279,6 +283,44 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
if me.OrgSuspended {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<div class=\"border-b border-down bg-down/10\" role=\"alert\"><p class=\"mx-auto max-w-5xl px-6 py-3 text-sm\"><strong>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var13 string
|
||||||
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.org_suspended"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 77, Col: 51}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</strong> ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if me.SuspendedReason != "" {
|
||||||
|
var templ_7745c5c3_Var14 string
|
||||||
|
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(" " + i18n.T(ctx, "console.suspended_reason", "Reason", me.SuspendedReason))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 79, Col: 83}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</p></div>")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " ")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
switch me.Policy {
|
switch me.Policy {
|
||||||
case "totp_required_by_org":
|
case "totp_required_by_org":
|
||||||
templ_7745c5c3_Err = policyBanner("error.totp_required_by_org", "console.totp_missing_action", "/settings/security").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = policyBanner("error.totp_required_by_org", "console.totp_missing_action", "/settings/security").Render(ctx, templ_7745c5c3_Buffer)
|
||||||
@@ -291,7 +333,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " <main class=\"mx-auto max-w-5xl px-6 py-10\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -303,7 +345,7 @@ func consoleShell(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</main>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</main>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -340,7 +382,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var14 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var16 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
if !templ_7745c5c3_IsBuffer {
|
if !templ_7745c5c3_IsBuffer {
|
||||||
@@ -352,51 +394,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<h1 class=\"mb-8 text-lg font-semibold\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var15 string
|
var templ_7745c5c3_Var17 string
|
||||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title"))
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.title"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 91, Col: 72}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 105, Col: 72}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</h1><section class=\"max-w-md\"><h2 class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</h1><section class=\"max-w-md\"><h2 class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var16 string
|
var templ_7745c5c3_Var18 string
|
||||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.heading"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 93, Col: 114}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 107, Col: 114}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</h2>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</h2>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if me.TOTP {
|
if me.TOTP {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<p class=\"mb-1 text-sm\"><span class=\"text-up\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<p class=\"mb-1 text-sm\"><span class=\"text-up\">●</span> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var17 string
|
var templ_7745c5c3_Var19 string
|
||||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active"))
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.active"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 95, Col: 98}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 109, Col: 98}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -404,25 +446,25 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
|
templ_7745c5c3_ElementWriter := templ_7745c5c3_Buffer
|
||||||
templ_7745c5c3_Buffer := templ.GetBuffer()
|
templ_7745c5c3_Buffer := templ.GetBuffer()
|
||||||
var templ_7745c5c3_ElementScripts []templ.ComponentScript
|
var templ_7745c5c3_ElementScripts []templ.ComponentScript
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<p class=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<p class=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var18 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)}
|
var templ_7745c5c3_Var20 = []any{"mb-6 text-sm", templ.KV("text-down", me.RecoveryCodesLeft < 3), templ.KV("text-muted", me.RecoveryCodesLeft >= 3)}
|
||||||
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var18...)
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_ElementWriter, templ_7745c5c3_Var20...)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var19 string
|
var templ_7745c5c3_Var21 string
|
||||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var18).String()).Resolve(ctx)
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.CSSClasses(templ_7745c5c3_Var20).String()).Resolve(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 1, Col: 0}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -436,33 +478,33 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, ">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, ">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var20 string
|
var templ_7745c5c3_Var22 string
|
||||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft))
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.left", "Count", me.RecoveryCodesLeft))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 97, Col: 75}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 111, Col: 75}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</p><details class=\"mb-6\"><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</p><details class=\"mb-6\"><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var21 string
|
var templ_7745c5c3_Var23 string
|
||||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate"))
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.regenerate"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 100, Col: 116}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 114, Col: 116}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "</summary><form data-api=\"/me/totp/recovery-codes\" data-show-codes class=\"mt-4\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</summary><form data-api=\"/me/totp/recovery-codes\" data-show-codes class=\"mt-4\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -486,20 +528,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</form></details> <details><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</form></details> <details><summary class=\"cursor-pointer text-sm text-muted hover:text-ink\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var22 string
|
var templ_7745c5c3_Var24 string
|
||||||
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable"))
|
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.disable"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 110, Col: 109}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 124, Col: 109}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</summary><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\" class=\"mt-4\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</summary><form data-api=\"/me/totp/disable\" data-next=\"/settings/security\" class=\"mt-4\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -519,51 +561,51 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</form></details>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</form></details>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<p class=\"mb-6 text-sm\"><span class=\"text-unknown\">●</span> ")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var23 string
|
|
||||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 119, Col: 105}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</p><div data-totp-setup><button data-totp-start class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var24 string
|
|
||||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 121, Col: 141}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var25 string
|
var templ_7745c5c3_Var25 string
|
||||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx)
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.inactive"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 123, Col: 65}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 133, Col: 105}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" class=\"mb-3 h-48 w-48 border border-rule bg-white p-2\"><p class=\"mb-6 break-all font-mono text-xs text-muted\" data-totp-secret></p><form data-api=\"/me/totp/enable\" data-show-codes>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</p><div data-totp-setup><button data-totp-start class=\"border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var26 string
|
||||||
|
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.totp.start"))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 135, Col: 141}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</button><div data-totp-panel hidden><img data-totp-qr alt=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var27 string
|
||||||
|
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "security.totp.qr_alt")).Resolve(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 137, Col: 65}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\" class=\"mb-3 h-48 w-48 border border-rule bg-white p-2\"><p class=\"mb-6 break-all font-mono text-xs text-muted\" data-totp-secret></p><form data-api=\"/me/totp/enable\" data-show-codes>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -583,121 +625,121 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</form></div></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</form></div></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</section><section class=\"mt-12 max-w-md\"><h2 class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</section><section class=\"mt-12 max-w-md\"><h2 class=\"mb-3 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var26 string
|
var templ_7745c5c3_Var28 string
|
||||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
|
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.heading"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 136, Col: 113}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 150, Col: 113}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</h2>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</h2>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
if len(identities) == 0 {
|
if len(identities) == 0 {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<p class=\"mb-4 text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<p class=\"mb-4 text-sm text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var27 string
|
var templ_7745c5c3_Var29 string
|
||||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none"))
|
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.none"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 138, Col: 73}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 152, Col: 73}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "<ul class=\"mb-4 divide-y divide-rule border-y border-rule text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<ul class=\"mb-4 divide-y divide-rule border-y border-rule text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
for _, id := range identities {
|
for _, id := range identities {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<li class=\"flex justify-between gap-4 py-2\"><span>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<li class=\"flex justify-between gap-4 py-2\"><span>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var28 string
|
var templ_7745c5c3_Var30 string
|
||||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider)
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(id.Provider)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 142, Col: 69}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 156, Col: 69}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</span><span class=\"font-mono text-xs text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "</span><span class=\"font-mono text-xs text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var29 string
|
var templ_7745c5c3_Var31 string
|
||||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email)
|
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(id.Email)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 142, Col: 131}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 156, Col: 131}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</span></li>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</span></li>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "</ul>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</ul>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if canLink {
|
if canLink {
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<a href=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<a href=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var30 string
|
var templ_7745c5c3_Var32 string
|
||||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1")).ResolveURL(ctx)
|
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/sso/" + me.ActiveSlug + "?link=1")).ResolveURL(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 147, Col: 64}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 161, Col: 64}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30)
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "\" class=\"inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "\" class=\"inline-block border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var31 string
|
var templ_7745c5c3_Var33 string
|
||||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link"))
|
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.sso.link"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 147, Col: 190}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 161, Col: 190}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</a>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</a>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</section><section class=\"mt-12\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "</section><section class=\"mt-12\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -705,20 +747,20 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<p class=\"mb-4 max-w-2xl text-sm text-muted\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "<p class=\"mb-4 max-w-2xl text-sm text-muted\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var32 string
|
var templ_7745c5c3_Var34 string
|
||||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro"))
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.activity_intro"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 152, Col: 88}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 166, Col: 88}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</p>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</p>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -726,7 +768,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</section>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</section>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -736,7 +778,7 @@ func Security(p Page, me Me, identities []Identity, canLink bool, activity []Aud
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -763,33 +805,33 @@ func recoveryOutput() templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "<div data-recovery-output hidden class=\"mt-6 border border-ink p-4\"><p class=\"mb-3 text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "<div data-recovery-output hidden class=\"mt-6 border border-ink p-4\"><p class=\"mb-3 text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var34 string
|
var templ_7745c5c3_Var36 string
|
||||||
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.save_now"))
|
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.save_now"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 163, Col: 69}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 177, Col: 69}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</p><ol data-recovery-list class=\"mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm\"></ol><a href=\"/settings/security\" class=\"text-sm underline underline-offset-2\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</p><ol data-recovery-list class=\"mb-4 grid grid-cols-2 gap-x-6 gap-y-1 font-mono text-sm\"></ol><a href=\"/settings/security\" class=\"text-sm underline underline-offset-2\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var35 string
|
var templ_7745c5c3_Var37 string
|
||||||
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.saved"))
|
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "security.recovery.saved"))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 165, Col: 116}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 179, Col: 116}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</a></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "</a></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -814,46 +856,46 @@ func policyBanner(msgID, actionID, href string) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "<div class=\"border-b border-degraded/40 bg-degraded/10\"><p class=\"mx-auto max-w-5xl px-6 py-2 text-sm\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<div class=\"border-b border-degraded/40 bg-degraded/10\"><p class=\"mx-auto max-w-5xl px-6 py-2 text-sm\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var37 string
|
|
||||||
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 172, Col: 23}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, " <a href=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var38 string
|
|
||||||
templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 173, Col: 32}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" class=\"underline underline-offset-2\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var39 string
|
var templ_7745c5c3_Var39 string
|
||||||
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, actionID))
|
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, msgID))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 173, Col: 95}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 186, Col: 23}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "</a></p></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, " <a href=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var40 string
|
||||||
|
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 187, Col: 32}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\" class=\"underline underline-offset-2\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var41 string
|
||||||
|
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, actionID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 187, Col: 95}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</a></p></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -878,46 +920,46 @@ func settingsLink(href, titleID, hintID string) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "<a href=\"")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<a href=\"")
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var41 string
|
|
||||||
templ_7745c5c3_Var41, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 179, Col: 30}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var41)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" class=\"block border border-rule p-4 hover:border-ink\"><span class=\"block font-medium\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var42 string
|
|
||||||
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 180, Col: 56}
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</span> <span class=\"mt-1 block text-sm text-muted\">")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var43 string
|
var templ_7745c5c3_Var43 string
|
||||||
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID))
|
templ_7745c5c3_Var43, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 181, Col: 67}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 193, Col: 30}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var43)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</span></a>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "\" class=\"block border border-rule p-4 hover:border-ink\"><span class=\"block font-medium\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var44 string
|
||||||
|
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 194, Col: 56}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</span> <span class=\"mt-1 block text-sm text-muted\">")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var45 string
|
||||||
|
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, hintID))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/console.templ`, Line: 195, Col: 67}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</span></a>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -943,7 +985,7 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Var45 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
templ_7745c5c3_Var47 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||||
if !templ_7745c5c3_IsBuffer {
|
if !templ_7745c5c3_IsBuffer {
|
||||||
@@ -959,7 +1001,7 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "<div class=\"grid gap-4 sm:grid-cols-2 lg:grid-cols-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@@ -1025,13 +1067,13 @@ func SettingsIndex(p Page, me Me) templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "</div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var45), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var47), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
+163
-2
@@ -1,6 +1,10 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
import (
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||||
|
)
|
||||||
|
|
||||||
// Region is a row in a region list.
|
// Region is a row in a region list.
|
||||||
type Region struct {
|
type Region struct {
|
||||||
@@ -159,13 +163,14 @@ templ RegionsPage(p Page, me Me, v RegionsView) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool) {
|
templ AdminPage(p Page, me Me, v RegionsView, storage StorageView, checkTypes []CheckTypeOption, platformPrivate bool, mod ModerationView) {
|
||||||
@consoleShell(p, me) {
|
@consoleShell(p, me) {
|
||||||
@settingsHeading("admin.title", "admin.intro")
|
@settingsHeading("admin.title", "admin.intro")
|
||||||
<p class="-mt-4 mb-8 flex gap-4 text-sm">
|
<p class="-mt-4 mb-8 flex gap-4 text-sm">
|
||||||
<a href="/admin/audit" class="underline underline-offset-2">{ i18n.T(ctx, "audit.platform_title") }</a>
|
<a href="/admin/audit" class="underline underline-offset-2">{ i18n.T(ctx, "audit.platform_title") }</a>
|
||||||
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
|
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
|
||||||
</p>
|
</p>
|
||||||
|
@moderationSection(mod)
|
||||||
@regionsBody(v)
|
@regionsBody(v)
|
||||||
@checkerNetworkSection(platformPrivate)
|
@checkerNetworkSection(platformPrivate)
|
||||||
@checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro")
|
@checkTypesSection(checkTypes, "/admin/check-types", "/admin", "admin.check_types_intro")
|
||||||
@@ -211,3 +216,159 @@ templ checkTypesSection(types []CheckTypeOption, api, next, introID string) {
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ModerationView lists public status pages for platform admins.
|
||||||
|
type ModerationView struct {
|
||||||
|
Search string
|
||||||
|
Pages []ModeratedPage
|
||||||
|
// Limited is set when more pages match than are shown.
|
||||||
|
Limited bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModeratedPage is a status page with the organization and account
|
||||||
|
// behind it.
|
||||||
|
type ModeratedPage struct {
|
||||||
|
ID, Title, Slug, URL, Created string
|
||||||
|
Published bool
|
||||||
|
Suspended string
|
||||||
|
Org ModeratedTarget
|
||||||
|
Owner *ModeratedTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModeratedTarget is an organization or account that can be suspended or
|
||||||
|
// deleted. Suspended holds the reason, or "-" without one, when suspended.
|
||||||
|
type ModeratedTarget struct {
|
||||||
|
ID, Name, Detail, Suspended string
|
||||||
|
// Admin marks platform admins, who are out of reach here.
|
||||||
|
Admin bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v ModerationView) next() string {
|
||||||
|
if v.Search == "" {
|
||||||
|
return "/admin#moderation"
|
||||||
|
}
|
||||||
|
return "/admin?q=" + url.QueryEscape(v.Search) + "#moderation"
|
||||||
|
}
|
||||||
|
|
||||||
|
templ moderationSection(v ModerationView) {
|
||||||
|
<section id="moderation" class="mb-12">
|
||||||
|
@sectionHeading("moderation.title")
|
||||||
|
<p class="mb-4 max-w-3xl text-sm text-muted">{ i18n.T(ctx, "moderation.intro") }</p>
|
||||||
|
<form method="get" action="/admin#moderation" class="mb-4 flex max-w-xl gap-2">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
name="q"
|
||||||
|
value={ v.Search }
|
||||||
|
placeholder={ i18n.T(ctx, "moderation.search") }
|
||||||
|
aria-label={ i18n.T(ctx, "moderation.search") }
|
||||||
|
class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"
|
||||||
|
/>
|
||||||
|
<button type="submit" class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "moderation.search_button") }</button>
|
||||||
|
</form>
|
||||||
|
if len(v.Pages) == 0 {
|
||||||
|
<p class="text-sm text-muted">{ i18n.T(ctx, "moderation.none") }</p>
|
||||||
|
} else {
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="w-full min-w-[42rem] text-left text-sm">
|
||||||
|
<thead class="border-b border-rule text-xs uppercase tracking-wider text-muted">
|
||||||
|
<tr>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.page") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.org") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.owner") }</th>
|
||||||
|
<th class="py-2 pr-4 font-medium">{ i18n.T(ctx, "moderation.created") }</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-rule">
|
||||||
|
for _, pg := range v.Pages {
|
||||||
|
<tr class="align-top">
|
||||||
|
<td class="py-2.5 pr-4">
|
||||||
|
<a href={ templ.SafeURL(pg.URL) } target="_blank" rel="noopener noreferrer" class="hover:underline">{ pg.Title }</a>
|
||||||
|
<span class="block font-mono text-xs text-muted">{ pg.Slug }</span>
|
||||||
|
@moderationState(pg.Suspended, !pg.Published)
|
||||||
|
</td>
|
||||||
|
<td class="py-2.5 pr-4">
|
||||||
|
{ pg.Org.Name }
|
||||||
|
<span class="block font-mono text-xs text-muted">{ pg.Org.Detail }</span>
|
||||||
|
@moderationState(pg.Org.Suspended, false)
|
||||||
|
</td>
|
||||||
|
<td class="py-2.5 pr-4">
|
||||||
|
if pg.Owner != nil {
|
||||||
|
<span class="break-all">{ pg.Owner.Name }</span>
|
||||||
|
@moderationState(pg.Owner.Suspended, false)
|
||||||
|
} else {
|
||||||
|
<span class="text-muted">–</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="py-2.5 pr-4 font-mono text-xs text-muted">{ pg.Created }</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" class="pb-3">
|
||||||
|
<details class="text-sm">
|
||||||
|
<summary class="cursor-pointer text-muted hover:text-ink">{ i18n.T(ctx, "moderation.actions") }</summary>
|
||||||
|
<div class="mt-3 grid gap-6 md:grid-cols-3">
|
||||||
|
@moderationActions("page", "/admin/status-pages/"+pg.ID, pg.Suspended, pg.Title, v.next())
|
||||||
|
@moderationActions("org", "/admin/orgs/"+pg.Org.ID, pg.Org.Suspended, pg.Org.Name, v.next())
|
||||||
|
if pg.Owner != nil && pg.Owner.Admin {
|
||||||
|
<p class="text-xs text-muted">{ i18n.T(ctx, "moderation.owner_is_admin") }</p>
|
||||||
|
} else if pg.Owner != nil {
|
||||||
|
@moderationActions("owner", "/admin/users/"+pg.Owner.ID, pg.Owner.Suspended, pg.Owner.Name, v.next())
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
if v.Limited {
|
||||||
|
<p class="mt-3 text-xs text-muted">{ i18n.T(ctx, "moderation.limited") }</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
|
templ moderationState(suspended string, draft bool) {
|
||||||
|
if suspended != "" {
|
||||||
|
<span class="mt-1 inline-block text-xs font-medium text-down">
|
||||||
|
{ i18n.T(ctx, "moderation.suspended") }
|
||||||
|
if suspended != "-" {
|
||||||
|
<span class="font-normal text-muted">{ "· " + suspended }</span>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
} else if draft {
|
||||||
|
<span class="mt-1 inline-block text-xs text-muted">{ i18n.T(ctx, "pages.draft") }</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// moderationActions suspends, reinstates or deletes one target; kind is
|
||||||
|
// "page", "org" or "owner".
|
||||||
|
templ moderationActions(kind, api, suspended, name, next string) {
|
||||||
|
<div>
|
||||||
|
<h4 class="mb-2 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "moderation.target_"+kind) }</h4>
|
||||||
|
<form data-api={ api + "/suspension" } data-method="put" data-next={ next } class="mb-2">
|
||||||
|
@formError()
|
||||||
|
if suspended != "" {
|
||||||
|
<input type="checkbox" name="suspended" hidden/>
|
||||||
|
<button type="submit" class="border border-rule px-2.5 py-1 hover:border-ink">{ i18n.T(ctx, "moderation.reinstate") }</button>
|
||||||
|
} else {
|
||||||
|
<input type="checkbox" name="suspended" checked hidden/>
|
||||||
|
<input
|
||||||
|
name="reason"
|
||||||
|
maxlength="500"
|
||||||
|
placeholder={ i18n.T(ctx, "moderation.reason") }
|
||||||
|
aria-label={ i18n.T(ctx, "moderation.reason") }
|
||||||
|
class="mb-2 w-full border border-rule bg-transparent px-2 py-1 text-sm outline-none focus:border-ink"
|
||||||
|
/>
|
||||||
|
<button type="submit" class="border border-down px-2.5 py-1 text-down hover:bg-down hover:text-paper">{ i18n.T(ctx, "moderation.suspend") }</button>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-delete={ api }
|
||||||
|
data-next={ next }
|
||||||
|
data-confirm={ i18n.T(ctx, "moderation.delete_confirm_"+kind, "Name", name) }
|
||||||
|
class="text-muted hover:text-down"
|
||||||
|
>{ i18n.T(ctx, "moderation.delete_"+kind) }</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
+739
-46
File diff suppressed because it is too large.
Load diff
@@ -14,6 +14,7 @@ type PageRow struct {
|
|||||||
Published bool
|
Published bool
|
||||||
URL string
|
URL string
|
||||||
Domain string
|
Domain string
|
||||||
|
Suspended bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// PagesView is the data of the status page list.
|
// PagesView is the data of the status page list.
|
||||||
@@ -29,7 +30,9 @@ templ StatusPagesPage(p Page, me Me, v PagesView) {
|
|||||||
<ul class="mb-12 divide-y divide-rule border-y border-rule text-sm">
|
<ul class="mb-12 divide-y divide-rule border-y border-rule text-sm">
|
||||||
for _, pg := range v.Pages {
|
for _, pg := range v.Pages {
|
||||||
<li class="flex flex-wrap items-center gap-x-4 gap-y-1 py-2.5">
|
<li class="flex flex-wrap items-center gap-x-4 gap-y-1 py-2.5">
|
||||||
if pg.Published {
|
if pg.Suspended {
|
||||||
|
@statusDot(StatusDown)
|
||||||
|
} else if pg.Published {
|
||||||
@statusDot(StatusUp)
|
@statusDot(StatusUp)
|
||||||
} else {
|
} else {
|
||||||
@statusDot(StatusPaused)
|
@statusDot(StatusPaused)
|
||||||
@@ -39,7 +42,9 @@ templ StatusPagesPage(p Page, me Me, v PagesView) {
|
|||||||
if pg.Domain != "" {
|
if pg.Domain != "" {
|
||||||
<span class="font-mono text-xs text-muted">{ pg.Domain }</span>
|
<span class="font-mono text-xs text-muted">{ pg.Domain }</span>
|
||||||
}
|
}
|
||||||
if pg.Published {
|
if pg.Suspended {
|
||||||
|
<span class="ml-auto text-xs text-down">{ i18n.T(ctx, "pages.suspended") }</span>
|
||||||
|
} else if pg.Published {
|
||||||
<a href={ templ.SafeURL(pg.URL) } class="ml-auto text-muted hover:text-ink" target="_blank" rel="noopener">{ i18n.T(ctx, "pages.open") } ↗</a>
|
<a href={ templ.SafeURL(pg.URL) } class="ml-auto text-muted hover:text-ink" target="_blank" rel="noopener">{ i18n.T(ctx, "pages.open") } ↗</a>
|
||||||
} else {
|
} else {
|
||||||
<span class="ml-auto text-xs text-muted">{ i18n.T(ctx, "pages.draft") }</span>
|
<span class="ml-auto text-xs text-muted">{ i18n.T(ctx, "pages.draft") }</span>
|
||||||
@@ -98,6 +103,8 @@ type PageEditor struct {
|
|||||||
DomainVerified bool
|
DomainVerified bool
|
||||||
RecordName string
|
RecordName string
|
||||||
RecordValue string
|
RecordValue string
|
||||||
|
Suspended bool
|
||||||
|
SuspendedReason string
|
||||||
Groups []PageGroupRow
|
Groups []PageGroupRow
|
||||||
HasOrgGroups bool
|
HasOrgGroups bool
|
||||||
Monitors []PageMonitorOption
|
Monitors []PageMonitorOption
|
||||||
@@ -106,6 +113,14 @@ type PageEditor struct {
|
|||||||
templ StatusPageEditor(p Page, me Me, e PageEditor) {
|
templ StatusPageEditor(p Page, me Me, e PageEditor) {
|
||||||
@consoleShell(p, me) {
|
@consoleShell(p, me) {
|
||||||
<p class="mb-4 text-sm"><a href="/statuspages" class="text-muted hover:text-ink">← { i18n.T(ctx, "pages.title") }</a></p>
|
<p class="mb-4 text-sm"><a href="/statuspages" class="text-muted hover:text-ink">← { i18n.T(ctx, "pages.title") }</a></p>
|
||||||
|
if e.Suspended {
|
||||||
|
<p class="mb-6 border-l-2 border-down pl-3 text-sm" role="alert">
|
||||||
|
{ i18n.T(ctx, "pages.suspended_notice") }
|
||||||
|
if e.SuspendedReason != "" {
|
||||||
|
{ " " + i18n.T(ctx, "console.suspended_reason", "Reason", e.SuspendedReason) }
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
}
|
||||||
<div class="mb-8 flex flex-wrap items-baseline justify-between gap-4">
|
<div class="mb-8 flex flex-wrap items-baseline justify-between gap-4">
|
||||||
<h1 class="text-lg font-semibold">{ e.Title }</h1>
|
<h1 class="text-lg font-semibold">{ e.Title }</h1>
|
||||||
<span class="flex gap-5 text-sm">
|
<span class="flex gap-5 text-sm">
|
||||||
|
|||||||
+863
-799
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user