user

package
v0.0.26-beta-rc.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPermission

func AddPermission(username string, permission database.PermissionType) (modified bool, err error)

Adds a permission to an arbitrary user. If the user already has the given permission, a database operation is omitted Does not validate the user's existence

func DeleteUser

func DeleteUser(username string) error

Removes a user, also removes everything that depends on the user (permissions, switchPermissions)

func InitLogger

func InitLogger(logger *logrus.Logger)

func IsStandaloneUserAdmin

func IsStandaloneUserAdmin(username string) (bool, error)

Checks if the user is the only entity with user management permission

func Notify

func Notify(username string, title string, description string, level NotificationLevel) error

func RemoveAvatar

func RemoveAvatar(username string) error

Will remove the current avatar of a user unless it is set to `default`

func RemovePermission

func RemovePermission(username string, permission database.PermissionType) (modified bool, err error)

Removes a permission from an arbitrary user. If the user does not have the given permission, a database operation is omitted Does not validate the user's existence

func UploadAvatar

func UploadAvatar(username string, filename string, file multipart.File) error

Accepts a username, filename and multipart file and creates and processes the file

func ValidateCredentials

func ValidateCredentials(username string, password string) (bool, error)

Will return <true / false> based on authentication validity <true> means valid authentication Can return an error if the database fails to return a valid result, meaning service downtime

Types

type NotificationLevel

type NotificationLevel uint8
const (
	NotificationLevelInfo  NotificationLevel = 1
	NotificationLevelWarn  NotificationLevel = 2
	NotificationLevelError NotificationLevel = 3
)

Jump to

Keyboard shortcuts

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