fix: create context with owner path

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2020-02-12 15:01:53 +08:00
parent a003b57351
commit afb92dfc53

View File

@@ -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
}