feat: several owners per organization, and handing ownership over #142

Merged
Sebi merged 1 commits from feat/owners into main 2026-11-23 21:40:50 +00:00
23 changed files with 558 additions and 115 deletions

No files matched your search

+6 -2
View File
@@ -60,7 +60,7 @@ var endpoints = []endpoint{
{method: "GET", path: "/api/v1/me/export", tag: "Account", summary: "Export all personal data (GDPR Art. 15, 20)",
description: "`?format=pdf` returns a PDF instead of JSON.", resp: accountExport{}},
{method: "POST", path: "/api/v1/me/delete", tag: "Account", summary: "Delete the account (GDPR Art. 17)", sessionOnly: true,
description: "Organizations the user owns are deleted with the account, with all their monitors, even when they have other members. Open to suspended accounts and to those that have not accepted the terms.",
description: "Organizations the user is the last owner of are deleted with the account, with all their monitors, even when they have other members; organizations with further owners are left. Open to suspended accounts and to those that have not accepted the terms.",
req: deletionRequest{}, resp: obj{"status": ""}},
{method: "POST", path: "/api/v1/consent", tag: "Account", summary: "Accept the platform's privacy policy and terms", sessionOnly: true,
description: "`versions` are the versions shown, e.g. `privacy:12,terms:14`; `409 consent_outdated` when a document changed meanwhile. Until an account accepted the current versions, other requests of its sessions get `403 consent_required`.",
@@ -189,6 +189,10 @@ var endpoints = []endpoint{
description: "Paged by email.", resp: paged(obj{"members": []memberView{}})},
{method: "DELETE", path: "/api/v1/org/members/:user", tag: "Organization", summary: "Remove a member", perm: "members.manage", sessionOnly: true,
status: http.StatusNoContent},
{method: "PUT", path: "/api/v1/org/members/:user/owner", tag: "Organization", summary: "Make a member an owner, or step down", sessionOnly: true,
perm: "owner",
description: "Only owners decide. `{\"owner\": false}` on oneself steps down; handing over is making someone else owner first. The last owner cannot step down (`409 last_owner`). A former owner without roles becomes Admin.",
req: ownerRequest{}, status: http.StatusNoContent},
{method: "POST", path: "/api/v1/org/members/:user/roles", tag: "Organization", summary: "Assign a role, optionally limited to a group or status page",
description: "Nobody can grant permissions they do not hold.", perm: "members.manage", sessionOnly: true,
req: assignRequest{}, status: http.StatusCreated, resp: obj{"id": uuid.UUID{}}},
@@ -300,7 +304,7 @@ var endpoints = []endpoint{
description: "A suspended account is signed out everywhere and cannot use its API tokens; signing in again only lets it export or delete its data. 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 the account owns are deleted with it. Platform admins cannot be deleted.",
description: "Organizations the account is the last owner of are deleted with it. 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",
resp: obj{"regions": []regionView{}}},
+1
View File
@@ -38,6 +38,7 @@ var auditActions = map[string]string{
"POST /api/v1/auth/login/totp": "auth.login",
"POST /api/v1/auth/logout": "auth.logout",
"POST /api/v1/consent": "account.consent",
"PUT /api/v1/org/members/:user/owner": "member.owner",
"POST /api/v1/me/org": "",
"POST /api/v1/me/totp/setup": "",
"POST /api/v1/me/totp/enable": "account.totp_enable",
+7 -5
View File
@@ -249,7 +249,7 @@ func (s *Server) restrictedMe(c *gin.Context, sess *auth.Session) (web.Me, error
return web.Me{}, err
}
me := toWebMe(m)
me.DeletesOrgs, err = s.ownedOrgs(c.Request.Context(), sess.UserID)
me.DeletesOrgs, err = s.lastOwnedOrgs(c.Request.Context(), sess.UserID)
return me, err
}
@@ -342,14 +342,16 @@ func (s *Server) signupConsentView(ctx context.Context) (web.SignupConsent, erro
return web.SignupConsent{Docs: s.consentDocs(ctx, required), Versions: consentVersions(required)}, nil
}
// ownedOrgs names the organizations user owns, which deleting the account
// deletes too.
func (s *Server) ownedOrgs(ctx context.Context, user uuid.UUID) ([]string, error) {
// lastOwnedOrgs names the organizations user is the last owner of, which
// deleting the account deletes too.
func (s *Server) lastOwnedOrgs(ctx context.Context, user uuid.UUID) ([]string, error) {
var out []string
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
owned, err := q.OwnedOrgs(ctx, user)
for _, o := range owned {
out = append(out, fmt.Sprintf("%s (%s)", o.Name, o.Slug))
if o.Owners == 1 {
out = append(out, fmt.Sprintf("%s (%s)", o.Name, o.Slug))
}
}
return err
})
+1 -1
View File
@@ -174,7 +174,7 @@ func TestSuspendedAccount(t *testing.T) {
t.Errorf("console of a suspended account landed on %s", got)
}
_, _, page := back.page("/account/suspended")
if !strings.Contains(page, "Unpaid invoice") || !strings.Contains(page, "Delete account") || !strings.Contains(page, "You own these organizations") {
if !strings.Contains(page, "Unpaid invoice") || !strings.Contains(page, "Delete account") || !strings.Contains(page, "You are the last owner of these organizations") {
t.Error("the suspension page lacks the reason or the way out")
}
st, body := back.do("GET", "/api/v1/org/monitors", nil)
+17 -5
View File
@@ -603,9 +603,9 @@ func purgeOrg(ctx context.Context, q *store.Queries, org uuid.UUID) error {
}
// deleteAccount erases the signed-in user (Art. 17). Organizations the
// user owns go with the account, monitors and all, even when they have
// other members: an organization has exactly one owner, and nobody would be
// left to run it.
// user is the last owner of go with the account, monitors and all, even
// when they have other members: nobody would be left to run them. The user
// just leaves organizations with further owners.
// Suspended accounts and those that have not accepted the terms may do
// this too.
func (s *Server) deleteAccount(c *gin.Context) {
@@ -640,8 +640,8 @@ func (s *Server) deleteAccount(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"status": "deleted"})
}
// eraseAccount deletes u with the organizations u owns and ends u's
// sessions; u leaves the others.
// eraseAccount deletes u with the organizations u is the last owner of and
// ends u's sessions; u leaves the others.
func (s *Server) eraseAccount(ctx context.Context, u store.User) (orgsDeleted int, err error) {
err = s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
owned, err := q.OwnedOrgs(ctx, u.ID)
@@ -649,6 +649,18 @@ func (s *Server) eraseAccount(ctx context.Context, u store.User) (orgsDeleted in
return err
}
for _, o := range owned {
if err := q.LockOrgOwners(ctx, o.ID); err != nil {
return err
}
// Counted again under the lock: another owner may be stepping
// down right now.
n, err := q.CountOwners(ctx, o.ID)
if err != nil {
return err
}
if n > 1 {
continue
}
if err := purgeOrg(ctx, q, o.ID); err != nil {
return err
}
+1 -1
View File
@@ -275,7 +275,7 @@ func TestDeleteAccount(t *testing.T) {
org := uuid.MustParse(owner.orgID())
owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "web", "type": "heartbeat", "interval_seconds": 3600})
other := e.joinVia(t, owner.invite("x@"+uniq("da")+".test", owner.roleID("viewer")))
if _, _, html := owner.page("/settings/security"); !strings.Contains(html, "You own these organizations") {
if _, _, html := owner.page("/settings/security"); !strings.Contains(html, "You are the last owner of these organizations") {
t.Error("the security page does not warn that the organization goes with the account")
}
if st, body := owner.do("POST", "/api/v1/me/delete", map[string]any{"password": password}); st != http.StatusOK {
+79
View File
@@ -3,6 +3,7 @@ package api
import (
"errors"
"net/http"
"slices"
"strings"
"time"
@@ -495,3 +496,81 @@ func (s *Server) updatePolicy(c *gin.Context) {
}
var errNoSSOProvider = errors.New("api: no enabled sso provider")
// adminRole is the built-in Admin role.
var adminRole = uuid.MustParse("00000000-0000-0000-0000-00000000a001")
type ownerRequest struct {
Owner bool `json:"owner"`
}
// setOwner makes a member an owner or takes it back, the actor's own
// ownership included: handing an organization over is making someone else
// owner and stepping down. Only owners decide, and the last owner stays.
// A former owner without roles keeps working as Admin.
func (s *Server) setOwner(c *gin.Context) {
target, err := uuid.Parse(c.Param("user"))
if err != nil {
fail(c, http.StatusNotFound, "not_found")
return
}
var req ownerRequest
if !bind(c, &req) {
return
}
p := current(c)
if !p.Grants.Owner {
fail(c, http.StatusForbidden, "owner_only")
return
}
auditDetail(c, "user_id", target.String())
auditDetail(c, "owner", req.Owner)
ctx := c.Request.Context()
var code string
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
if err := q.LockOrgOwners(ctx, p.Org.ID); err != nil {
return err
}
m, err := q.GetMembership(ctx, store.GetMembershipParams{OrgID: p.Org.ID, UserID: target})
switch {
case errors.Is(err, pgx.ErrNoRows):
code = "not_found"
return nil
case err != nil:
return err
case m.IsOwner == req.Owner:
return nil
}
if !req.Owner {
n, err := q.CountOwners(ctx, p.Org.ID)
if err != nil {
return err
}
if n <= 1 {
code = "last_owner"
return nil
}
assigned, err := q.ListAssignments(ctx, p.Org.ID)
if err != nil {
return err
}
if !slices.ContainsFunc(assigned, func(a store.ListAssignmentsRow) bool { return a.UserID == target }) {
if _, err := q.CreateAssignment(ctx, store.CreateAssignmentParams{OrgID: p.Org.ID, UserID: target, RoleID: adminRole}); err != nil {
return err
}
}
}
_, err = q.SetOwner(ctx, store.SetOwnerParams{OrgID: p.Org.ID, UserID: target, Owner: req.Owner})
return err
})
switch {
case err != nil:
internalError(c, err)
case code == "not_found":
fail(c, http.StatusNotFound, code)
case code != "":
fail(c, http.StatusConflict, code)
default:
c.Status(http.StatusNoContent)
}
}
+85
View File
@@ -0,0 +1,85 @@
package api_test
import (
"net/http"
"strings"
"testing"
"github.com/google/uuid"
)
func TestOwners(t *testing.T) {
e := newEnv(t)
first := e.browser(t)
first.signup("f@"+uniq("ow")+".test", uniq("ow-"))
org := uuid.MustParse(first.orgID())
firstID := first.userIDSelf()
second := e.joinVia(t, first.invite("s@"+uniq("ow")+".test", first.roleID("viewer")))
secondID := second.userIDSelf()
owner := func(b *browser, user uuid.UUID, on bool) (int, map[string]any) {
return b.do("PUT", "/api/v1/org/members/"+user.String()+"/owner", map[string]any{"owner": on})
}
isOwner := func(user uuid.UUID) bool {
return e.count(t, `SELECT count(*) FROM memberships WHERE org_id = $1 AND user_id = $2 AND is_owner`, org, user) == 1
}
// Only owners decide.
st, body := owner(second, secondID, true)
expect(t, "non-owner makes itself owner", st, body, http.StatusForbidden, "owner_only")
st, body = owner(first, firstID, false)
expect(t, "last owner steps down", st, body, http.StatusConflict, "last_owner")
if _, _, html := first.page("/settings/members"); !strings.Contains(html, "Make owner") || strings.Contains(html, "Step down as owner") {
t.Error("the members page offers the wrong owner actions to the only owner")
}
// Handing over: make someone else owner, then step down.
if st, body := owner(first, secondID, true); st != http.StatusNoContent || !isOwner(secondID) {
t.Fatalf("make owner = %d %v", st, body)
}
if st, _ := second.do("PUT", "/api/v1/org/legal/imprint", map[string]any{"markdown": "# Impressum"}); st != http.StatusNoContent {
t.Errorf("new owner manages the organization = %d", st)
}
if _, _, html := first.page("/settings/members"); !strings.Contains(html, "Step down as owner") || !strings.Contains(html, "Remove as owner") {
t.Error("with two owners the page offers neither stepping down nor removing")
}
st, body = first.do("DELETE", "/api/v1/org/members/"+secondID.String(), nil)
expect(t, "remove an owner", st, body, http.StatusForbidden, "owner_cannot_be_removed")
if st, body := owner(first, firstID, false); st != http.StatusNoContent || isOwner(firstID) {
t.Fatalf("step down = %d %v", st, body)
}
// The former owner keeps working as Admin.
if n := e.count(t, `SELECT count(*) FROM role_assignments WHERE org_id = $1 AND user_id = $2 AND role_id = '00000000-0000-0000-0000-00000000a001'`, org, firstID); n != 1 {
t.Errorf("former owner has %d admin assignments, want 1", n)
}
if st, _ := first.do("GET", "/api/v1/org/members", nil); st != http.StatusOK {
t.Errorf("former owner lists members = %d", st)
}
st, body = owner(first, firstID, true)
expect(t, "former owner takes ownership back", st, body, http.StatusForbidden, "owner_only")
st, body = owner(second, secondID, false)
expect(t, "the new last owner steps down", st, body, http.StatusConflict, "last_owner")
// Deleting an account leaves organizations with further owners and
// takes along those it is the last owner of.
if st, body := owner(second, firstID, true); st != http.StatusNoContent {
t.Fatalf("make owner again = %d %v", st, body)
}
if _, _, html := first.page("/settings/security"); strings.Contains(html, "last owner of these organizations") {
t.Error("an organization with another owner is announced as deleted")
}
if st, body := first.do("POST", "/api/v1/me/delete", map[string]any{"password": password}); st != http.StatusOK {
t.Fatalf("co-owner deletes account = %d %v", st, body)
}
if e.count(t, `SELECT count(*) FROM orgs WHERE id = $1`, org) != 1 || !isOwner(secondID) {
t.Fatal("the organization did not stay with its other owner")
}
if _, _, html := second.page("/settings/security"); !strings.Contains(html, "last owner of these organizations") {
t.Error("the last owner is not warned")
}
if st, body := second.do("POST", "/api/v1/me/delete", map[string]any{"password": password}); st != http.StatusOK {
t.Fatalf("last owner deletes account = %d %v", st, body)
}
if e.count(t, `SELECT count(*) FROM orgs WHERE id = $1`, org) != 0 {
t.Error("the organization survived its last owner")
}
}
+9 -2
View File
@@ -256,7 +256,7 @@ func (s *Server) securityPage(c *gin.Context) {
internalError(c, err)
return
}
if me.DeletesOrgs, err = s.ownedOrgs(ctx, sess.UserID); err != nil {
if me.DeletesOrgs, err = s.lastOwnedOrgs(ctx, sess.UserID); err != nil {
internalError(c, err)
return
}
@@ -400,19 +400,26 @@ func (s *Server) membersView(c *gin.Context, p *principal, page web.Page, me web
var (
roles []store.Role
pending []store.ListPendingInvitationsRow
owners int64
)
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
var err error
if roles, err = q.ListRoles(ctx); err != nil {
return err
}
if owners, err = q.CountOwners(ctx, p.Org.ID); err != nil {
return err
}
pending, err = q.ListPendingInvitations(ctx)
return err
})
if err != nil {
return nil, err
}
v := web.MembersView{CanManage: p.Grants.Can(authz.MembersManage), Pager: pager(c, info)}
v := web.MembersView{
CanManage: p.Grants.Can(authz.MembersManage), Pager: pager(c, info),
IsOwner: p.Grants.Owner, Self: p.UserID.String(), Owners: int(owners),
}
scopeNames, scopes, err := s.scopeOptions(ctx, p)
if err != nil {
return nil, err
+1
View File
@@ -242,6 +242,7 @@ func (s *Server) Mount(r gin.IRouter) {
org.GET("/members", can(authz.MembersRead), s.listMembers)
org.DELETE("/members/:user", sessionOnly(), can(authz.MembersManage), s.removeMember)
org.PUT("/members/:user/owner", sessionOnly(), s.setOwner)
org.POST("/members/:user/roles", sessionOnly(), can(authz.MembersManage), s.assignRole)
org.DELETE("/assignments/:id", sessionOnly(), can(authz.MembersManage), s.unassignRole)
+13 -4
View File
@@ -95,6 +95,7 @@
"audit.action.maintenance.delete": "Wartung gelöscht",
"audit.action.maintenance.update": "Wartung geändert",
"audit.action.member.join": "Der Organisation beigetreten",
"audit.action.member.owner": "Owner geändert",
"audit.action.member.remove": "Mitglied entfernt",
"audit.action.member.role_assign": "Rolle zugewiesen",
"audit.action.member.role_unassign": "Rolle entzogen",
@@ -576,6 +577,7 @@
"error.invitation_email_mismatch": "Diese Einladung ging an eine andere E-Mail-Adresse als die, mit der du angemeldet bist.",
"error.invitation_invalid": "Diese Einladung ist ungültig, abgelaufen oder wurde bereits verwendet.",
"error.keyword_needs_get": "Keyword-Checks brauchen GET-Anfragen.",
"error.last_owner": "Die Organisation braucht mindestens einen Owner. Mache zuerst jemand anderen zum Owner.",
"error.last_sign_in": "Das ist der einzige Anmeldeweg des Kontos. Setze zuerst ein Passwort oder verbinde einen anderen Anbieter.",
"error.locked": "Die Ressource ist von einem anderen Prozess gesperrt.",
"error.maintenance_overlaps": "Die Wartung würde länger dauern als der Abstand bis zur Wiederholung.",
@@ -588,8 +590,9 @@
"error.org_limit": "Dein Konto darf höchstens {{.Max}} Organisationen besitzen.",
"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": "Owner können nicht entfernt werden. Entziehe zuerst die Owner-Rechte.",
"error.owner_has_all_permissions": "Der Owner hat bereits alle Berechtigungen.",
"error.owner_only": "Nur Owner können ändern, wem die Organisation gehört.",
"error.password_too_short": "Das Passwort braucht mindestens {{.Min}} Zeichen.",
"error.permission_escalation": "Du kannst keine Berechtigungen vergeben, die du selbst nicht hast.",
"error.platform_region_limit": "Ein Monitor darf aus höchstens {{.Max}} Plattform-Regionen geprüft werden; eigene Checker-Regionen zählen nicht.",
@@ -768,11 +771,11 @@
"gdpr.account_export_intro": "Lade alles herunter, was über dich gespeichert ist: Profil, Mitgliedschaften, Anmeldeidentitäten, API-Tokens und deine Aktivität. JSON ist maschinenlesbar, PDF gut lesbar.",
"gdpr.delete_account": "Konto löschen",
"gdpr.delete_account_confirm": "Konto endgültig löschen? Das lässt sich nicht rückgängig machen.",
"gdpr.delete_account_intro": "Löscht dein Konto sofort und meldet dich überall ab. Organisationen, die dir gehören, werden mit allem darin mitgelöscht, auch für ihre anderen Mitglieder; aus den übrigen trittst du nur aus. Audit-Einträge in anderen Organisationen bleiben als „Gelöschter Benutzer“ erhalten.",
"gdpr.delete_account_intro": "Löscht dein Konto sofort und meldet dich überall ab. Organisationen, deren letzter Owner du bist, werden mit allem darin mitgelöscht, auch für ihre anderen Mitglieder; aus Organisationen mit weiteren Ownern trittst du nur aus. Um eine Organisation zu erhalten, mache vorher jemand anderen zum Owner. Audit-Einträge in anderen Organisationen bleiben als „Gelöschter Benutzer“ erhalten.",
"gdpr.delete_org": "Organisation löschen",
"gdpr.delete_org_confirm": "Diese Organisation und alle ihre Daten endgültig löschen?",
"gdpr.delete_org_intro": "Löscht die Organisation mit allen Monitoren, Check-Ergebnissen, Statusseiten, Zugängen der Mitglieder und API-Tokens, sofort und endgültig. Die Konten der Mitglieder bleiben bestehen.",
"gdpr.deletes_orgs": "Diese Organisationen gehören dir. Sie werden mit deinem Konto gelöscht, mit allen Monitoren und Statusseiten, auch für ihre anderen Mitglieder:",
"gdpr.deletes_orgs": "Du bist der letzte Owner dieser Organisationen. Sie werden mit deinem Konto gelöscht, mit allen Monitoren und Statusseiten, auch für ihre anderen Mitglieder, außer du machst vorher jemand anderen zum Owner:",
"gdpr.org_data": "Daten der Organisation",
"gdpr.org_export_intro": "Lade Mitglieder, Rollen, Monitore, Gruppen, Kanäle, Statusseiten, SSO-Einstellungen, Vorfälle, das Audit-Log und die Tagesstatistik herunter. Geheimnisse sind nicht enthalten.",
"gdpr.password": "Dein Passwort",
@@ -899,19 +902,25 @@
"md.ul": "Aufzählung",
"md.write": "Schreiben",
"members.assign": "Rolle hinzufügen",
"members.intro": "Rollen bestimmen, was ein Mitglied darf. Niemand kann Berechtigungen vergeben, die er selbst nicht hat.",
"members.intro": "Rollen bestimmen, was ein Mitglied darf. Niemand kann Berechtigungen vergeben, die er selbst nicht hat. Owner dürfen alles; eine Organisation kann mehrere haben und behält immer mindestens einen.",
"members.invite": "Einladen",
"members.invite_link": "Schicke diesen Link an die eingeladene Person. Er gilt 7 Tage und funktioniert einmal.",
"members.invite_submit": "Einladung erstellen",
"members.make_owner": "Zum Owner machen",
"members.make_owner_confirm": "{{.Email}} zum Owner machen? Owner dürfen alles, auch die Organisation löschen und bestimmen, wer noch Owner ist.",
"members.owner": "Owner",
"members.pending": "Offene Einladungen",
"members.remove": "Aus der Organisation entfernen",
"members.remove_confirm": "Dieses Mitglied entfernen? Seine Sessions und API-Tokens enden sofort.",
"members.remove_owner": "Als Owner entfernen",
"members.remove_owner_confirm": "{{.Email}} die Owner-Rechte entziehen? Ohne andere Rollen bleibt die Person als Admin dabei.",
"members.revoke": "Widerrufen",
"members.role": "Rolle",
"members.roles": "Rollen",
"members.scope": "Beschränkt auf",
"members.scope_org": "gesamte Organisation",
"members.step_down": "Als Owner zurücktreten",
"members.step_down_confirm": "Als Owner zurücktreten? Ohne andere Rollen arbeitest du mit der Admin-Rolle weiter.",
"members.title": "Mitglieder",
"members.unassign": "Rolle entfernen",
"moderation.actions": "Sperren oder löschen …",
+13 -4
View File
@@ -95,6 +95,7 @@
"audit.action.maintenance.delete": "Maintenance deleted",
"audit.action.maintenance.update": "Maintenance changed",
"audit.action.member.join": "Joined the organization",
"audit.action.member.owner": "Ownership changed",
"audit.action.member.remove": "Member removed",
"audit.action.member.role_assign": "Role assigned",
"audit.action.member.role_unassign": "Role removed",
@@ -576,6 +577,7 @@
"error.invitation_email_mismatch": "This invitation was sent to a different email address than the one you are signed in with.",
"error.invitation_invalid": "This invitation is invalid, expired or was already used.",
"error.keyword_needs_get": "Keyword checks need GET requests.",
"error.last_owner": "The organization needs at least one owner. Make someone else owner first.",
"error.last_sign_in": "This is the account's only way to sign in. Set a password or connect another provider first.",
"error.locked": "The resource is locked by another process.",
"error.maintenance_overlaps": "The maintenance would last longer than the time until it repeats.",
@@ -588,8 +590,9 @@
"error.org_limit": "Your account may own at most {{.Max}} organizations.",
"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": "Owners cannot be removed. Take their ownership away first.",
"error.owner_has_all_permissions": "The owner already has every permission.",
"error.owner_only": "Only owners can change who owns the organization.",
"error.password_too_short": "The password needs at least {{.Min}} characters.",
"error.permission_escalation": "You cannot grant permissions you do not hold yourself.",
"error.platform_region_limit": "A monitor may be checked from at most {{.Max}} platform regions; your own checker regions do not count.",
@@ -768,11 +771,11 @@
"gdpr.account_export_intro": "Download everything stored about you: profile, memberships, sign-in identities, API tokens and your activity. JSON is machine-readable, PDF easy to read.",
"gdpr.delete_account": "Delete account",
"gdpr.delete_account_confirm": "Delete your account permanently? This cannot be undone.",
"gdpr.delete_account_intro": "Deletes your account immediately and signs you out everywhere. Organizations you own are deleted with it, with everything in them, also for their other members; the others you just leave. Audit entries in other organizations remain, showing \"deleted user\".",
"gdpr.delete_account_intro": "Deletes your account immediately and signs you out everywhere. Organizations you are the last owner of are deleted with it, with everything in them, also for their other members; organizations with further owners you just leave. To keep an organization, make someone else owner first. Audit entries in other organizations remain, showing \"deleted user\".",
"gdpr.delete_org": "Delete organization",
"gdpr.delete_org_confirm": "Delete this organization and all its data permanently?",
"gdpr.delete_org_intro": "Deletes the organization with all monitors, check results, status pages, members' access and API tokens, immediately and permanently. Members' accounts remain.",
"gdpr.deletes_orgs": "You own these organizations. They are deleted with your account, with all their monitors and status pages, also for their other members:",
"gdpr.deletes_orgs": "You are the last owner of these organizations. They are deleted with your account, with all their monitors and status pages, also for their other members, unless you make someone else owner first:",
"gdpr.org_data": "Organization data",
"gdpr.org_export_intro": "Download members, roles, monitors, groups, channels, status pages, SSO settings, incidents, the audit log and daily statistics. Secrets are not included.",
"gdpr.password": "Your password",
@@ -899,19 +902,25 @@
"md.ul": "Bulleted list",
"md.write": "Write",
"members.assign": "Add role",
"members.intro": "Roles decide what each member may do. Nobody can grant permissions they do not hold themselves.",
"members.intro": "Roles decide what each member may do. Nobody can grant permissions they do not hold themselves. Owners may do everything; an organization can have several and always keeps at least one.",
"members.invite": "Invite",
"members.invite_link": "Send this link to the invitee. It is valid for 7 days and works once.",
"members.invite_submit": "Create invitation",
"members.make_owner": "Make owner",
"members.make_owner_confirm": "Make {{.Email}} an owner? Owners can do everything, including deleting the organization and deciding who else is owner.",
"members.owner": "Owner",
"members.pending": "Pending invitations",
"members.remove": "Remove from organization",
"members.remove_confirm": "Remove this member? Their sessions and API tokens end immediately.",
"members.remove_owner": "Remove as owner",
"members.remove_owner_confirm": "Take ownership away from {{.Email}}? Without other roles they keep working as Admin.",
"members.revoke": "Revoke",
"members.role": "Role",
"members.roles": "Roles",
"members.scope": "Limited to",
"members.scope_org": "whole organization",
"members.step_down": "Step down as owner",
"members.step_down_confirm": "Step down as owner? You keep working with the Admin role unless you have other roles.",
"members.title": "Members",
"members.unassign": "Remove role",
"moderation.actions": "Suspend or delete …",
@@ -0,0 +1,12 @@
-- +goose Up
-- An organization may have several owners; the API keeps at least one.
DROP INDEX memberships_one_owner_idx;
-- +goose Down
-- Keeps the longest-standing owner of each organization.
UPDATE memberships m SET is_owner = false
WHERE m.is_owner AND EXISTS (
SELECT 1 FROM memberships o
WHERE o.org_id = m.org_id AND o.is_owner AND (o.created_at, o.user_id) < (m.created_at, m.user_id)
);
CREATE UNIQUE INDEX memberships_one_owner_idx ON memberships (org_id) WHERE is_owner;
+5 -2
View File
@@ -260,7 +260,8 @@ func (q *Queries) OrgMembersExport(ctx context.Context, orgID uuid.UUID) ([]OrgM
const ownedOrgs = `-- name: OwnedOrgs :many
SELECT o.id, o.slug, o.name,
(SELECT count(*) FROM memberships m2 WHERE m2.org_id = o.id)::bigint AS members
(SELECT count(*) FROM memberships m2 WHERE m2.org_id = o.id)::bigint AS members,
(SELECT count(*) FROM memberships m3 WHERE m3.org_id = o.id AND m3.is_owner)::bigint AS owners
FROM orgs o JOIN memberships m ON m.org_id = o.id
WHERE m.user_id = $1 AND m.is_owner
ORDER BY o.name
@@ -271,9 +272,10 @@ type OwnedOrgsRow struct {
Slug string
Name string
Members int64
Owners int64
}
// Organizations user owns, with their member count.
// Organizations user owns, with their member and owner counts.
func (q *Queries) OwnedOrgs(ctx context.Context, userID uuid.UUID) ([]OwnedOrgsRow, error) {
rows, err := q.db.Query(ctx, ownedOrgs, userID)
if err != nil {
@@ -288,6 +290,7 @@ func (q *Queries) OwnedOrgs(ctx context.Context, userID uuid.UUID) ([]OwnedOrgsR
&i.Slug,
&i.Name,
&i.Members,
&i.Owners,
); err != nil {
return nil, err
}
+40
View File
@@ -27,6 +27,17 @@ func (q *Queries) AddMembership(ctx context.Context, arg AddMembershipParams) er
return err
}
const countOwners = `-- name: CountOwners :one
SELECT count(*) FROM memberships WHERE org_id = $1 AND is_owner
`
func (q *Queries) CountOwners(ctx context.Context, orgID uuid.UUID) (int64, error) {
row := q.db.QueryRow(ctx, countOwners, orgID)
var count int64
err := row.Scan(&count)
return count, err
}
const getMembership = `-- name: GetMembership :one
SELECT org_id, user_id, is_owner, created_at FROM memberships WHERE org_id = $1 AND user_id = $2
`
@@ -196,6 +207,17 @@ func (q *Queries) ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUse
return items, nil
}
const lockOrgOwners = `-- name: LockOrgOwners :exec
SELECT pg_advisory_xact_lock(hashtextextended('owners:' || $1::uuid::text, 0))
`
// Serializes ownership changes of an organization, so two owners stepping
// down at once cannot leave it without one.
func (q *Queries) LockOrgOwners(ctx context.Context, orgID uuid.UUID) error {
_, err := q.db.Exec(ctx, lockOrgOwners, orgID)
return err
}
const removeMembership = `-- name: RemoveMembership :execrows
DELETE FROM memberships WHERE org_id = $1 AND user_id = $2 AND NOT is_owner
`
@@ -212,3 +234,21 @@ func (q *Queries) RemoveMembership(ctx context.Context, arg RemoveMembershipPara
}
return result.RowsAffected(), nil
}
const setOwner = `-- name: SetOwner :execrows
UPDATE memberships SET is_owner = $1 WHERE org_id = $2 AND user_id = $3
`
type SetOwnerParams struct {
Owner bool
OrgID uuid.UUID
UserID uuid.UUID
}
func (q *Queries) SetOwner(ctx context.Context, arg SetOwnerParams) (int64, error) {
result, err := q.db.Exec(ctx, setOwner, arg.Owner, arg.OrgID, arg.UserID)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
+6 -1
View File
@@ -50,6 +50,7 @@ type Querier interface {
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
CountMonitors(ctx context.Context, orgID uuid.UUID) (int64, error)
CountOwnedOrgs(ctx context.Context, userID uuid.UUID) (int64, error)
CountOwners(ctx context.Context, orgID uuid.UUID) (int64, error)
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
CountStatusPages(ctx context.Context, orgID uuid.UUID) (int64, error)
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
@@ -231,6 +232,9 @@ type Querier interface {
// Row-level security limits this to platform regions and the scope's org;
// the org's own regions come first.
ListVisibleRegions(ctx context.Context) ([]Region, error)
// Serializes ownership changes of an organization, so two owners stepping
// down at once cannot leave it without one.
LockOrgOwners(ctx context.Context, orgID uuid.UUID) error
// Serializes creations counted against org's limits until the transaction
// ends.
LockOrgUsage(ctx context.Context, orgID uuid.UUID) error
@@ -265,7 +269,7 @@ type Querier interface {
OrgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error)
OrgIncidentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentsExportRow, error)
OrgMembersExport(ctx context.Context, orgID uuid.UUID) ([]OrgMembersExportRow, error)
// Organizations user owns, with their member count.
// Organizations user owns, with their member and owner counts.
OwnedOrgs(ctx context.Context, userID uuid.UUID) ([]OwnedOrgsRow, error)
// Resolved and long silent alerts are history the monitors' results keep.
PurgeAlertmanagerAlerts(ctx context.Context, updatedAt time.Time) (int64, error)
@@ -309,6 +313,7 @@ type Querier interface {
SetAgentAllowPrivate(ctx context.Context, arg SetAgentAllowPrivateParams) (int64, error)
SetOrgDisabledCheckTypes(ctx context.Context, arg SetOrgDisabledCheckTypesParams) error
SetOrgLimits(ctx context.Context, arg SetOrgLimitsParams) (SetOrgLimitsRow, error)
SetOwner(ctx context.Context, arg SetOwnerParams) (int64, error)
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
SetPlatformSetting(ctx context.Context, arg SetPlatformSettingParams) error
// Changing the domain drops a previous verification.
+3 -2
View File
@@ -1,7 +1,8 @@
-- name: OwnedOrgs :many
-- Organizations user owns, with their member count.
-- Organizations user owns, with their member and owner counts.
SELECT o.id, o.slug, o.name,
(SELECT count(*) FROM memberships m2 WHERE m2.org_id = o.id)::bigint AS members
(SELECT count(*) FROM memberships m2 WHERE m2.org_id = o.id)::bigint AS members,
(SELECT count(*) FROM memberships m3 WHERE m3.org_id = o.id AND m3.is_owner)::bigint AS owners
FROM orgs o JOIN memberships m ON m.org_id = o.id
WHERE m.user_id = $1 AND m.is_owner
ORDER BY o.name;
+11
View File
@@ -4,6 +4,17 @@ INSERT INTO memberships (org_id, user_id, is_owner) VALUES ($1, $2, $3);
-- name: RemoveMembership :execrows
DELETE FROM memberships WHERE org_id = $1 AND user_id = $2 AND NOT is_owner;
-- name: LockOrgOwners :exec
-- Serializes ownership changes of an organization, so two owners stepping
-- down at once cannot leave it without one.
SELECT pg_advisory_xact_lock(hashtextextended('owners:' || sqlc.arg(org_id)::uuid::text, 0));
-- name: CountOwners :one
SELECT count(*) FROM memberships WHERE org_id = $1 AND is_owner;
-- name: SetOwner :execrows
UPDATE memberships SET is_owner = sqlc.arg(owner) WHERE org_id = sqlc.arg(org_id) AND user_id = sqlc.arg(user_id);
-- name: ListOrgMembers :many
SELECT u.id, u.email, u.display_name, m.is_owner, m.created_at AS joined_at
FROM memberships m
+12 -4
View File
@@ -179,15 +179,23 @@ func TestEmptyScopeIsRejected(t *testing.T) {
}
}
func TestSingleOwnerPerOrg(t *testing.T) {
// An organization may have several owners; the API keeps at least one.
func TestSeveralOwnersPerOrg(t *testing.T) {
db, _ := setup(t)
f := seed(t, db)
ctx := context.Background()
err := db.Tx(ctx, tenant.Org(f.orgA.ID, f.alice.ID), func(q *store.Queries) error {
return q.AddMembership(ctx, store.AddMembershipParams{OrgID: f.orgA.ID, UserID: f.bob.ID, IsOwner: true})
if err := q.AddMembership(ctx, store.AddMembershipParams{OrgID: f.orgA.ID, UserID: f.bob.ID, IsOwner: true}); err != nil {
return err
}
n, err := q.CountOwners(ctx, f.orgA.ID)
if err == nil && n != 2 {
t.Errorf("CountOwners = %d, want 2", n)
}
return err
})
if err == nil {
t.Error("AddMembership(second owner) error = nil, want unique violation")
if err != nil {
t.Fatal(err)
}
}
+2 -2
View File
@@ -27,8 +27,8 @@ type Me struct {
// organization, with SuspendedReason as they gave it.
OrgSuspended bool
SuspendedReason string
// DeletesOrgs names the organizations the account owns; deleting it
// deletes them, with all their monitors.
// DeletesOrgs names the organizations the account is the last owner
// of; deleting it deletes them, with all their monitors.
DeletesOrgs []string
}
+2 -2
View File
@@ -36,8 +36,8 @@ type Me struct {
// organization, with SuspendedReason as they gave it.
OrgSuspended bool
SuspendedReason string
// DeletesOrgs names the organizations the account owns; deleting it
// deletes them, with all their monitors.
// DeletesOrgs names the organizations the account is the last owner
// of; deleting it deletes them, with all their monitors.
DeletesOrgs []string
}
+29
View File
@@ -50,6 +50,11 @@ type MembersView struct {
// Scopes are the resources an assignment can be limited to; values are
// "<resource_type>:<id>".
Scopes []ScopeOption
// IsOwner is set when the viewer owns the organization and so decides
// who else does; Self is the viewer, Owners counts the owners.
IsOwner bool
Self string
Owners int
}
// ScopeOption is a resource an assignment can be limited to.
@@ -121,6 +126,7 @@ templ MembersPage(p Page, me Me, v MembersView) {
</ul>
</td>
<td class="py-2.5 text-right">
@ownerAction(v, m)
if v.CanManage && !m.IsOwner {
<details class="inline-block text-left">
<summary class="cursor-pointer text-muted hover:text-ink">{ i18n.T(ctx, "sso.action.edit") }</summary>
@@ -488,3 +494,26 @@ templ tokenUsage() {
<a href="/api/docs" class="text-ink underline underline-offset-2">{ i18n.T(ctx, "apidocs.title") }</a>
</p>
}
// ownerAction lets owners make a member an owner or take it back, their
// own included, as long as another owner remains.
templ ownerAction(v MembersView, m Member) {
if v.IsOwner {
switch {
case !m.IsOwner:
@ownerForm(m.UserID, true, i18n.T(ctx, "members.make_owner"), i18n.T(ctx, "members.make_owner_confirm", "Email", m.Email))
case v.Owners > 1 && m.UserID == v.Self:
@ownerForm(m.UserID, false, i18n.T(ctx, "members.step_down"), i18n.T(ctx, "members.step_down_confirm"))
case v.Owners > 1:
@ownerForm(m.UserID, false, i18n.T(ctx, "members.remove_owner"), i18n.T(ctx, "members.remove_owner_confirm", "Email", m.Email))
}
}
}
templ ownerForm(user string, owner bool, label, confirm string) {
<form data-api={ "/org/members/" + user + "/owner" } data-method="put" data-next="/settings/members" data-confirm={ confirm } class="mb-2 inline-block">
<input type="checkbox" name="owner" checked?={ owner } hidden/>
<button type="submit" class="text-sm text-muted underline-offset-2 hover:text-ink hover:underline">{ label }</button>
<p data-error class="hidden text-xs text-down"></p>
</form>
}
+203 -78
View File
@@ -59,6 +59,11 @@ type MembersView struct {
// Scopes are the resources an assignment can be limited to; values are
// "<resource_type>:<id>".
Scopes []ScopeOption
// IsOwner is set when the viewer owns the organization and so decides
// who else does; Self is the viewer, Owners counts the owners.
IsOwner bool
Self string
Owners int
}
// ScopeOption is a resource an assignment can be limited to.
@@ -91,7 +96,7 @@ func settingsHeading(titleID, introID string) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, titleID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 62, Col: 62}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 67, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -109,7 +114,7 @@ func settingsHeading(titleID, introID string) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, introID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 64, Col: 69}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 69, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -148,7 +153,7 @@ func sectionHeading(id string) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 69, Col: 91}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 74, Col: 91}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -186,7 +191,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 73, Col: 20}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 78, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
if templ_7745c5c3_Err != nil {
@@ -204,7 +209,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 75, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 80, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
if templ_7745c5c3_Err != nil {
@@ -217,7 +222,7 @@ func roleSelect(roles []Role, name string) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 75, Col: 34}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 80, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -276,7 +281,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "auth.field.email"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 86, Col: 72}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 91, Col: 72}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@@ -289,7 +294,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.roles"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 87, Col: 69}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 92, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -307,7 +312,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(m.Email)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 95, Col: 16}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 100, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@@ -325,7 +330,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(m.DisplayName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 97, Col: 62}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 102, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
@@ -348,7 +353,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.owner"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 102, Col: 64}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 107, Col: 64}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
@@ -371,7 +376,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(a.RoleName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 107, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 112, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
@@ -389,7 +394,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(a.Scope)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 109, Col: 48}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 114, Col: 48}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
@@ -408,7 +413,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/assignments/" + a.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 114, Col: 52}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 119, Col: 52}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19)
if templ_7745c5c3_Err != nil {
@@ -421,7 +426,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.unassign")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 116, Col: 56}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 121, Col: 56}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
if templ_7745c5c3_Err != nil {
@@ -441,6 +446,10 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = ownerAction(v, m).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if v.CanManage && !m.IsOwner {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<details class=\"inline-block text-left\"><summary class=\"cursor-pointer text-muted hover:text-ink\">")
if templ_7745c5c3_Err != nil {
@@ -449,7 +458,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.action.edit"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 126, Col: 99}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 132, Col: 99}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil {
@@ -462,7 +471,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID + "/roles").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 128, Col: 64}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 134, Col: 64}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
if templ_7745c5c3_Err != nil {
@@ -487,7 +496,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 132, Col: 123}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 138, Col: 123}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
@@ -500,7 +509,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.scope_org"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 134, Col: 64}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 140, Col: 64}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil {
@@ -518,7 +527,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(sc.Value).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 136, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 142, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
if templ_7745c5c3_Err != nil {
@@ -531,7 +540,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(sc.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 136, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 142, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil {
@@ -557,7 +566,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + m.UserID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 144, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 150, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
if templ_7745c5c3_Err != nil {
@@ -570,7 +579,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "members.remove_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 145, Col: 63}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 151, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
if templ_7745c5c3_Err != nil {
@@ -583,7 +592,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.remove"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 147, Col: 42}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 153, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil {
@@ -635,7 +644,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.role"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 165, Col: 117}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 171, Col: 117}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil {
@@ -664,7 +673,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.invite_link"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 170, Col: 67}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 176, Col: 67}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil {
@@ -695,7 +704,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(inv.Email)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 181, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 187, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
@@ -708,7 +717,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inv.RoleName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 181, Col: 71}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 187, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil {
@@ -721,7 +730,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/invitations/" + inv.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 182, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 188, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34)
if templ_7745c5c3_Err != nil {
@@ -734,7 +743,7 @@ func MembersPage(p Page, me Me, v MembersView) templ.Component {
var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 182, Col: 142}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 188, Col: 142}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil {
@@ -839,7 +848,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component {
var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(perm).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 209, Col: 17}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 215, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
if templ_7745c5c3_Err != nil {
@@ -868,7 +877,7 @@ func permissionChecks(all, grantable, checked []string) templ.Component {
var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 215, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 221, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
if templ_7745c5c3_Err != nil {
@@ -932,7 +941,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 229, Col: 15}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 235, Col: 15}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
if templ_7745c5c3_Err != nil {
@@ -950,7 +959,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var44 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.built_in"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 231, Col: 77}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 237, Col: 77}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
if templ_7745c5c3_Err != nil {
@@ -973,7 +982,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 237, Col: 42}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 243, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45)
if templ_7745c5c3_Err != nil {
@@ -986,7 +995,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "roles.delete_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 238, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 244, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46)
if templ_7745c5c3_Err != nil {
@@ -999,7 +1008,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "roles.delete"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 240, Col: 37}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 246, Col: 37}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
if templ_7745c5c3_Err != nil {
@@ -1022,7 +1031,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var48 string
templ_7745c5c3_Var48, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/roles/" + r.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 244, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 250, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var48)
if templ_7745c5c3_Err != nil {
@@ -1065,7 +1074,7 @@ func RolesPage(p Page, me Me, v RolesView) templ.Component {
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 253, Col: 80}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 259, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
if templ_7745c5c3_Err != nil {
@@ -1211,7 +1220,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.policy", "Count", v.MaxDays))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 307, Col: 83}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 313, Col: 83}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
if templ_7745c5c3_Err != nil {
@@ -1234,7 +1243,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "sso.field.name"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 313, Col: 71}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 319, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
if templ_7745c5c3_Err != nil {
@@ -1252,7 +1261,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var54 string
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.owner"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 315, Col: 70}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 321, Col: 70}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
if templ_7745c5c3_Err != nil {
@@ -1270,7 +1279,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.permissions"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 317, Col: 75}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 323, Col: 75}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
if templ_7745c5c3_Err != nil {
@@ -1283,7 +1292,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.created"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 318, Col: 71}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 324, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
if templ_7745c5c3_Err != nil {
@@ -1296,7 +1305,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 319, Col: 71}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 325, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
if templ_7745c5c3_Err != nil {
@@ -1309,7 +1318,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.last_used"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 320, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 326, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
if templ_7745c5c3_Err != nil {
@@ -1327,7 +1336,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(t.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 327, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 333, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
if templ_7745c5c3_Err != nil {
@@ -1340,7 +1349,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var60 string
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(t.Prefix)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 327, Col: 101}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 333, Col: 101}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
if templ_7745c5c3_Err != nil {
@@ -1358,7 +1367,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var61 string
templ_7745c5c3_Var61, templ_7745c5c3_Err = templ.JoinStringErrs(t.UserEmail)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 329, Col: 45}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 335, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var61))
if templ_7745c5c3_Err != nil {
@@ -1381,7 +1390,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "perm."+perm))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 334, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 340, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
if templ_7745c5c3_Err != nil {
@@ -1399,7 +1408,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var63 string
templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(t.CreatedAt)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 338, Col: 80}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 344, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
if templ_7745c5c3_Err != nil {
@@ -1412,7 +1421,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(t.ExpiresAt)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 339, Col: 80}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 345, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil {
@@ -1425,7 +1434,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(t.LastUsedAt)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 340, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 346, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
if templ_7745c5c3_Err != nil {
@@ -1438,7 +1447,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/tokens/" + t.ID).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 344, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 350, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var66)
if templ_7745c5c3_Err != nil {
@@ -1451,7 +1460,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "tokens.revoke_confirm")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 345, Col: 60}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 351, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var67)
if templ_7745c5c3_Err != nil {
@@ -1464,7 +1473,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var68 string
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "members.revoke"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 347, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 353, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
if templ_7745c5c3_Err != nil {
@@ -1515,7 +1524,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.expires"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 362, Col: 117}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 368, Col: 117}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
if templ_7745c5c3_Err != nil {
@@ -1534,7 +1543,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var70 string
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.never"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 366, Col: 55}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 372, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
if templ_7745c5c3_Err != nil {
@@ -1552,7 +1561,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var71 string
templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(d)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 368, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 374, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var71)
if templ_7745c5c3_Err != nil {
@@ -1575,7 +1584,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var72 string
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.days", "Count", d))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 368, Col: 103}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 374, Col: 103}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
if templ_7745c5c3_Err != nil {
@@ -1602,7 +1611,7 @@ func TokensPage(p Page, me Me, v TokensView) templ.Component {
var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.copy_now"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 375, Col: 61}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 381, Col: 61}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
if templ_7745c5c3_Err != nil {
@@ -1702,7 +1711,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_totp_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 406, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 412, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
if templ_7745c5c3_Err != nil {
@@ -1723,7 +1732,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.require_sso_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 408, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 414, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil {
@@ -1736,7 +1745,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 410, Col: 121}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 416, Col: 121}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil {
@@ -1749,7 +1758,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var79 string
templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.NewAttributeExpression(maxDaysValue(v.TokenMaxDays)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 417, Col: 42}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 423, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var79)
if templ_7745c5c3_Err != nil {
@@ -1762,7 +1771,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "org.token_max_days_none")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 418, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 424, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80)
if templ_7745c5c3_Err != nil {
@@ -1775,7 +1784,7 @@ func OrgSettingsPage(p Page, me Me, v OrgSettings) templ.Component {
var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "org.token_max_days_hint"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 422, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 428, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81))
if templ_7745c5c3_Err != nil {
@@ -1864,7 +1873,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var84 string
templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_invalid"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 447, Col: 63}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 453, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84))
if templ_7745c5c3_Err != nil {
@@ -1882,7 +1891,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var85 string
templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.summary", "Org", v.OrgName, "Role", v.RoleName))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 449, Col: 96}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 455, Col: 96}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85))
if templ_7745c5c3_Err != nil {
@@ -1895,7 +1904,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(v.Email)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 450, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 456, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil {
@@ -1914,7 +1923,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/accept").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 453, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 459, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87)
if templ_7745c5c3_Err != nil {
@@ -1944,7 +1953,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.invitation_email_mismatch"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 458, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 464, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
if templ_7745c5c3_Err != nil {
@@ -1957,7 +1966,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 459, Col: 110}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 465, Col: 110}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
if templ_7745c5c3_Err != nil {
@@ -1975,7 +1984,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL("/login?next=/invite/" + v.Token)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 461, Col: 62}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 467, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90)
if templ_7745c5c3_Err != nil {
@@ -1988,7 +1997,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var91 string
templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "invite.sign_in"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 461, Col: 153}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 467, Col: 153}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91))
if templ_7745c5c3_Err != nil {
@@ -2006,7 +2015,7 @@ func InvitationPage(p Page, v Invitation) templ.Component {
var templ_7745c5c3_Var92 string
templ_7745c5c3_Var92, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/invitations/" + v.Token + "/signup").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 463, Col: 59}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 469, Col: 59}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var92)
if templ_7745c5c3_Err != nil {
@@ -2084,7 +2093,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var94 string
templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "tokens.usage"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 485, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 491, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94))
if templ_7745c5c3_Err != nil {
@@ -2097,7 +2106,7 @@ func tokenUsage() templ.Component {
var templ_7745c5c3_Var95 string
templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "apidocs.title"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 488, Col: 98}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 494, Col: 98}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
if templ_7745c5c3_Err != nil {
@@ -2111,4 +2120,120 @@ func tokenUsage() templ.Component {
})
}
// ownerAction lets owners make a member an owner or take it back, their
// own included, as long as another owner remains.
func ownerAction(v MembersView, m Member) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
if v.IsOwner {
switch {
case !m.IsOwner:
templ_7745c5c3_Err = ownerForm(m.UserID, true, i18n.T(ctx, "members.make_owner"), i18n.T(ctx, "members.make_owner_confirm", "Email", m.Email)).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case v.Owners > 1 && m.UserID == v.Self:
templ_7745c5c3_Err = ownerForm(m.UserID, false, i18n.T(ctx, "members.step_down"), i18n.T(ctx, "members.step_down_confirm")).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case v.Owners > 1:
templ_7745c5c3_Err = ownerForm(m.UserID, false, i18n.T(ctx, "members.remove_owner"), i18n.T(ctx, "members.remove_owner_confirm", "Email", m.Email)).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
}
return nil
})
}
func ownerForm(user string, owner bool, label, confirm string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 173, "<form data-api=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var98 string
templ_7745c5c3_Var98, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/org/members/" + user + "/owner").Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 514, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var98)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 174, "\" data-method=\"put\" data-next=\"/settings/members\" data-confirm=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var99 string
templ_7745c5c3_Var99, templ_7745c5c3_Err = templruntime.NewAttributeExpression(confirm).Resolve(ctx)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 514, Col: 124}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var99)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 175, "\" class=\"mb-2 inline-block\"><input type=\"checkbox\" name=\"owner\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if owner {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 176, " checked")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 177, " hidden> <button type=\"submit\" class=\"text-sm text-muted underline-offset-2 hover:text-ink hover:underline\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var100 string
templ_7745c5c3_Var100, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/org.templ`, Line: 516, Col: 108}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var100))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 178, "</button><p data-error class=\"hidden text-xs text-down\"></p></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate