pad

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAccess

func CheckAccess(ctx fiber.Ctx, logger *zap.SugaredLogger, retrievedSettings *settings.Settings, readOnlyManager *ReadOnlyManager) error

CheckAccess keeps the historical signature (no hook system) and runs without any plugin preAuthorize/preAuthzFailure hooks. New callers should prefer CheckAccessWithHooks so that plugins get a chance to permit or deny early.

func CheckAccessWithHooks added in v0.6.3

func CheckAccessWithHooks(ctx fiber.Ctx, logger *zap.SugaredLogger, retrievedSettings *settings.Settings, readOnlyManager *ReadOnlyManager, hookSystem *hooks.Hook) error

func CreateNewPad added in v0.0.2

func CreateNewPad(ds db.DataStore) *pad.Pad

func GetTxtFromAText added in v0.0.2

func GetTxtFromAText(retrievedPad *pad.Pad, atext apool.AText) (*string, error)

func NormalizeAuthzLevel

func NormalizeAuthzLevel(level interface{}) (*string, error)

NormalizeAuthzLevel mirrors the original webaccess.normalizeAuthzLevel: `true` normalizes to "create", the three known levels pass through, and everything else (false, empty, unknown strings) is denied.

func SplitRemoveLastRune added in v0.0.2

func SplitRemoveLastRune(s string) []string

func UserCanModify

func UserCanModify(padId *string, req *webaccess.SocketClientRequest, readOnlyManager ReadOnlyManager) bool

Types

type ApiSessionInfo added in v0.6.3

type ApiSessionInfo struct {
	GroupID    string `json:"groupID"`
	AuthorID   string `json:"authorID"`
	ValidUntil int64  `json:"validUntil"`
}

ApiSessionInfo is the stored payload of an API session.

type ClientType

type ClientType interface {
}

type GlobalPadCache

type GlobalPadCache struct {
	// contains filtered or unexported fields
}

func (*GlobalPadCache) DeletePad

func (g *GlobalPadCache) DeletePad(padID string)

func (*GlobalPadCache) GetPad

func (g *GlobalPadCache) GetPad(padID string) *pad.Pad

func (*GlobalPadCache) SetPad

func (g *GlobalPadCache) SetPad(padID string, pad *pad.Pad)

type GrantedAccess

type GrantedAccess struct {
	AccessStatus string
	AuthorId     string
}

type IdRequest

type IdRequest struct {
	ReadOnlyPadId string
	PadId         string
	ReadOnly      bool
}

type LineModel added in v0.0.2

type LineModel = models.LineModel

LineModel is an alias for models.LineModel for backwards compatibility

func AnalyzeLine added in v0.0.2

func AnalyzeLine(text string, aline string, attrpool apool.APool) (*LineModel, error)

type List

type List struct {
	// contains filtered or unexported fields
}

func NewList

func NewList(db db.DataStore) List

func (*List) AddPad

func (l *List) AddPad(padID string)

func (*List) GetPads

func (l *List) GetPads() []string

func (*List) RemovePad

func (l *List) RemovePad(padID string)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(db db.DataStore, hook *hooks.Hook) *Manager

func (*Manager) DoesPadExist

func (m *Manager) DoesPadExist(padID string) (*bool, error)

func (*Manager) GetPad

func (m *Manager) GetPad(padID string, text *string, authorId *string) (*pad.Pad, error)

func (*Manager) IsValidPadId

func (m *Manager) IsValidPadId(padID string) bool

func (*Manager) RemovePad

func (m *Manager) RemovePad(padID string) error

func (*Manager) SanitizePadId

func (m *Manager) SanitizePadId(padID string) (*string, error)

func (*Manager) UnloadPad added in v0.0.2

func (m *Manager) UnloadPad(id string)

type ReadOnlyManager

type ReadOnlyManager struct {
	Store db.DataStore
}

func NewReadOnlyManager

func NewReadOnlyManager(db db.DataStore) *ReadOnlyManager

func (*ReadOnlyManager) GetIds

func (r *ReadOnlyManager) GetIds(id *string) (*IdRequest, error)

func (*ReadOnlyManager) GetPadId added in v0.0.2

func (r *ReadOnlyManager) GetPadId(readonlyId string) (*string, error)

func (*ReadOnlyManager) GetReadOnlyId

func (r *ReadOnlyManager) GetReadOnlyId(pad string) string

func (*ReadOnlyManager) IsReadOnlyID added in v0.0.2

func (r *ReadOnlyManager) IsReadOnlyID(id *string) bool

type SecurityManager

type SecurityManager struct {
	ReadOnlyManager *ReadOnlyManager
	PadManager      *Manager
	AuthorManager   *author.Manager
	SessionManager  *SessionManager
}

func NewSecurityManager

func NewSecurityManager(db db.DataStore, hooks *hooks.Hook, padManager *Manager) *SecurityManager

func (*SecurityManager) CheckAccess

func (s *SecurityManager) CheckAccess(padId *string, sessionCookie *string, token *string, userSettings *webaccess.SocketClientRequest) (*GrantedAccess, error)

func (*SecurityManager) HasPadAccess added in v0.0.2

func (s *SecurityManager) HasPadAccess(ctx fiber.Ctx) bool

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

func NewSessionManager

func NewSessionManager(db db.DataStore) *SessionManager

func (*SessionManager) CreateSession added in v0.6.3

func (sm *SessionManager) CreateSession(groupID string, authorID string, validUntil int64) (string, error)

CreateSession stores a new API session and registers it in the group and author listings. Validation of group/author existence and expiry is the caller's responsibility (the API layer mirrors the original's checks).

func (*SessionManager) DeleteSession added in v0.6.3

func (sm *SessionManager) DeleteSession(sessionID string) (bool, error)

DeleteSession removes a session and its listing entries. The boolean reports whether the session existed.

func (*SessionManager) DoesSessionExist added in v0.6.3

func (sm *SessionManager) DoesSessionExist(sessionID string) (bool, error)

DoesSessionExist reports whether a session record exists.

func (*SessionManager) FindAuthorID added in v0.6.3

func (sm *SessionManager) FindAuthorID(groupID string, sessionCookie *string) *string

FindAuthorID mirrors the original SessionManager.findAuthorID: the cookie may be enclosed in double quotes (upstream #3819) and may carry a comma-separated list of session ids. The author of the first session that belongs to the given group and is not expired is returned.

func (*SessionManager) GetSessionInfo added in v0.6.3

func (sm *SessionManager) GetSessionInfo(sessionID string) (*ApiSessionInfo, error)

GetSessionInfo returns the session payload, or (nil, nil) if the session does not exist.

func (*SessionManager) ListSessionsOfAuthor added in v0.6.3

func (sm *SessionManager) ListSessionsOfAuthor(authorID string) (map[string]ApiSessionInfo, error)

ListSessionsOfAuthor returns all sessions registered for an author.

func (*SessionManager) ListSessionsOfGroup added in v0.6.3

func (sm *SessionManager) ListSessionsOfGroup(groupID string) (map[string]ApiSessionInfo, error)

ListSessionsOfGroup returns all sessions registered for a group.

type UserSettings

type UserSettings struct {
	CanCreate         bool
	ReadOnly          bool
	PadAuthorizations *map[string]string
}

Jump to

Keyboard shortcuts

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