Esempio n. 1
0
func UserPermissionTest(r render.Render, req *http.Request) {
	req.ParseForm()
	values := req.Form
	var err error
	data := make(map[string]interface{})
	userIdStr := values.Get("user_id")
	path := values.Get("path")
	if userIdStr == "" || path == "" {
		service.Logs.Error("args err")
		return
	}
	userIdInt, err := strconv.ParseInt(userIdStr, 10, 64)
	if err != nil {
		service.Logs.Error("strconv.ParseInt err(%v)", err)
		return
	}
	ok := service.ValidatePermission(userIdInt, path)
	data["ret"] = ok
	r.JSON(200, data)
	return
}
Esempio n. 2
0
//验证权限
func (this *Galaxy) ValidatePermission(userId int64, path string) bool {
	return service.ValidatePermission(userId, path)
}