auth

package
v0.0.0-...-0ad4d90 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Groups = map[string][]string{
	"admin": {
		"atm",
		"datm",
		"wm",
	},
	"training": {
		"ta",
		"ins",
		"mtr",
	},
	"events": {
		"ec",
		"events",
	},
	"fac": {
		"fe",
		"facilities",
	},
	"web": {
		"wm",
		"web",
	},
	"files": {
		"atm",
		"datm",
		"wm",
		"ta",
		"ec",
		"fe",
		"facilities",
	},
}
View Source
var Roles = map[string]Role{
	"atm": {
		Name: "atm",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"datm": {
		Name: "datm",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"ta": {
		Name: "ta",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"ec": {
		Name: "ec",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"fe": {
		Name: "fe",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"wm": {
		Name: "wm",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"ins": {
		Name: "ins",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"ta",
			"wm",
		},
	},
	"mtr": {
		Name: "mtr",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"ta",
			"wm",
		},
	},
	"events": {
		Name: "events",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"ec",
			"wm",
		},
	},
	"web": {
		Name: "web",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"wm",
		},
	},
	"facilities": {
		Name: "facilities",
		RolesCanAdd: []string{
			"atm",
			"datm",
			"fe",
			"wm",
		},
	},
}

Functions

func CanUserModifyRole

func CanUserModifyRole(user *models.User, role string) bool

func HasRole

func HasRole(user *models.User, role string) bool

func HasRoleList

func HasRoleList(user *models.User, roles []string) bool

func InGroup

func InGroup(user *models.User, group string) bool

func SetupGroups

func SetupGroups(groups map[string][]string)

Types

type Role

type Role struct {
	Name        string
	RolesCanAdd []string
}

Jump to

Keyboard shortcuts

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