示例#1
0
文件: super.go 项目: 11101171/whale
func CheckLoginAdmin(c *revel.Controller) revel.Result {
	if c.Session[LOGIN_USERID] == "" || models.Role(c.Session[LOGIN_USERROLE]) != models.ROLE_SUPER_ADMIN {
		return c.Redirect(
			revel.MainRouter.Reverse("Auth.Login", map[string]string{}).Url,
		)
	}
	return nil
}
示例#2
0
文件: super.go 项目: 11101171/whale
func (c *Super) SessionGetUser() (user models.User) {
	user = models.User{
		UserId:   c.Session[LOGIN_USERID],
		Username: c.Session[LOGIN_USERNAME],
		Role:     models.Role(c.Session[LOGIN_USERROLE]),
	}
	return user
}