authorization

package
v0.0.0-...-777ca84 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetaLocationQuery uint = 1
	MetaLocationBody  uint = 2
	MetaLocationUrl   uint = 3
)
View Source
var (
	HTTPMethodGET     uint = 1
	HTTPMethodHEAD    uint = 2
	HTTPMethodPOST    uint = 3
	HTTPMethodPUT     uint = 4
	HTTPMethodDELETE  uint = 5
	HTTPMethodCONNECT uint = 6
	HTTPMethodOPTIONS uint = 7
	HTTPMethodTRACE   uint = 8
	HTTPMethodPATCH   uint = 9
)
View Source
var Cached_user_rules = CachedUserRules{CacheManager: CacheManager{LastModifiedTimeKey: "user_rules_ts_",
	LastModifiedTime: time.Now().Unix()}, Cache: make(map[uint][]userRules)}
View Source
var HttpMethodIDMap = map[string]uint{
	"GET":     1,
	"HEAD":    2,
	"POST":    3,
	"PUT":     4,
	"DELETE":  5,
	"CONNECT": 6,
	"OPTIONS": 7,
	"TRACE":   8,
	"PATCH":   9,
}
View Source
var MetaLocationIDMap = map[string]uint{
	"query": 1,
	"body":  2,
	"url":   3,
}
View Source
var Rule_regex_compiled = make(map[uint]*regexp.Regexp)

Functions

func AddNewRule

func AddNewRule(c *fiber.Ctx) error

func AssignNewRule

func AssignNewRule(c *fiber.Ctx) error

func CheckRules

func CheckRules(c *fiber.Ctx, user_id uint) bool

func CompileAllRegexRules

func CompileAllRegexRules()

func InitStaticTypesDB

func InitStaticTypesDB()

func ListAllRules

func ListAllRules(c *fiber.Ctx) error

func ListAssignedRules

func ListAssignedRules(c *fiber.Ctx) error

func ReCacheUserRules

func ReCacheUserRules()

func RuleSetDump

func RuleSetDump(c *fiber.Ctx) error

func RuleSetFile

func RuleSetFile(c *fiber.Ctx) error

func RuleSetYamlParser

func RuleSetYamlParser(file []byte) error

func RulseSetYamlDump

func RulseSetYamlDump() []byte

Types

type CacheManager

type CacheManager struct {
	LastModifiedTimeKey string
	LastModifiedTime    int64
}

type CachedUserRules

type CachedUserRules struct {
	CacheManager
	Cache map[uint][]userRules
}

type RuleSets

type RuleSets struct {
	RuleSet []database.Rule `yaml:"RuleSets,flow"`
}

Jump to

Keyboard shortcuts

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