mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #6165 from zhaoxiangchun/automated-cherry-pick-of-#6164-upstream-release-3.2
Automated cherry pick of #6164: bugfix mem paginate
This commit is contained in:
@@ -741,6 +741,8 @@ func calculateListResult(data []jsonutils.JSONObject, total, limit, offset int64
|
||||
// do limit
|
||||
if limit > 0 && total-offset > limit {
|
||||
data = data[:limit]
|
||||
} else {
|
||||
data = data[:total-offset]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,22 @@ func (self *SSuggestSysRule) PerformEnable(ctx context.Context, userCred mcclien
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (self *SSuggestSysRule) AllowPerformDisable(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool {
|
||||
return db.IsAdminAllowPerform(userCred, self, "disable")
|
||||
}
|
||||
|
||||
func (self *SSuggestSysRule) PerformDisable(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
if self.Enabled.IsTrue() {
|
||||
db.Update(self, func() error {
|
||||
self.Enabled = tristate.False
|
||||
return nil
|
||||
})
|
||||
db.OpsLog.LogEvent(self, db.ACT_DISABLE, "", userCred)
|
||||
self.PostUpdate(ctx, userCred, query, data)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (self *SSuggestSysRuleManager) AllowGetPropertyRuleType(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user