Dashboard: list hosts you can reach; bump @simpleworkjs/ldap to 1.0.1

- New GET /api/user/hosts (auth-only): all hosts for admins, group-filtered
  list for everyone else.
- accessibleHosts() accepts a pre-resolved user.groups, so the web UI's
  OIDC session skips a redundant LDAP getGroups(dn) call.
- Dashboard shows a "Hosts you can reach" / "All hosts" table.
- @simpleworkjs/ldap 1.0.1 fixes addSshKey's ObjectClassViolationError on
  accounts predating the ldapPublicKey objectClass -- was aborting key
  injection (and the SSH connection) on affected accounts.
- Bump to 1.5.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 23:11:23 -04:00
parent a56a31421d
commit 4fb4e77007
8 changed files with 101 additions and 16 deletions
+13
View File
@@ -5,6 +5,7 @@
const router = require('express').Router();
const { isAdmin } = require('../middleware/auth');
const access = require('../utils/access');
router.get('/me', (req, res) => {
res.json({
@@ -14,4 +15,16 @@ router.get('/me', (req, res) => {
});
});
// The hosts this session can SSH to — every host for an admin, otherwise the
// same group-based resolution the SSH front door uses (accessibleHosts),
// fed the OIDC session's already-known groups instead of an LDAP lookup.
router.get('/hosts', async (req, res, next) => {
try {
const hosts = isAdmin(req)
? await access.allHosts()
: await access.accessibleHosts({ uid: req.user && req.user.username, groups: req.groups || [] });
res.json({ results: hosts });
} catch (err) { next(err); }
});
module.exports = router;