photoprism/internal/session/session_public.go
Michael Mayer f5a8c5a45d Auth: Session and ACL enhancements #98 #1746
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-09-28 09:01:17 +02:00

22 lines
460 B
Go

package session
import (
"github.com/photoprism/photoprism/internal/entity"
)
var Public *entity.Session
var PublicID = "234200000000000000000000000000000000000000000000"
// Public returns a client session for use in public mode.
func (s *Session) Public() *entity.Session {
if Public != nil {
return Public
}
Public = entity.NewSession(s.expiresAfter)
Public.ID = PublicID
Public.SetUser(&entity.Admin)
Public.CacheDuration(-1)
return Public
}