diff --git a/src/js/client.js b/src/js/client.js index 5416c602f..52a831372 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1468,6 +1468,15 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; + Client.prototype.getAppTask = function (appId, callback) { + get('/api/v1/apps/' + appId + '/task', null, function (error, data, status) { + if (error) return callback(error); + if (status !== 200) return callback(new ClientError(status, data)); + + callback(null, data); + }); + }; + Client.prototype.getAppWithTask = function (appId, callback) { var that = this; @@ -1476,7 +1485,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout if (!app.taskId) return callback(null, app); - that.getTask(app.taskId, function (error, task) { + that.getAppTask(appId, function (error, task) { if (error) return callback(error); if (task) { @@ -2058,8 +2067,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout async.eachLimit(apps, 20, function (app, iteratorCallback) { app.ssoAuth = (app.manifest.addons['ldap'] || app.manifest.addons['proxyAuth']) && app.sso; - // only fetch if we have permissions - if (!that._userInfo.isAtLeastAdmin) { + if (app.accessLevel !== 'operator' && app.accessLevel !== 'admin') { // only fetch if we have permissions app.progress = 0; app.message = ''; app.taskMinutesActive = 0; @@ -2069,7 +2077,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout return iteratorCallback(); } - var getTaskFunc = app.taskId ? that.getTask.bind(null, app.taskId) : function (next) { return next(); }; + var getTaskFunc = app.taskId ? that.getAppTask.bind(null, app.id) : function (next) { return next(); }; getTaskFunc(function (error, task) { if (error) return iteratorCallback(error);