Skip to content

feat(site): add template access warnings to workspace sharing#25368

Draft
tracyjohnsonux wants to merge 1 commit into
mainfrom
feat/workspace-sharing-template-access-warning
Draft

feat(site): add template access warnings to workspace sharing#25368
tracyjohnsonux wants to merge 1 commit into
mainfrom
feat/workspace-sharing-template-access-warning

Conversation

@tracyjohnsonux
Copy link
Copy Markdown
Contributor

When adding users or groups to workspace sharing, the UI now warns if members may not have access to the workspace's template. This prevents the confusing situation where a user is shared on a workspace but cannot see it because they lack template access.

The frontend fetches the template ACL via templateACL(workspace.template_id) and cross-references it with the workspace ACL members. A warning icon with tooltip appears next to each member who may lack template access, and a summary alert is shown above the member list when any warnings exist.

If the template ACL query fails (e.g. insufficient permissions), no warnings are shown to avoid false positives.

Relates to #25338

Implementation details

Changes

  • useWorkspaceSharing.ts: Added templateACL query with retry: false to gracefully handle permission errors
  • WorkspaceSharingForm.tsx: Added templateACL prop, hasTemplateAccess() helper, NoTemplateAccessIcon component with tooltip, summary Alert, and per-row warning icons
  • ShareButton.tsx, WorkspaceSharingPage.tsx, WorkspaceSharingPageView.tsx: Pass templateACL through to WorkspaceSharingForm
  • WorkspaceSharingForm.stories.tsx: New Storybook stories for all warning states

Access check logic

  1. If the "everyone" group (org ID == group ID) is in the template's group ACL, all org members have access; no warnings shown
  2. If the template is restricted, each workspace ACL member is checked against the template's user/group ACL
  3. User-level check does not cover indirect access through group membership; the warning text uses "may not have access" language to account for this

🤖 Generated with Coder Agents

When adding users or groups to workspace sharing, the UI now warns if
members may not have access to the workspace's template. This helps
prevent the confusing situation where a user is shared on a workspace
but cannot see it because they lack template access.

The frontend fetches the template ACL and cross-references it with
the workspace ACL. A warning icon appears next to each member without
template access, and a summary alert is shown above the member list.

If the template ACL query fails (e.g. insufficient permissions), no
warnings are shown to avoid false positives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant