Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
31 lines
657 B
Go
31 lines
657 B
Go
package server
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
|
|
"pageswiki/internal/store"
|
|
)
|
|
|
|
func (s *Server) probeManagedCampus(campus store.Campus) bool {
|
|
return managedCampusOnline(campus, time.Now())
|
|
}
|
|
|
|
func managedCampusOnline(campus store.Campus, now time.Time) bool {
|
|
return campus.AuthorityMode == "managed" &&
|
|
campus.LastContactError == "" &&
|
|
campus.LastContactAt >= now.Unix()-15
|
|
}
|
|
|
|
func managedCampusByID(
|
|
campuses []store.Campus,
|
|
id int64,
|
|
) (store.Campus, error) {
|
|
for _, campus := range campuses {
|
|
if campus.ID == id && campus.AuthorityMode == "managed" {
|
|
return campus, nil
|
|
}
|
|
}
|
|
return store.Campus{}, errors.New("managed campus not found")
|
|
}
|