512feaffd7
This is a backward-compatible MINOR bump (0.4.0 → 0.5.0).
BREAKING NOTES (for users upgrading from pre-0.5.0):
- The nfs_exports.clients column schema changed from []string to
[]NFSClient (per-host options). A migration (0005) transforms existing
string arrays into object arrays, taking export-level options as
defaults for each host.
- ValidateNFSClient now only accepts IPv4 (192.168.1.1) or IPv4/CIDR
(192.168.1.0/24). Hostnames, wildcards, netgroups are rejected.
- If you use NASCTL_IMPORT_ON_BOOT, re-import your /etc/exports to pick
up per-host options.
What changed:
- NFSClient type: {host, read_only, async, root_squash, subtree_check, advanced}
- NFSExport.Clients is now []NFSClient (was []string)
- export-level flags (ro/async/root_squash/subtree_check/advanced) are
preserved as template defaults for newly added hosts in the UI.
- buildExportLine generates: path host1(ro,sync,...) host2(rw,async,...) fsid=N
- ValidateNFSClient: strict IPv4/CIDR only (0-255 octets, /0-32 prefix)
- parseExportLine now parses per-host options from /etc/exports (previously
only the first host's options were kept, others were discarded)
- UI: per-host rows with toggles (ro/async/root_squash/subtree_check) and
advanced options (all_squash, secure, wdelay, hide, crossmnt)
89 lines
2.6 KiB
Go
89 lines
2.6 KiB
Go
package db
|
|
|
|
import "time"
|
|
|
|
type User struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
UID *int64 `json:"uid,omitempty"`
|
|
GID *int64 `json:"gid,omitempty"`
|
|
Groups []string `json:"groups"`
|
|
SMBEnabled bool `json:"smb_enabled"`
|
|
Disabled bool `json:"disabled"`
|
|
// PendingPassword holds a not-yet-applied password. Never serialized.
|
|
PendingPassword string `json:"-"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Admin struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
PasswordHash string `json:"-"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type SambaShare struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Path string `json:"path"`
|
|
Comment string `json:"comment"`
|
|
ReadOnly bool `json:"read_only"`
|
|
GuestOK bool `json:"guest_ok"`
|
|
ValidUsers []string `json:"valid_users"`
|
|
ValidGroups []string `json:"valid_groups"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NFSClient struct {
|
|
Host string `json:"host"`
|
|
ReadOnly bool `json:"read_only"`
|
|
Async bool `json:"async"`
|
|
RootSquash bool `json:"root_squash"`
|
|
SubtreeCheck bool `json:"subtree_check"`
|
|
Advanced NFSAdvanced `json:"advanced"`
|
|
}
|
|
|
|
type NFSExport struct {
|
|
ID int64 `json:"id"`
|
|
Path string `json:"path"`
|
|
Clients []NFSClient `json:"clients"`
|
|
ReadOnly bool `json:"read_only"`
|
|
Async bool `json:"async"`
|
|
RootSquash bool `json:"root_squash"`
|
|
SubtreeCheck bool `json:"subtree_check"`
|
|
FSID int64 `json:"fsid"`
|
|
Advanced string `json:"advanced"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NFSAdvanced struct {
|
|
AllSquash bool `json:"all_squash"`
|
|
Secure bool `json:"secure"`
|
|
WDelay bool `json:"wdelay"`
|
|
Hide bool `json:"hide"`
|
|
Crossmnt bool `json:"crossmnt"`
|
|
}
|
|
|
|
type WatchedMount struct {
|
|
ID int64 `json:"id"`
|
|
Path string `json:"path"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type DirtyModule struct {
|
|
Module string `json:"module"`
|
|
MarkedAt time.Time `json:"marked_at"`
|
|
}
|
|
|
|
type ApplyLogEntry struct {
|
|
ID int64 `json:"id"`
|
|
Module string `json:"module"`
|
|
Message string `json:"message"`
|
|
Success bool `json:"success"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|