Documentation
¶
Index ¶
- func CheckAccess(ctx fiber.Ctx, logger *zap.SugaredLogger, retrievedSettings *settings.Settings, ...) error
- func CheckAccessWithHooks(ctx fiber.Ctx, logger *zap.SugaredLogger, retrievedSettings *settings.Settings, ...) error
- func CreateNewPad(ds db.DataStore) *pad.Pad
- func GetTxtFromAText(retrievedPad *pad.Pad, atext apool.AText) (*string, error)
- func NormalizeAuthzLevel(level interface{}) (*string, error)
- func SplitRemoveLastRune(s string) []string
- func UserCanModify(padId *string, req *webaccess.SocketClientRequest, ...) bool
- type ApiSessionInfo
- type ClientType
- type GlobalPadCache
- type GrantedAccess
- type IdRequest
- type LineModel
- type List
- type Manager
- func (m *Manager) DoesPadExist(padID string) (*bool, error)
- func (m *Manager) GetPad(padID string, text *string, authorId *string) (*pad.Pad, error)
- func (m *Manager) IsValidPadId(padID string) bool
- func (m *Manager) RemovePad(padID string) error
- func (m *Manager) SanitizePadId(padID string) (*string, error)
- func (m *Manager) UnloadPad(id string)
- type ReadOnlyManager
- type SecurityManager
- type SessionManager
- func (sm *SessionManager) CreateSession(groupID string, authorID string, validUntil int64) (string, error)
- func (sm *SessionManager) DeleteSession(sessionID string) (bool, error)
- func (sm *SessionManager) DoesSessionExist(sessionID string) (bool, error)
- func (sm *SessionManager) FindAuthorID(groupID string, sessionCookie *string) *string
- func (sm *SessionManager) GetSessionInfo(sessionID string) (*ApiSessionInfo, error)
- func (sm *SessionManager) ListSessionsOfAuthor(authorID string) (map[string]ApiSessionInfo, error)
- func (sm *SessionManager) ListSessionsOfGroup(groupID string) (map[string]ApiSessionInfo, error)
- type UserSettings
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 GetTxtFromAText ¶ added in v0.0.2
func NormalizeAuthzLevel ¶
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 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)
type GrantedAccess ¶
type LineModel ¶ added in v0.0.2
LineModel is an alias for models.LineModel for backwards compatibility
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) IsValidPadId ¶
type ReadOnlyManager ¶
func NewReadOnlyManager ¶
func NewReadOnlyManager(db db.DataStore) *ReadOnlyManager
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 (*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.