Merge pull request #857 in YUNIONIO/onecloud from ~WANYAOQI/onecloud:bugfix/wyq/fix-isolated-device-update to release/2.4.0

* commit 'fb41fcb817e208f1fb23d94ebbae823c608e8f4e':
  fix isolated device update
This commit is contained in:
李泽玺
2018-12-29 17:13:53 +08:00
+5 -1
View File
@@ -68,7 +68,7 @@ type SIsolatedDevice struct {
DevType string `width:"16" charset:"ascii" nullable:"false" default:"" index:"true" list:"admin" create:"admin_required"` // Column(VARCHAR(16, charset='ascii'), nullable=False, default='', server_default='', index=True)
// # Specific device name read from lspci command, e.g. `Tesla K40m` ...
Model string `width:"32" charset:"ascii" nullable:"false" default:"" index:"true" list:"admin" create:"admin_required"` // Column(VARCHAR(32, charset='ascii'), nullable=False, default='', server_default='', index=True)
Model string `width:"32" charset:"ascii" nullable:"false" default:"" index:"true" list:"admin" create:"admin_required" update:"admin"` // Column(VARCHAR(32, charset='ascii'), nullable=False, default='', server_default='', index=True)
GuestId string `width:"36" charset:"ascii" nullable:"true" index:"true" list:"admin"` // Column(VARCHAR(36, charset='ascii'), nullable=True, index=True)
@@ -95,6 +95,10 @@ func (manager *SIsolatedDeviceManager) AllowCreateItem(ctx context.Context, user
return db.IsAdminAllowCreate(userCred, manager)
}
func (self *SIsolatedDevice) AllowUpdateItem(ctx context.Context, userCred mcclient.TokenCredential) bool {
return db.IsAdminAllowUpdate(userCred, self)
}
func (manager *SIsolatedDeviceManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error) {
q, err := manager.SStandaloneResourceBaseManager.ListItemFilter(ctx, q, userCred, query)
if err != nil {