Files
Haven/src
ancsemi 128ee742b5 Hide the sidebar Create Channel section for channel-scoped-only grants (#5433 follow-up)
birdcrazy confirmed the #5433 scoping fix works (sub-channel rename and
top-level create are both correctly restricted server-side now), but flagged
a remaining UI issue: the always-visible sidebar "Create Channel" section
still shows up for a user who only holds create_channel inside one
sub-channel, even though every submission from that box creates a top-level
channel and gets denied. It's a dead control.

Root cause: the flat permissions list sent to the client (getUserPermissions)
mixes server-wide and channel-scoped grants together on purpose, since it
also drives per-channel UI like context-menu buttons. The sidebar section is
different — it always performs a server-wide action regardless of which
channel is active, so it needs a global-only signal.

Added getUserGlobalPermissions(), identical to getUserPermissions but
excluding any role assignment or override with a non-null channel_id, sent
alongside the existing permissions array as globalPermissions in session-info
and roles-updated. Client gates the Create Channel section on a new
_hasGlobalPerm() helper instead of _hasPerm(); every other create_channel
check (context menus, per-channel settings) is untouched since those are
correctly channel-context-aware already.
2026-07-07 00:38:38 -04:00
..