Documentation ¶
Index ¶
Constants ¶
View Source
const ( // LevelAdmin is the user level for administrators LevelAdmin string = "admin" )
Variables ¶
This section is empty.
Functions ¶
func Authorization ¶
func Authorization(secret *string) gin.HandlerFunc
Authorization is a middleware to check if the user is authorized to access the resource
func OnlyAdmin ¶
func OnlyAdmin() gin.HandlerFunc
OnlyAdmin middleware to check if the user is an administrator
func SameUser ¶
func SameUser() gin.HandlerFunc
SameUser validates if the logged in user is the same as the request
Types ¶
type Session ¶
type Session struct { SessionID string `json:"session_id"` UserID string `json:"user_id"` UserLevel string `json:"user_level"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` }
Session models the session data
func GetSession ¶
GetSession gets the session data from the context
Click to show internal directories.
Click to hide internal directories.