server

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server implements a server for managing the users that will be accepted by the bouncer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthHandlers

func AddAuthHandlers(l log.Logger, app *fiber.App, pool *pgxpool.Pool, table *db.AdminTable)

func AddCRUDHandlers

func AddCRUDHandlers(l log.Logger, app *fiber.App, table *db.UserTable)

func AddDiscordHandlers added in v0.4.0

func AddDiscordHandlers(l log.Logger, app *fiber.App, dg *bouncerbot.Bot)

func AuthMiddleware

func AuthMiddleware(l log.Logger, sessionStore *session.Store) fiber.Handler

func ChangePassword

func ChangePassword(l log.Logger, table *db.AdminTable, sessionStore *session.Store) fiber.Handler

func CreateUser

func CreateUser(l log.Logger, table *db.UserTable) fiber.Handler

CreateUser creates a new user and returns the ID.

func DeleteUser

func DeleteUser(l log.Logger, table *db.UserTable) fiber.Handler

DeleteUser removes a user by ID.

func GetAllUsers

func GetAllUsers(l log.Logger, table *db.UserTable) fiber.Handler

GetAllUsers sends the entire users table, possibly filtered by provided query parameters.

func GetUser

func GetUser(l log.Logger, table *db.UserTable) fiber.Handler

GetUser sends the information of the user with the specified ID.

func Login

func Login(l log.Logger, table *db.AdminTable, sessionStore *session.Store) fiber.Handler

func Logout

func Logout(l log.Logger, sessionStore *session.Store) fiber.Handler

func MigrateUser added in v0.4.0

func MigrateUser(l log.Logger, dg *bouncerbot.Bot) fiber.Handler

func UpdateUser

func UpdateUser(l log.Logger, table *db.UserTable) fiber.Handler

UpdateUser updates the information for a user.

Types

type HiddenErr

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

HiddenError signifies that an error should be logged but not reported to the client.

type Migration added in v0.4.0

type Migration struct {
	Name string `json:"name"`
	Year string `json:"role"`
}

Migration defines a user that needs to be assigned a cohort role. The name should match the display name of a current Discord user on the server.

type Migrator added in v0.4.0

type Migrator interface {
	Migrate(name, year string) error
}

Migrator is something that can migrate a user to the new cohort by name.

Jump to

Keyboard shortcuts

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