Phase 10, part 5: access enforced on every page, form and fragment

One table maps every address to an area (a module, Settings, anything
signed in, or public); each route is checked against it, and the app won't
start with a route missing from it. Changing needs edit on the module. For
members who may only view, forms that would change something are shown
disabled and htmx buttons hidden. The menu, the Overview, Search and the
SEO emails follow each person's modules; Settings is for admins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:13:16 -07:00
co-authored by Claude Opus 5.5
parent 47a504b7b2
commit 2b9d04297f
13 changed files with 578 additions and 41 deletions
+7 -3
View File
@@ -462,7 +462,9 @@ func (s *Server) writeReport(ctx context.Context, site seoSite, email bool) (*se
if err := seo.Save(s.DB, rep); err != nil {
return nil, err
}
if email && seo.LoadSettings(s.DB).EmailReport {
if email && s.signsIn() {
s.mailTeam(ctx, "seo-report", "SEO report: "+site.URL+", week to "+rep.WeekTo, rep.Text())
} else if email && seo.LoadSettings(s.DB).EmailReport {
if set, mb, err := s.mailbox(); err == nil {
ectx, cancel := context.WithTimeout(ctx, 2*time.Minute)
err = outreach.SendToSelf(ectx, set, mb, "SEO report: "+site.URL+", week to "+rep.WeekTo, rep.Text(), time.Now())
@@ -504,7 +506,7 @@ func checkEmailedKey(property string) string { return "seo:check-emailed:" + pro
// final data, when something really moved and the settings ask for it.
func (s *Server) dailyChecks(ctx context.Context) {
set := seo.LoadSettings(s.DB)
if !set.EmailCheck {
if !set.EmailCheck && !s.signsIn() {
return
}
for _, site := range s.seoSites() {
@@ -524,7 +526,9 @@ func (s *Server) dailyChecks(ctx context.Context) {
if sent == c.To {
continue
}
if !c.Quiet() {
if !c.Quiet() && s.signsIn() {
s.mailTeam(ctx, "seo-check", fmt.Sprintf("SEO morning check: %s, %d moved", site.URL, len(c.Moves)), c.Text(site.URL))
} else if !c.Quiet() {
mailSet, mb, err := s.mailbox()
if err != nil {
return // email isn't set up: nothing to send with