feat(api): organization-owned regions, checkers and status page servers
Organizations create regions and agents for themselves under Regions & checkers; an org checker only receives its org's monitors. Platform admins manage shared regions and agents in the admin panel or with the CLI, which gains 'api admin grant|revoke'. The first user of a self-hosted installation becomes a platform admin. Region lists show the org's own regions first. Closes #52 Refs #29 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
607798d742
commit
22f0740056
19 files changed
+1932
-301
No files matched your search
+3
-1
@@ -38,6 +38,8 @@ type meView struct {
|
||||
// Set when an org the user belongs to enforces TOTP and the user has none.
|
||||
TOTPEnrollmentRequired bool `json:"totp_enrollment_required"`
|
||||
RecoveryCodesLeft int `json:"recovery_codes_left"`
|
||||
// IsAdmin marks platform admins, who manage shared regions and agents.
|
||||
IsAdmin bool `json:"is_admin"`
|
||||
}
|
||||
|
||||
func (s *Server) loadMe(ctx context.Context, sess *auth.Session) (meView, error) {
|
||||
@@ -55,7 +57,7 @@ func (s *Server) loadMe(ctx context.Context, sess *auth.Session) (meView, error)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
me = meView{ID: u.ID, Email: u.Email, DisplayName: u.DisplayName, TOTP: u.TotpSecret != nil, ActiveOrg: sess.OrgID, Orgs: []orgView{}, RecoveryCodesLeft: int(left)}
|
||||
me = meView{ID: u.ID, Email: u.Email, DisplayName: u.DisplayName, TOTP: u.TotpSecret != nil, ActiveOrg: sess.OrgID, Orgs: []orgView{}, RecoveryCodesLeft: int(left), IsAdmin: u.IsAdmin}
|
||||
for _, o := range orgs {
|
||||
me.Orgs = append(me.Orgs, orgView{ID: o.ID, Slug: o.Slug, Name: o.Name, IsOwner: o.IsOwner, RequireTOTP: o.RequireTotp})
|
||||
if o.RequireTotp && !me.TOTP {
|
||||
|
||||
Reference in new issue
Block a user