From afb92dfc53be1f34787f86dec514eaa027b6ac63 Mon Sep 17 00:00:00 2001 From: hongming Date: Wed, 12 Feb 2020 15:01:53 +0800 Subject: [PATCH] fix: create context with owner path Signed-off-by: hongming --- pkg/simple/client/openpitrix/openpitrixclient.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/simple/client/openpitrix/openpitrixclient.go b/pkg/simple/client/openpitrix/openpitrixclient.go index 0e8f4a32c..28583821b 100644 --- a/pkg/simple/client/openpitrix/openpitrixclient.go +++ b/pkg/simple/client/openpitrix/openpitrixclient.go @@ -212,16 +212,15 @@ func (c *OpenPitrixClient) Attachment() pb.AttachmentManagerClient { } func SystemContext() context.Context { - ctx := context.Background() - ctx = ctxutil.ContextWithSender(ctx, sender.New(SystemUsername, SystemUserPath, "")) - return ctx + return ContextWithUsername(SystemUsername) } func ContextWithUsername(username string) context.Context { ctx := context.Background() if username == "" { username = SystemUsername } - ctx = ctxutil.ContextWithSender(ctx, sender.New(username, SystemUserPath, "")) + ownerPath := fmt.Sprintf(":%s", username) + ctx = ctxutil.ContextWithSender(ctx, sender.New(username, sender.OwnerPath(ownerPath), "")) return ctx }