Documentation ¶
Index ¶
- type BaseController
- func (baseController *BaseController) CatchPanic(functionName string)
- func (baseController *BaseController) Finish()
- func (baseController *BaseController) ParseAndValidate(params interface{}) bool
- func (baseController *BaseController) Prepare()
- func (baseController *BaseController) Response(payload interface{}, err errors.AuthError)
- func (baseController *BaseController) ServeError(err error)
- func (baseController *BaseController) ServeValidationErrors(Errors []string)
- type PermissionController
- type RoleController
- type UserController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseController ¶
type BaseController struct { beego.Controller Enforcer *casbin.Enforcer CurrUserId int SessionOn bool }
BaseController contains basic property and function
func (*BaseController) CatchPanic ¶
func (baseController *BaseController) CatchPanic(functionName string)
CatchPanic is used to catch any Panic and flogging exceptions. Returns a 500 as the response.
func (*BaseController) Finish ¶
func (baseController *BaseController) Finish()
Finish is called once the base controller method completes.
func (*BaseController) ParseAndValidate ¶
func (baseController *BaseController) ParseAndValidate(params interface{}) bool
ParseAndValidate will run the params through the validation framework and then response with the specified localized or provided message.
func (*BaseController) Prepare ¶
func (baseController *BaseController) Prepare()
Prepare is called prior to the base controller method.
func (*BaseController) Response ¶
func (baseController *BaseController) Response(payload interface{}, err errors.AuthError)
Response returns a standard restful response.
func (*BaseController) ServeError ¶
func (baseController *BaseController) ServeError(err error)
ServeError prepares and serves an Error exception.
func (*BaseController) ServeValidationErrors ¶
func (baseController *BaseController) ServeValidationErrors(Errors []string)
ServeValidationErrors prepares and serves a validation exception.
type PermissionController ¶
type PermissionController struct {
BaseController
}
func (*PermissionController) AddPermission ¶
func (p *PermissionController) AddPermission()
AddPermission add a new permission rule in casbin_rule
func (*PermissionController) QueryPermission ¶
func (p *PermissionController) QueryPermission()
QueryPermission query user's all roles and permissions
type RoleController ¶
type RoleController struct {
BaseController
}
func (*RoleController) CreateRole ¶
func (r *RoleController) CreateRole()
CreateRole create a new role according request param
func (*RoleController) DeleteRole ¶
func (r *RoleController) DeleteRole()
DeleteRole delete role info by role id
func (*RoleController) UpdateRole ¶
func (r *RoleController) UpdateRole()
UpdateRole update role info
type UserController ¶
type UserController struct {
BaseController
}
func (*UserController) UpdateUser ¶
func (u *UserController) UpdateUser()
UpdateUser update user info