From 3f2447d831c9a056f2b167ef9e5e6ba5f63a5fec Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 9 Sep 2016 16:54:46 -0400 Subject: [PATCH] Make the frontend agnostic to why a trigger can be run manually --- endpoints/api/build.py | 2 +- static/directives/dockerfile-build-dialog.html | 4 ++-- static/directives/repo-view/repo-panel-builds.html | 2 +- static/js/directives/repo-view/repo-panel-builds.js | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/endpoints/api/build.py b/endpoints/api/build.py index 75be9ffcc..665701f52 100644 --- a/endpoints/api/build.py +++ b/endpoints/api/build.py @@ -76,7 +76,7 @@ def trigger_view(trigger, can_read=False, can_admin=False, for_build=False): 'repository_url': repo_url if can_read else None, 'config': build_trigger.config if can_admin else {}, - 'is_connected_user': is_connected_user, + 'can_invoke': is_connected_user, } if not for_build and can_admin and trigger.pull_robot: diff --git a/static/directives/dockerfile-build-dialog.html b/static/directives/dockerfile-build-dialog.html index 6ec834cfd..6a8396f55 100644 --- a/static/directives/dockerfile-build-dialog.html +++ b/static/directives/dockerfile-build-dialog.html @@ -40,8 +40,8 @@ - - You cannot start triggers created by another user + + You do not have permission to run this trigger diff --git a/static/directives/repo-view/repo-panel-builds.html b/static/directives/repo-view/repo-panel-builds.html index 6ae3e68d7..6dbc8876d 100644 --- a/static/directives/repo-view/repo-panel-builds.html +++ b/static/directives/repo-view/repo-panel-builds.html @@ -147,7 +147,7 @@ View Credentials + ng-class="trigger.can_invoke ? '' : 'disabled'"> Run Trigger Now diff --git a/static/js/directives/repo-view/repo-panel-builds.js b/static/js/directives/repo-view/repo-panel-builds.js index e403e177a..9bc017631 100644 --- a/static/js/directives/repo-view/repo-panel-builds.js +++ b/static/js/directives/repo-view/repo-panel-builds.js @@ -199,9 +199,8 @@ angular.module('quay').directive('repoPanelBuilds', function () { }; $scope.askRunTrigger = function(trigger) { - if (!trigger.is_connected_user) { - bootbox.alert('For security reasons, only the user that created this trigger can ' + - 'manually invoke this trigger'); + if (!trigger.can_invoke) { + bootbox.alert('You do not have permission to manually invoke this trigger'); return; }