Beispiel #1
0
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
}
Beispiel #2
0
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
}