userPermission

package
v0.0.0-...-dffa276 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 7 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminRequired

func AdminRequired(f func(c *gin.Context)) gin.HandlerFunc

AdminRequired run function when user logged in and user has an admin role.

func AuthRequired

func AuthRequired(f func(c *gin.Context)) gin.HandlerFunc

AuthRequired run function when user logged in.

func CurrentOrAdmin

func CurrentOrAdmin(user *model.User, userId uint) bool

CurrentOrAdmin check that user has admin permission or user is the current user.

func CurrentUserIdentical

func CurrentUserIdentical(c *gin.Context, userId uint) (int, error)

CurrentUserIdentical check that userId is same as current user's Id.

func HasAdmin

func HasAdmin(user *model.User) bool

HasAdmin checks that user has an admin permission.

Types

This section is empty.

Jump to

Keyboard shortcuts

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