From 9693bfc2aaebe27c6bc58a705b894bbec8a5a3a8 Mon Sep 17 00:00:00 2001 From: Dmitry Salakhov Date: Fri, 13 Aug 2021 09:35:26 +1200 Subject: [PATCH] fix(stacks): allow pull and redeploy to non-admins [EE-1329] (#5415) --- api/http/handler/stacks/stack_update_git_redeploy.go | 4 ---- app/portainer/rest/stack.js | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/http/handler/stacks/stack_update_git_redeploy.go b/api/http/handler/stacks/stack_update_git_redeploy.go index 250c67e61..c338757e0 100644 --- a/api/http/handler/stacks/stack_update_git_redeploy.go +++ b/api/http/handler/stacks/stack_update_git_redeploy.go @@ -1,7 +1,6 @@ package stacks import ( - "errors" "fmt" "log" "net/http" @@ -32,9 +31,6 @@ func (payload *stackGitRedployPayload) Validate(r *http.Request) error { payload.RepositoryReferenceName = defaultGitReferenceName } - if payload.RepositoryAuthentication && govalidator.IsNull(payload.RepositoryPassword) { - return errors.New("invalid repository credentials. Username and password must be specified when authentication is enabled") - } return nil } diff --git a/app/portainer/rest/stack.js b/app/portainer/rest/stack.js index 58f10fe47..d41bdf04a 100644 --- a/app/portainer/rest/stack.js +++ b/app/portainer/rest/stack.js @@ -5,7 +5,7 @@ angular.module('portainer.app').factory('Stack', [ function StackFactory($resource, EndpointProvider, API_ENDPOINT_STACKS) { 'use strict'; return $resource( - API_ENDPOINT_STACKS + '/:id/:action', + API_ENDPOINT_STACKS + '/:id/:action/:subaction', {}, { get: { method: 'GET', params: { id: '@id' } }, @@ -18,7 +18,7 @@ angular.module('portainer.app').factory('Stack', [ migrate: { method: 'POST', params: { id: '@id', action: 'migrate', endpointId: '@endpointId' }, ignoreLoadingBar: true }, start: { method: 'POST', params: { id: '@id', action: 'start' } }, stop: { method: 'POST', params: { id: '@id', action: 'stop' } }, - updateGit: { method: 'PUT', params: { id: '@id', action: 'git/redeploy' } }, + updateGit: { method: 'PUT', params: { id: '@id', action: 'git', subaction: 'redeploy' } }, updateGitStackSettings: { method: 'POST', params: { id: '@id', action: 'git' }, ignoreLoadingBar: true }, } );