From faf00d8d675980cab6473ff34bde6d6bee2d0f5a Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Thu, 10 Dec 2020 19:03:01 +0800 Subject: [PATCH] fix(cloudcommon): perform public should check the sharing scope of resource perform public should check the sharing scope of resource --- pkg/cloudcommon/db/sharablebase.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cloudcommon/db/sharablebase.go b/pkg/cloudcommon/db/sharablebase.go index 2eadee369d..5a8d246581 100644 --- a/pkg/cloudcommon/db/sharablebase.go +++ b/pkg/cloudcommon/db/sharablebase.go @@ -472,6 +472,10 @@ func SharablePerformPublic(model ISharableBaseModel, ctx context.Context, userCr if targetScope.HigherThan(allowScope) { return errors.Wrapf(httperrors.ErrNotSufficientPrivilege, "require %s allow %s", targetScope, allowScope) } + requireScope := model.GetPublicScope() + if requireScope.HigherThan(allowScope) { + return errors.Wrapf(httperrors.ErrNotSufficientPrivilege, "require %s allow %s", requireScope, allowScope) + } _, err = Update(model, func() error { model.SetShare(targetScope)