Merge "fix audit delete failure: add allow func to filter audit"

This commit is contained in:
Zuul 2018-08-02 08:06:19 +00:00 committed by Gerrit Code Review
commit 8f91f05f32
1 changed files with 3 additions and 1 deletions

View File

@ -83,6 +83,9 @@ class ArchiveAudits(horizon.tables.DeleteAction):
verbose_name = _("Archive Audits")
policy_rules = (("infra-optim", "audit:delete"),)
def allowed(self, request, audit):
return audit or audit.state not in ("ONGOING", "PENDING")
@staticmethod
def action_present(count):
return ungettext_lazy(
@ -139,7 +142,6 @@ class AuditsTable(horizon.tables.DataTable):
launch_actions = (CreateAudit,)
table_actions = launch_actions + (
AuditsFilterAction,
ArchiveAudits,
)
row_actions = (
GoToActionPlan,