Phase 10, part 4: inviting users, and what admins can change

Settings → Users lists everyone with their access and status. Admins
invite people by email (a link for 7 days), as admins or as members with
modules each to view or edit; the invitation's page sets the password,
profile and emails wanted. Admins can resend or withdraw invitations,
change access, turn accounts off and on, unlock, reset two-factor, sign
someone out, and remove them; never the owner, nor themselves. Your
account gets the emails wanted and a photo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:07:32 -07:00
co-authored by Claude Opus 5.5
parent 8040512a18
commit 47a504b7b2
18 changed files with 1220 additions and 15 deletions
+25 -1
View File
@@ -139,7 +139,8 @@
<div class="settings">
<nav class="settings-nav" aria-label="Settings sections">
{{with .Viewer}}{{if .User}}<div class="nav-label">You</div>
<a href="/settings/account" {{if eq $.Nav "settings/account"}}aria-current="page"{{end}}>{{template "icon" "profile"}}Your account</a>{{end}}{{end}}
<a href="/settings/account" {{if eq $.Nav "settings/account"}}aria-current="page"{{end}}>{{template "icon" "profile"}}Your account</a>
{{if .Member.Admin}}<a href="/settings/users" {{if eq $.Nav "settings/users"}}aria-current="page"{{end}}>{{template "icon" "prospects"}}Users</a>{{end}}{{end}}{{end}}
<div class="nav-label">Company</div>
<a href="/settings/profile" {{if eq .Nav "settings/profile"}}aria-current="page"{{end}}>{{template "icon" "profile"}}Profile</a>
<div class="nav-label">Connections</div>
@@ -271,3 +272,26 @@
{{else}}<p class="help">None this week.</p>{{end}}
</section>
{{end}}
{{/* Users (Settings → Users, and one user's page). */}}
{{define "user-status"}}{{if eq .Status "invited"}}{{if .InviteEnd.IsZero}}<span class="pill warn">Invitation expired</span>{{else}}<span class="pill">Invited</span> <span class="muted small">until {{.InviteEnd.Local.Format "2 Jan"}}</span>{{end}}{{else if eq .Status "disabled"}}<span class="pill">Turned off</span>{{else if .Locked}}<span class="pill warn">Locked</span>{{else}}<span class="pill ok">Active</span>{{if .TwoFactor}} <span class="muted small">two-factor</span>{{end}}{{end}}{{end}}
{{/* Role and modules: {{template "access-fields" (dict "Role" … "Modules" … "Grants" …)}} */}}
{{define "access-fields"}}{{$mods := .Modules}}
<fieldset class="access">
<legend>Access</legend>
<label class="check"><input type="radio" name="role" value="admin" {{if eq (print .Role) "admin"}}checked{{end}}> <span><strong>Admin</strong>: every module, Settings, users and connections</span></label>
<label class="check"><input type="radio" name="role" value="member" {{if ne (print .Role) "admin"}}checked{{end}}> <span><strong>Member</strong>: these modules</span></label>
<table class="list access-grid">
<tbody>
{{range .Grants}}{{$a := print (index $mods .ID)}}<tr>
<td>{{.Name}}</td>
<td><label class="check"><input type="radio" name="module:{{.ID}}" value="" {{if eq $a ""}}checked{{end}}> No access</label></td>
<td><label class="check"><input type="radio" name="module:{{.ID}}" value="view" {{if eq $a "view"}}checked{{end}}> View</label></td>
<td><label class="check"><input type="radio" name="module:{{.ID}}" value="edit" {{if eq $a "edit"}}checked{{end}}> Edit</label></td>
</tr>{{end}}
</tbody>
</table>
<p class="help">An admin has them all, whatever is chosen here. <em>View</em> shows a module's pages without the buttons and forms that change things.</p>
</fieldset>
{{end}}