Ignore:
Timestamp:
06/18/2026 03:19:09 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
7881080
Parents:
6a2abb1
Message:

Hub #1+#2: site admin permissions work + assign owner to another user

#1 — canAdminSite was reading user.siteRoles which was NEVER populated (dead
code) → only god and the literal owner passed admin checks. Now canAdminSite
queries site_members directly (an assigned co-admin). requireSiteManager/BySlug
use canAdminSite so collaborators can access site management too.

#2 — owner_id was hard-coded to the creating god → you couldn't assign a site to
another user (the core of hub mode was missing). Now: god-only "Owner" select in
the site form; create/save set owner_id + a site_members-admin row for that owner
(upsert). Non-god doesn't see the field and cannot change the owner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/admin-site-edit.ejs

    r6a2abb1 r98ecf51  
    2424        <input type="text" name="title" value="<%= site.title || '' %>" required maxlength="200">
    2525      </label>
     26      <%# Eigenaar (her)toewijzen — ALLEEN god. In hub-modus geef je zo elke
     27          gebruiker z'n eigen, zelf te beheren Klonkt. Niet-god ziet dit niet. %>
     28      <% if (user && user.role === 'god') { %>
     29      <label>
     30        <span>Eigenaar <small class="form-hint-inline">— wie deze Klonkt zelf mag beheren</small></span>
     31        <select name="owner_id">
     32          <% (typeof users !== 'undefined' ? users : []).forEach(function(u){ %>
     33            <option value="<%= u.id %>" <%= (site.owner_id === u.id) ? 'selected' : '' %>><%= u.username %><%= u.role === 'god' ? ' (god)' : '' %></option>
     34          <% }); %>
     35        </select>
     36      </label>
     37      <% } %>
    2638      <label>
    2739        <span>Tagline <small class="form-hint-inline">— korte oneliner</small></span>
Note: See TracChangeset for help on using the changeset viewer.