Documentation
¶
Overview ¶
Package session implements the Etherpad API session endpoints (createSession, getSessionInfo, deleteSession, listSessionsOfGroup, listSessionsOfAuthor from the original HTTP API). Storage and lookup live in pad.SessionManager, which SecurityManager.CheckAccess also consults for access to private group pads.
Index ¶
- func CreateSession(store *lib.InitStore, sessions *pad.SessionManager) fiber.Handler
- func DeleteSession(sessions *pad.SessionManager) fiber.Handler
- func GetSessionInfo(sessions *pad.SessionManager) fiber.Handler
- func Init(store *lib.InitStore)
- func ListSessionsOfAuthor(store *lib.InitStore, sessions *pad.SessionManager) fiber.Handler
- func ListSessionsOfGroup(store *lib.InitStore, sessions *pad.SessionManager) fiber.Handler
- type CreateSessionRequest
- type SessionInfoResponse
- type SessionListResponse
- type SessionResponse
- type SessionWithID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSession ¶
CreateSession godoc @Summary Create an API session @Description Creates a session binding an author to a group until validUntil (unix timestamp in seconds) @Tags Sessions @Accept json @Produce json @Param request body CreateSessionRequest true "Session data" @Success 200 {object} SessionResponse @Failure 400 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/sessions [post]
func DeleteSession ¶
func DeleteSession(sessions *pad.SessionManager) fiber.Handler
DeleteSession godoc @Summary Delete a session @Description Deletes an API session @Tags Sessions @Produce json @Param sessionId path string true "Session ID" @Success 200 {string} string "OK" @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/sessions/{sessionId} [delete]
func GetSessionInfo ¶
func GetSessionInfo(sessions *pad.SessionManager) fiber.Handler
GetSessionInfo godoc @Summary Get session info @Description Returns group, author and expiry of a session @Tags Sessions @Produce json @Param sessionId path string true "Session ID" @Success 200 {object} SessionInfoResponse @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/sessions/{sessionId} [get]
func ListSessionsOfAuthor ¶
ListSessionsOfAuthor godoc @Summary List sessions of an author @Description Returns all sessions of an author @Tags Sessions @Produce json @Param authorId path string true "Author ID" @Success 200 {object} SessionListResponse @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/authors/{authorId}/sessions [get]
func ListSessionsOfGroup ¶
ListSessionsOfGroup godoc @Summary List sessions of a group @Description Returns all sessions of a group @Tags Sessions @Produce json @Param groupId path string true "Group ID" @Success 200 {object} SessionListResponse @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/groups/{groupId}/sessions [get]
Types ¶
type CreateSessionRequest ¶
type CreateSessionRequest struct {
GroupID string `json:"groupID"`
AuthorID string `json:"authorID"`
ValidUntil int64 `json:"validUntil"`
}
CreateSessionRequest represents the request to create an API session
type SessionInfoResponse ¶
type SessionInfoResponse struct {
GroupID string `json:"groupID"`
AuthorID string `json:"authorID"`
ValidUntil int64 `json:"validUntil"`
}
SessionInfoResponse represents the stored data of a session
type SessionListResponse ¶
type SessionListResponse struct {
Sessions []SessionWithID `json:"sessions"`
}
SessionListResponse represents a list of sessions
type SessionResponse ¶
type SessionResponse struct {
SessionID string `json:"sessionID"`
}
SessionResponse represents a response with a session ID
type SessionWithID ¶
type SessionWithID struct {
SessionID string `json:"sessionID"`
SessionInfoResponse
}
SessionWithID is a session info including its ID, used in listings