Files
silo-server/internal/models/user.go
28c6ddc237 feat(playback): add per-user transcoding controls (#375)
* feat(playback): add per-user transcoding controls

* fix(playback): enforce forced video transcode permission

* chore: address transcode control review feedback

* fix(playback): recheck transcode permission on audio switch

---------

Co-authored-by: Quick104 <31828688+Quick104@users.noreply.github.com>
2026-07-10 22:30:04 -04:00

72 lines
2.7 KiB
Go

package models
import "time"
// User represents a row in the users table.
type User struct {
ID int
Email string
Username string
PasswordHash string
LocalPasswordLoginEnabled bool
Role string
Permissions []string
Enabled bool
LibraryIDs []int // nullable in PG (nil = all libraries)
MaxPlaybackQuality string
AccessPolicyRevision int64
MaxStreams int
MaxTranscodes int
TranscodeAllowed bool
AudioTranscodeAllowed bool
MaxProfiles int
DownloadAllowed bool
DownloadTranscodeAllowed bool
AccessGroupID *int64
CreatedAt time.Time
UpdatedAt time.Time
}
// CreateUserInput contains the fields required to create a new user.
type CreateUserInput struct {
Email string // required
Username string // required
Password string // plaintext, will be bcrypt-hashed
LocalPasswordLoginEnabled *bool
Role string // e.g. "admin", "user"
Permissions []string
LibraryIDs []int
MaxPlaybackQuality string
MaxStreams *int // nil = use DB default (0 = unrestricted at the user layer; the access group governs)
MaxTranscodes *int // nil = use DB default (0 = unrestricted at the user layer; the access group governs)
TranscodeAllowed *bool // nil = use DB default (true)
AudioTranscodeAllowed *bool // nil = use DB default (true)
MaxProfiles *int // nil = use DB default (5); minimum 1
DownloadAllowed *bool // nil = use DB default (true)
DownloadTranscodeAllowed *bool // nil = use DB default (false)
AccessGroupID *int64
}
// UpdateUserInput contains optional fields for updating a user.
// Pointer fields: nil means "don't update", non-nil means "set to this value".
type UpdateUserInput struct {
Email *string
Username *string
Password *string // plaintext, will be bcrypt-hashed if provided
LocalPasswordLoginEnabled *bool
Role *string
Permissions *[]string
Enabled *bool
LibraryIDs *[]int
MaxPlaybackQuality *string
MaxStreams *int
MaxTranscodes *int
TranscodeAllowed *bool
AudioTranscodeAllowed *bool
MaxProfiles *int
DownloadAllowed *bool
DownloadTranscodeAllowed *bool
AccessGroupIDSet bool
AccessGroupID *int64
}