control

package
v0.3.66 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: GPL-3.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvoCookie added in v0.3.56

func GetAvoCookie(sessionID, publickeyPath string) (*secure.Cookies, error)

func IsAllowed added in v0.3.56

func IsAllowed(appName string, usrRoles secure.ActionMap, required roletype.Enum) (bool, error)

func RenderUnauthorized added in v0.3.34

func RenderUnauthorized(err error) context.Renderer

Types

type APIController

type APIController struct {
	InstanceController
}

APIController serves JSON data.

func (*APIController) GetKeyedRequest

func (ctrl *APIController) GetKeyedRequest(target interface{}) (husk.Key, error)

GetKeyedRequest will return the Key and update the Target when Requests are sent for updates.

func (*APIController) GetMyToken added in v0.3.41

func (ctrl *APIController) GetMyToken() string

GetMyToken

func (*APIController) GetPageData

func (ctrl *APIController) GetPageData() (page, pageSize int)

GetPageData turns /B1 into page 1. size 1

func (*APIController) Prepare

func (ctrl *APIController) Prepare()

Prepare is called before the Action on a Controller is executed. The API Prepare adds some security Headers to every request.

func (*APIController) Serve

func (ctrl *APIController) Serve(statuscode int, err error, result interface{})

Serve sends data as JSON response.

func (*APIController) ServeBinary

func (ctrl *APIController) ServeBinary(data []byte, filename string)

ServeBinary is used to serve files such as images and documents.

func (*APIController) ServeBinaryWithMIME added in v0.1.10

func (ctrl *APIController) ServeBinaryWithMIME(data []byte, filename, mimetype string)

ServeBinaryWithMIME is used to serve files such as images and documents. You must specify the MIME Type

type ControllerMap

type ControllerMap struct {
	// contains filtered or unexported fields
}

ControllerMap is used to assign Priveliges to Actions

func CreateControlMap

func CreateControlMap(service *mango.Service) *ControllerMap

func (*ControllerMap) Add

func (m *ControllerMap) Add(path string, actionMap secure.ActionMap)

Add is used to specify the permissions required for a controller's actions.

func (*ControllerMap) FilterAPI

func (m *ControllerMap) FilterAPI(ctx *context.Context)

FilterAPI is used to secure API services. When a user is not allowed to access a resource, they will get the Unauthorized Status.

func (*ControllerMap) FilterUI

func (m *ControllerMap) FilterUI(ctx *context.Context)

FilterUI is used to secure web pages. When a user is not allowed to access a Page, they are redirected to secure.login

func (*ControllerMap) GetInstanceID

func (m *ControllerMap) GetInstanceID() string

GetInstanceID returns the ID initially registered with the Service.

func (*ControllerMap) GetPublicKeyPath added in v0.3.37

func (m *ControllerMap) GetPublicKeyPath() string

GetPublicKeyPath return the Location of the public key file registered with the Service.

func (*ControllerMap) GetRequiredRole

func (m *ControllerMap) GetRequiredRole(path, action string) (roletype.Enum, error)

GetRequiredRole will return the RoleType required to access the 'path' and 'action'

func (*ControllerMap) GetServiceName

func (m *ControllerMap) GetServiceName() string

GetServiceName returns the Name initially registered with the Service

type InstanceController

type InstanceController struct {
	beego.Controller
	// contains filtered or unexported fields
}

func (*InstanceController) GetInstanceID

func (ctrl *InstanceController) GetInstanceID() string

func (*InstanceController) SetInstanceMap

func (ctrl *InstanceController) SetInstanceMap(ctrlMap *ControllerMap)
type Menu map[string][]menuItem

func NewMenu

func NewMenu(activeLink string) *Menu
func (m *Menu) AddItem(link, text, iconClass string, children *Menu)
func (m *Menu) AddItemWithID(id, link, text, iconClass string, children *Menu)
func (m *Menu) SetActive(link string) bool

type UIController

type UIController struct {
	APIController
	// contains filtered or unexported fields
}

func (*UIController) CreateSideMenu

func (ctrl *UIController) CreateSideMenu(ctx *context.Context, menu *Menu)

func (*UIController) CreateTopMenu

func (ctrl *UIController) CreateTopMenu(ctx *context.Context, menu *Menu)

func (*UIController) EnableSave added in v0.3.61

func (ctrl *UIController) EnableSave()

func (*UIController) GetMyToken added in v0.3.41

func (ctrl *UIController) GetMyToken() string

func (*UIController) Init added in v0.3.65

func (ctrl *UIController) Init(ct *context.Context, controllerName, actionName string, app interface{})

func (*UIController) Prepare

func (ctrl *UIController) Prepare()

func (*UIController) Serve

func (ctrl *UIController) Serve(data interface{}, err error)

Serve sends the response with 'Error' and 'Data' properties.

func (*UIController) ServeJSON

func (ctrl *UIController) ServeJSON(statuscode int, err error, data interface{})

ServeJSON enables JSON Responses on UI Controllers

func (*UIController) SetTheme added in v0.2.24

func (ctrl *UIController) SetTheme(settings mango.ThemeSetting)

func (*UIController) Setup

func (ctrl *UIController) Setup(name, title string, hasScript bool)

Jump to

Keyboard shortcuts

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