Use metadata context for account uuid

This commit is contained in:
Benedikt Kulmann
2020-08-25 16:39:25 +02:00
parent e1dc62c2e3
commit 3a81d0335a
4 changed files with 13 additions and 7 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ import (
"github.com/golang/protobuf/ptypes/empty"
merrors "github.com/micro/go-micro/v2/errors"
"github.com/micro/go-micro/v2/metadata"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis-pkg/v2/middleware"
"github.com/owncloud/ocis-settings/pkg/config"
@@ -324,7 +325,7 @@ func cleanUpResource(c context.Context, resource *proto.Resource) {
// the result of this function will always be a valid lower-case UUID or an empty string.
func getValidatedAccountUUID(c context.Context, accountUUID string) string {
if accountUUID == "me" {
if ownAccountUUID, ok := c.Value(middleware.UUIDKey).(string); ok {
if ownAccountUUID, ok := metadata.Get(c, middleware.AccountID); ok {
accountUUID = ownAccountUUID
}
}