From e2ad53cebe7491ce3356e5a721edbad30cd72b6e Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Wed, 1 Aug 2018 15:10:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9Akeypair=20owner=5Fid?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E4=B8=8D=E8=B6=B3=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=96=B0=E5=BB=BAkeypair=E7=9A=84=E7=94=A8=E6=88=B7ID=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=AD=A3=E7=A1=AE=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/models/keypairs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/compute/models/keypairs.go b/pkg/compute/models/keypairs.go index 7c9a8fee74..67789bfd80 100644 --- a/pkg/compute/models/keypairs.go +++ b/pkg/compute/models/keypairs.go @@ -4,9 +4,9 @@ import ( "context" "github.com/yunionio/jsonutils" - "github.com/yunionio/onecloud/pkg/mcclient" "github.com/yunionio/onecloud/pkg/cloudcommon/db" "github.com/yunionio/onecloud/pkg/httperrors" + "github.com/yunionio/onecloud/pkg/mcclient" "github.com/yunionio/sqlchemy" ) @@ -27,7 +27,7 @@ type SKeypair struct { Fingerprint string `width:"48" charset:"ascii" nullable:"false" list:"user"` // Column(VARCHAR(length=48, charset='ascii'), nullable=False) PrivateKey string `width:"2048" charset:"ascii" nullable:"false"` // Column(VARCHAR(length=2048, charset='ascii'), nullable=False) PublicKey string `width:"1024" charset:"ascii" nullable:"false" list:"user"` // Column(VARCHAR(length=1024, charset='ascii'), nullable=False) - OwnerId string `width:"36" charset:"ascii" index:"true" nullable:"false"` // Column(VARCHAR(length=36, charset='ascii'), index=True, nullable=False) + OwnerId string `width:"128" charset:"ascii" index:"true" nullable:"false"` // Column(VARCHAR(length=36, charset='ascii'), index=True, nullable=False) } func (manager *SKeypairManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error) { @@ -92,7 +92,7 @@ func (self *SKeypair) AllowUpdateItem(ctx context.Context, userCred mcclient.Tok } func (self *SKeypair) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool { - return self.IsOwner(userCred) + return self.IsOwner(userCred) || userCred.IsSystemAdmin() } func (self *SKeypair) GetLinkedGuestsCount() int {