示例#1
0
func checkUser(c *revel.Controller) revel.Result {
	if _, ok := c.Session["user"]; ok {
		return nil
	}

	c.Flash.Error(c.Message("login.message.notloggedin"))
	return c.Redirect(routes.App.Login())
}
示例#2
0
func adminOnly(c *revel.Controller) revel.Result {
	if c.Session["usertype"] == "ADMIN" {
		return nil
	}

	c.Flash.Error(c.Message("access.message.notallowed"))
	return c.Redirect(routes.App.Index())
}