handlers

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const CookieSessionID = "sid"

CookieSessionID is the session id cookie

View Source
const CookieVisTokenValues = "vtv"

CookieVisTokenValues is the visibility token values cookie

Variables

This section is empty.

Functions

func AllowLocalhost added in v0.10.0

func AllowLocalhost() bool

AllowLocalhost returns the flag controlling if localhost is a valid origin

func CategoryInfo

func CategoryInfo(resp http.ResponseWriter, req *http.Request)

CategoryInfo returns info about the given category or category-value slug

func FolderInfo

func FolderInfo(resp http.ResponseWriter, req *http.Request)

FolderInfo returns info about the given folder path and optionally its subfolders

func FolderVisibilityToken added in v0.11.0

func FolderVisibilityToken(resp http.ResponseWriter, req *http.Request)

FolderVisibilityToken can add or delete a visibility token on a folder. Admin only.

func GetDomain added in v0.10.0

func GetDomain() string

GetDomain returns the DOMAIN env var or a default

func GetSessionFromRequest

func GetSessionFromRequest(ctx context.Context, req *http.Request) (*docs.Session, error)

GetSessionFromRequest tries to get the active session associated with a request. Uses the session cookie.

func IsAdminSession

func IsAdminSession(ctx context.Context, req *http.Request) bool

IsAdminSession checks if the session associated with the request belongs to an admin user. If there is no session, fallbacks to indicating a non-admin session.

func KeywordInfo

func KeywordInfo(resp http.ResponseWriter, req *http.Request)

KeywordInfo returns info about the given keyword slug

func LocationInfo

func LocationInfo(resp http.ResponseWriter, req *http.Request)

LocationInfo returns info about the given location slug

func NotifyDeletePhotoTask

func NotifyDeletePhotoTask(resp http.ResponseWriter, req *http.Request)

NotifyDeletePhotoTask is the handler for deleting photo tasks

func NotifyFinalizePhotoTask

func NotifyFinalizePhotoTask(resp http.ResponseWriter, req *http.Request)

NotifyFinalizePhotoTask is the handler for finalizing photo tasks

func NotifyMasterStorageUpdates

func NotifyMasterStorageUpdates(resp http.ResponseWriter, req *http.Request)

NotifyMasterStorageUpdates handles storage notifications from the photo master bucket

func PhotoGetMetadata

func PhotoGetMetadata(resp http.ResponseWriter, req *http.Request)

PhotoGetMetadata returns metadata for a photo

func PhotoList

func PhotoList(resp http.ResponseWriter, req *http.Request)

PhotoList responds with a listing of photos for the given parameters

func PhotoResize

func PhotoResize(resp http.ResponseWriter, req *http.Request)

PhotoResize returns a resized version of a photo

func SetAuth

func SetAuth(auth Auth)

SetAuth sets the Auth object to use

func SetTasks

func SetTasks(tasks Tasks)

SetTasks sets the task implementation to use

func UserAdd

func UserAdd(resp http.ResponseWriter, req *http.Request)

UserAdd adds a new user

func UserLogin

func UserLogin(resp http.ResponseWriter, req *http.Request)

UserLogin attempts to login a user

func UserLogout

func UserLogout(resp http.ResponseWriter, req *http.Request)

UserLogout ends the active session

func UserSessionRefresh

func UserSessionRefresh(resp http.ResponseWriter, req *http.Request)

UserSessionRefresh refreshes the active session

func VisibilityActivateLink(resp http.ResponseWriter, req *http.Request)

VisibilityActivateLink activates a visibility token link.

func VisibilityCreate added in v0.11.0

func VisibilityCreate(resp http.ResponseWriter, req *http.Request)

VisibilityCreate creates a new visibility token. Admin only.

func VisibilityCreateLink(resp http.ResponseWriter, req *http.Request)

VisibilityCreateLink creates a new link on a visibility token. Admin only.

func VisibilityList added in v0.11.0

func VisibilityList(resp http.ResponseWriter, req *http.Request)

VisibilityList returns a list of all visibility tokens. Admin only.

func VisibilityUpdateLink(resp http.ResponseWriter, req *http.Request)

VisibilityUpdateLink updates an existing visibility token link. Admin only.

Types

type Auth

type Auth interface {
	CheckServiceAccountAuthorization(ctx context.Context, req *http.Request) bool
}

Auth interface for authorization checks. This interface is here to allow for testing to substitute something different.

func GetAuth

func GetAuth() Auth

GetAuth gets the Auth object to use

func NewAuth

func NewAuth() (Auth, error)

NewAuth creates a new real implementation of the Auth interface

type Tasks

type Tasks interface {
	CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest) error
}

Tasks is a wrapper interface around the Google Cloud Tasks client

func GetTasks

func GetTasks() Tasks

GetTasks returns the task implementation to use

func NewTasks

func NewTasks() (Tasks, error)

NewTasks creates a new real implementation for Tasks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL