Commit ced5df77 authored by zauberstuhl's avatar zauberstuhl

Controller.checkUser should be a pointer

otherwise it will not update CurrentUser field
parent 54428826
......@@ -54,7 +54,7 @@ func (c ApiHelper) ApiError(status int, msg string) revel.Result {
return c.RenderJSON(ApiError{msg})
}
func (c ApiHelper) checkUser() revel.Result {
func (c *ApiHelper) checkUser() revel.Result {
user, err := models.CurrentUser(c.Controller)
if err != nil {
c.Log.Error(TAG, "db", err, "api", ERR_UNAUTHORIZED)
......
......@@ -20,12 +20,12 @@ package controllers
import "github.com/revel/revel"
func init() {
revel.InterceptMethod(ApiComment.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiLike.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiPost.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiPeople.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiProfile.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiAspect.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiNotification.checkUser, revel.BEFORE)
revel.InterceptMethod(ApiOAuth.checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiComment).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiLike).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiPost).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiPeople).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiProfile).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiAspect).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiNotification).checkUser, revel.BEFORE)
revel.InterceptMethod((*ApiOAuth).checkUser, revel.BEFORE)
}
......@@ -199,7 +199,7 @@ func (o ApiOAuth) Delete(id uint) revel.Result {
// This will overwrite APIHelper checkUser and
// skip authentication on ApiOAuth.Create
func (o ApiOAuth) checkUser() revel.Result {
func (o *ApiOAuth) checkUser() revel.Result {
args := make(map[string]string)
route := revel.MainRouter.Reverse("ApiOAuth.Create", args)
if route != nil && route.URL == o.Request.URL.Path {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment