Merge pull request #1846 from wansir/op

fix: create context with owner path
This commit is contained in:
KubeSphere CI Bot
2020-02-13 12:36:37 +08:00
committed by GitHub

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
}