Documentation
¶
Overview ¶
Package safety persists owner policy and enforces it at Plex request boundaries.
Index ¶
- func IsRemote(r *http.Request) bool
- type Policy
- type Service
- func (s *Service) Allowed(u *core.User, t *core.Title) bool
- func (s *Service) BitrateLimit(u *core.User) int
- func (s *Service) CanPlay(u *core.User, remote bool, now time.Time) bool
- func (s *Service) Close()
- func (s *Service) ForUser(u *core.User) Policy
- func (s *Service) Get(id int64) Policy
- func (s *Service) Handler() http.Handler
- func (s *Service) Put(ctx context.Context, id int64, p Policy) error
- func (s *Service) Restricted(u *core.User) bool
- func (s *Service) SetBus(bus clusterbus.Bus)
- func (s *Service) UserPolicy(u *core.User) *core.User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Policy ¶
type Policy struct {
StreamLimit int `json:"streamLimit"`
MaxContentRating string `json:"maxContentRating"`
BlockedGenres []string `json:"blockedGenres"`
BlockedKeywords []string `json:"blockedKeywords"`
RemoteDisabled bool `json:"remoteDisabled"`
MaxBitrateKbps int `json:"maxBitrateKbps"`
// AllowedHours is empty for any time, otherwise hours 0..23 in Timezone.
AllowedHours []int `json:"allowedHours"`
Timezone string `json:"timezone"`
}
func KidsPreset ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ForUser ¶
ForUser also recognizes policy staged before a Plex invitation is accepted.
func (*Service) SetBus ¶
func (s *Service) SetBus(bus clusterbus.Bus)
SetBus connects the cluster bus (nil disconnects): policy changes made on this node reach the others' caches and vice versa.
Click to show internal directories.
Click to hide internal directories.