auth

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionConfigs = []*server.AuthConfig{}
View Source
var GUEST_USER = &entities.User{
	ID:       0,
	Username: "Guest",
	Roles:    []*entities.Role{ROLE_GUEST},
}
View Source
var ROLE_ADMIN = &entities.Role{
	ID:   1,
	Name: "Admin",
	Root: true,
}
View Source
var ROLE_GUEST = &entities.Role{
	ID:   3,
	Name: "Guest",
	Root: false,
}
View Source
var ROLE_USER = &entities.Role{
	ID:   2,
	Name: "User",
	Root: false,
}

Functions

func AllowAll

func AllowAll(c server.Context) bool

func AllowLoggedInUser

func AllowLoggedInUser(c server.Context) bool

func AllowNone

func AllowNone(c server.Context) bool

func AssignUserInfo

func AssignUserInfo(c server.Context) error

func Check

func Check(c server.Context) error

func CommentOwnerCheck

func CommentOwnerCheck(c server.Context) bool

func Config

func Config(cfg *server.AuthConfig) *server.AuthConfig

func FileOwnerCheck

func FileOwnerCheck(c server.Context) bool

func GetAuthConfig

func GetAuthConfig(action string) *server.AuthConfig

func GetComment

func GetComment(c server.Context) error

func GetFile

func GetFile(c server.Context) error

func GetPost

func GetPost(c server.Context) error

func GetProvider

func GetProvider(name string) server.AuthProvider

func GetRolePermission

func GetRolePermission(roleID int, action string) *entities.PermissionValue

func GetRolePermissions

func GetRolePermissions(roleID int) *entities.RolePermissions

func GetRolesFromIDs

func GetRolesFromIDs(IDs []int) []*entities.Role

func New

func New(newProviderFns map[string]NewProviderFn)

func PostOwnerCheck

func PostOwnerCheck(c server.Context) bool

func Providers

func Providers() []server.AuthProvider

func Routes

func Routes(s server.Server)

func SetLoginInfo

func SetLoginInfo(c server.Context, user *entities.User) error

Types

type NewProviderFn

type NewProviderFn func(cfg map[string]string) server.AuthProvider

Jump to

Keyboard shortcuts

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