Fix getting the authenticated user with caldav
continuous-integration/drone/push Build is passing Details

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-04-01 22:51:57 +02:00
parent 7b619bd084
commit 11246b948f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 7 deletions

View File

@ -32,10 +32,10 @@ import (
"strings" "strings"
) )
func getBasicAuthUserFromContext(c echo.Context) (user.User, error) { func getBasicAuthUserFromContext(c echo.Context) (*user.User, error) {
u, is := c.Get("userBasicAuth").(user.User) u, is := c.Get("userBasicAuth").(*user.User)
if !is { if !is {
return user.User{}, fmt.Errorf("user is not user element, is %s", reflect.TypeOf(c.Get("userBasicAuth"))) return &user.User{}, fmt.Errorf("user is not user element, is %s", reflect.TypeOf(c.Get("userBasicAuth")))
} }
return u, nil return u, nil
} }
@ -55,7 +55,7 @@ func ListHandler(c echo.Context) error {
storage := &VikunjaCaldavListStorage{ storage := &VikunjaCaldavListStorage{
list: &models.List{ID: listID}, list: &models.List{ID: listID},
user: &u, user: u,
} }
// Try to parse a task from the request payload // Try to parse a task from the request payload
@ -102,7 +102,7 @@ func TaskHandler(c echo.Context) error {
storage := &VikunjaCaldavListStorage{ storage := &VikunjaCaldavListStorage{
list: &models.List{ID: listID}, list: &models.List{ID: listID},
task: &models.Task{UID: taskUID}, task: &models.Task{UID: taskUID},
user: &u, user: u,
} }
caldav.SetupStorage(storage) caldav.SetupStorage(storage)
@ -120,7 +120,7 @@ func PrincipalHandler(c echo.Context) error {
} }
storage := &VikunjaCaldavListStorage{ storage := &VikunjaCaldavListStorage{
user: &u, user: u,
isPrincipal: true, isPrincipal: true,
} }
@ -150,7 +150,7 @@ func EntryHandler(c echo.Context) error {
} }
storage := &VikunjaCaldavListStorage{ storage := &VikunjaCaldavListStorage{
user: &u, user: u,
isEntry: true, isEntry: true,
} }