Feature: let the web console move a host to another group
The Go server now keeps a per-device group override (device_groups.json) edited from the card's "..." menu below Edit remark. The override wins over the group the host reported (or the offline history record) in the device list, the group filter, get_groups and the MCP host tools, so offline records can be regrouped and the change survives restarts. An empty value clears the override; names are capped at 23 characters, matching the Win32 regroup dialog. The command is admin-only and honours the device ACL; it refuses IDs the server has never seen (online or in history) so a stale card cannot create an orphan entry, and the remark handler gets the same guard. Each change is audited as admin.device.group, deleting a device drops its override, and values loaded from disk are trimmed and capped like remarks. The menu entry is gated on the groupEdit capability, so the shared page hides it on the MFC server. Like remarks, the override is a Go-side label: no CMD_SET_GROUP is sent, so the host keeps reporting its own group to other masters. Verified with go test ./..., go vet, gofmt and a node --check pass on the page. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
5f764b2425
commit
034b11fa6a
16 files changed
+895
-54
No files matched your search
@@ -34,6 +34,7 @@ type Server struct {
|
||||
history *devicehistory.Store // nil → no offline devices
|
||||
deviceACL *DeviceACL // nil → no per-device owner filtering
|
||||
deviceNotes *DeviceNotes // nil → no "edit remark" entry in the UI
|
||||
deviceGroups *DeviceGroups // nil → no "edit group" entry in the UI
|
||||
ws *wsHub
|
||||
allowedOrigins []string // for WS Origin allowlist; empty = same-origin only
|
||||
loginIPLimit *wsauth.RateLimiter
|
||||
@@ -103,6 +104,9 @@ type Config struct {
|
||||
// shared page hides the action on a backend that does not implement it
|
||||
// (the MFC server).
|
||||
DeviceNotes *DeviceNotes
|
||||
// DeviceGroups is the per-device group override table. nil disables the
|
||||
// "edit group" menu entry the same way (device_list reports groupEdit).
|
||||
DeviceGroups *DeviceGroups
|
||||
// TransferTarget ("host:port") and TransferDays pre-fill the web UI's
|
||||
// "transfer host" dialog. Reporting them is also what tells the shared
|
||||
// page that this backend implements COMMAND_ASSIGN_MASTER — the MFC server
|
||||
@@ -146,6 +150,7 @@ func (s *Server) WithConfig(cfg Config) *Server {
|
||||
s.sso = cfg.SSO
|
||||
s.deviceACL = cfg.DeviceACL
|
||||
s.deviceNotes = cfg.DeviceNotes
|
||||
s.deviceGroups = cfg.DeviceGroups
|
||||
s.transferTarget = cfg.TransferTarget
|
||||
s.transferDays = cfg.TransferDays
|
||||
s.transferTransport = cfg.TransferTransport
|
||||
@@ -175,6 +180,7 @@ func (s *Server) Start() error {
|
||||
withTrustForwardedFor(s.trustForwardedFor).
|
||||
withDeviceACL(s.deviceACL).
|
||||
withDeviceNotes(s.deviceNotes).
|
||||
withDeviceGroups(s.deviceGroups).
|
||||
withTransferDefaults(s.transferTarget, s.transferDays, s.transferTransport)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
Reference in new issue
Block a user