Example #1
0
func (p Resource) initServices() {
	services.GetTenantService()
	services.GetTokenService()
	services.GetUserService()
	services.GetRoleService()
	services.GetAuthService()
}
Example #2
0
// RoleListHandler parses the http request and return the exist roles.
// Usage :
//		GET /v1/role
// If successful,response code will be set to 201.
func (p *Resource) RoleListHandler(req *restful.Request, resp *restful.Response) {
	logrus.Infof("RoleListHandler is called!")
	token := req.HeaderParameter("X-Auth-Token")

	ret, count, errorCode, err := services.GetRoleService().RoleList(token)
	if err != nil {
		response.WriteStatusError(errorCode, err, resp)
		return
	}

	p.successList(ret, 0, count, req, resp)

}