Documentation ¶
Index ¶
- Constants
- Variables
- func AuthMiddleware() func(c *fiber.Ctx) error
- type SessionInformation
- func (i *SessionInformation) GetAccount() string
- func (i *SessionInformation) GetAccountUUID() (uuid.UUID, error)
- func (i *SessionInformation) GetPermissionLevel() int16
- func (i *SessionInformation) GetSession() string
- func (i *SessionInformation) GetSessionUUID() (uuid.UUID, error)
- func (i *SessionInformation) HasPermission(perm string) bool
- func (i *SessionInformation) IsValid() bool
Constants ¶
View Source
const PermissionAdmin = "admin"
View Source
const PermissionUseServices = "use_services"
Permission names
Variables ¶
View Source
var Permissions = map[string]int16{
"use_services": 10,
"admin": 100,
}
Permissions
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware() func(c *fiber.Ctx) error
A middleware that checks the jwt token and then also loads all of the session information into the locals
Types ¶
type SessionInformation ¶
type SessionInformation struct {
// contains filtered or unexported fields
}
func GetSessionInfo ¶
func GetSessionInfo(c *fiber.Ctx) (*SessionInformation, error)
func InfoLocals ¶
func InfoLocals(c *fiber.Ctx) *SessionInformation
Get the session information from the locals (just makes the process a little easier)
func (*SessionInformation) GetAccount ¶
func (i *SessionInformation) GetAccount() string
func (*SessionInformation) GetAccountUUID ¶
func (i *SessionInformation) GetAccountUUID() (uuid.UUID, error)
func (*SessionInformation) GetPermissionLevel ¶
func (i *SessionInformation) GetPermissionLevel() int16
func (*SessionInformation) GetSession ¶
func (i *SessionInformation) GetSession() string
func (*SessionInformation) GetSessionUUID ¶
func (i *SessionInformation) GetSessionUUID() (uuid.UUID, error)
func (*SessionInformation) HasPermission ¶
func (i *SessionInformation) HasPermission(perm string) bool
Check if the current user has a specific permission
func (*SessionInformation) IsValid ¶
func (i *SessionInformation) IsValid() bool
Click to show internal directories.
Click to hide internal directories.