admin

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: BSD-1-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AdminSite_Name                  = "Admin"
	AdminSite_URL                   = "/admin"
	AdminSite_Logger request.Logger = &request.NopLogger{}

	AdminSite_ExtensionTemplateManager *templates.Manager
	AdminSite_ExtensionOptions         *extensions.Options
)
View Source
var (
	PermissionViewAdminSite = "view_admin_site"
)

Functions

func Register

func Register[T ModelInterface[T]](m AdminOptions[T])

func RegisterExtension

func RegisterExtension(ext extensions.Extension)

Register an extension to the admin site.

Extensions are separate templates that can be used to add extra functionality

These templates are embedded into the admin site's base template.

func Route added in v1.6.2

func Route() router.Registrar

func Unauthorized

func Unauthorized(r *request.Request, msg ...string)

Unauthorized redirects the user to the unauthorized page. It will also log a stacktrace of the code that called this function.

Types

type AdminDisplayer added in v1.6.2

type AdminDisplayer interface {
	AdminDisplay() string
}

type AdminOptions added in v1.6.2

type AdminOptions[T ModelInterface[T]] struct {
	FormFields []string
	ListFields []string
	Model      T
}

type Application added in v1.6.2

type Application struct {
	Name   string
	Models *orderedmap.Map[string, *Model]
	Index  router.Registrar
	URL    string
}

type Model added in v1.6.2

type Model struct {
	Name string
	Pkg  string

	URL_List   routevars.URLFormatter
	URL_Create routevars.URLFormatter
	URL_Update routevars.URLFormatter
	URL_Delete routevars.URLFormatter

	Model any

	Permissions Permissions
}

type ModelInterface added in v1.6.2

type ModelInterface[T any] interface {
	interfaces.Saver
	interfaces.Deleter
	interfaces.StringGetter[T]
	interfaces.Lister[T]
}

type Permissions added in v1.6.2

type Permissions struct {
	Create string // Name of the Create permission
	Update string // Name of the Update permission
	Delete string // Name of the Delete permission
	List   string // Name of the List permission
}

Jump to

Keyboard shortcuts

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