2022-09-28 09:01:17 +02:00
|
|
|
package session
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/internal/entity"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Get returns an existing client session.
|
2022-10-03 23:39:36 +02:00
|
|
|
func (s *Session) Get(id string) (m *entity.Session, err error) {
|
2022-09-28 09:01:17 +02:00
|
|
|
if id == "" {
|
2022-10-03 23:39:36 +02:00
|
|
|
return &entity.Session{}, fmt.Errorf("new")
|
2022-09-28 09:01:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return entity.FindSession(id)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exists checks whether a client session with the specified ID exists.
|
|
|
|
func (s *Session) Exists(id string) bool {
|
|
|
|
_, err := s.Get(id)
|
|
|
|
|
|
|
|
return err == nil
|
|
|
|
}
|