From f99a0a8474dc9a7bc4c04abd3a950f9f90efc642 Mon Sep 17 00:00:00 2001 From: Jai Bhagat Date: Wed, 14 Jul 2021 16:27:24 -0400 Subject: [PATCH] refactoring for same regression in job versions In job versions, if you have an ACL token with a write policy you should be able to revert a job, however, that was not the case here. This is because we're using ember-can to check if the user can run a job. That permission relies on policiesSupportRunning which uses a function called namespaceIncludesCapability. We're going to need to refactor any cases that use this function. --- ui/app/routes/jobs/job/versions.js | 2 -- ui/app/templates/components/job-version.hbs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/app/routes/jobs/job/versions.js b/ui/app/routes/jobs/job/versions.js index 2923c321c77b..fc2508e57b83 100644 --- a/ui/app/routes/jobs/job/versions.js +++ b/ui/app/routes/jobs/job/versions.js @@ -2,7 +2,6 @@ import Route from '@ember/routing/route'; import { collect } from '@ember/object/computed'; import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch'; import WithWatchers from 'nomad-ui/mixins/with-watchers'; - export default class VersionsRoute extends Route.extend(WithWatchers) { model() { const job = this.modelFor('jobs.job'); @@ -18,6 +17,5 @@ export default class VersionsRoute extends Route.extend(WithWatchers) { @watchRecord('job') watch; @watchRelationship('versions') watchVersions; - @collect('watch', 'watchVersions') watchers; } diff --git a/ui/app/templates/components/job-version.hbs b/ui/app/templates/components/job-version.hbs index fc219e964cda..a7076d75f905 100644 --- a/ui/app/templates/components/job-version.hbs +++ b/ui/app/templates/components/job-version.hbs @@ -10,7 +10,7 @@
{{#unless this.isCurrent}} - {{#if (can "run job")}} + {{#if (can "run job" namespace=this.version.job.namespace)}}