fix: owner should not be marked as shared when host is shared to their role #492

Merged
ZacharyZcR merged 1 commits from fix/admin-share-permission into dev-1.10.1 2026-01-12 07:29:24 +00:00
ZacharyZcR commented 2026-01-11 14:33:11 +00:00 (Migrated from github.com)

Summary

  • Fix isShared flag logic to exclude host owners
  • Owner retains full edit/delete permissions even when host is shared to their role

Root cause: The SQL query hostAccess.id IS NOT NULL marked hosts as "shared" whenever a hostAccess record existed, without checking if the current user is the owner.

Scenario:

  1. Admin creates a host (owner)
  2. Admin shares host to "Administrator" role
  3. Admin is in "Administrator" role
  4. hostAccess record exists → isShared = true
  5. Frontend hides edit/delete buttons for shared hosts
  6. Admin loses ability to modify their own host

Fix: Add owner check to SQL: hostAccess.id IS NOT NULL AND sshData.userId != userId

Related to #391

## Summary - Fix `isShared` flag logic to exclude host owners - Owner retains full edit/delete permissions even when host is shared to their role **Root cause**: The SQL query `hostAccess.id IS NOT NULL` marked hosts as "shared" whenever a hostAccess record existed, without checking if the current user is the owner. **Scenario**: 1. Admin creates a host (owner) 2. Admin shares host to "Administrator" role 3. Admin is in "Administrator" role 4. `hostAccess` record exists → `isShared = true` 5. Frontend hides edit/delete buttons for shared hosts 6. Admin loses ability to modify their own host **Fix**: Add owner check to SQL: `hostAccess.id IS NOT NULL AND sshData.userId != userId` Related to #391
Sign in to join this conversation.