func (c Admin) checkAdmin() bool { user := model.FindUserByName(c.Session["user_name"]) if user.Email == "*****@*****.**" { return true } else { return false } }
func (c Application) AddUser() revel.Result { if isLogin(c.Controller) { user := model.FindUserByName(c.Session["user_name"]) c.RenderArgs["user"] = user } return nil }
func CurrentUser(c *revel.Controller) (user *model.User) { if c.RenderArgs["user"] != nil { user = c.RenderArgs["user"].(*model.User) return } if isLogin(c) { user = model.FindUserByName(c.Session["user_name"]) return } return nil }
func (c Users) Show(username string) revel.Result { user := model.FindUserByName(username) avatar := user.AvatarUrl() return c.Render(user, avatar) }