controllers

package
v0.0.0-...-23c8eec Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InvalidType is an error returned if a parameter type is wrong (e.g: string instead of int)
	InvalidType = errors.New("invalid parameter type")
	// UnknownRoom is an error returned if the user requested for a room that doesn't exists
	UnknownRoom = errors.New("unknown room")
	// UnknownUser is an error returned if the user requested for an user that doesn't exists
	UnknownUser = errors.New("unknown user")
	// UnknownMessage is an error returned if the user requested for a room message that doesn't exists
	UnknownMessage = errors.New("unknown message")
)

Functions

func ComparePasswords

func ComparePasswords(password, hash string) bool

ComparePasswords compares an input password with a hashed password (Argon2ID)

func FindGroupFromURL

func FindGroupFromURL(r *http.Request) (*db.Group, error)

FindGroupFromURL parses request's URL and find the corresponding group thanks to the ID

func FindIDFromURL

func FindIDFromURL(r *http.Request, value string) (int, error)

FindIDFromURL extracts a snowflake identifier from the URL, using mux variables

func FindMessageFromURL

func FindMessageFromURL(r *http.Request) (*db.Message, error)

FindMessageFromURL parses request's URL and find the corresponding message thanks to the ID

func FindRoomFromURL

func FindRoomFromURL(r *http.Request) (*db.Room, error)

FindRoomFromURL parses request's URL and find the corresponding room thanks to the ID

func FindUserFromURL

func FindUserFromURL(r *http.Request) (*db.User, error)

FindRoomFromURL parses request's URL and find the corresponding user thanks to the ID

func GenerateSalt

func GenerateSalt(n int) string

GenerateSalt generates a n-length salt for password generation

func UpdateGroupInheritances

func UpdateGroupInheritances(group *db.Group, inheritances []uint) (errorsList []utils.Error)

UpdateGroupInheritances updates inheritances of a group inside the database

func UpdateGroupRoomPermissions

func UpdateGroupRoomPermissions(group *db.Group, roomPermissions map[uint]uint) (errorsList []utils.Error)

UpdateGroupRoomPermissions updates room permissions of a group inside the database

Types

This section is empty.

Jump to

Keyboard shortcuts

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