X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-FE-common%2Fclient%2Fapp%2Fservices%2Fapplications%2Fapplications.service.js;h=e2e7c5fea1df4655e9e2bb13cd7828046f6e4fa8;hb=3f56b9fdb4d2ec891344d6c9048363e1cac587d2;hp=9d90fbacf2458dc2517cf14c95e6709d52f33b14;hpb=21a8761f684745bb300e075c7e98ad897ace9eed;p=portal.git diff --git a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js index 9d90fbac..e2e7c5fe 100644 --- a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js +++ b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js @@ -33,7 +33,7 @@ * * ============LICENSE_END============================================ * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ 'use strict'; @@ -154,7 +154,31 @@ return deferred.promise; } - + checkIfUserIsSuperAdmin() { + let deferred = this.$q.defer(); + var _this0 = this; + // this.$log.info('ApplicationsService::getPersUserApps'); + this.$http.get(this.conf.api.checkIfUserIsSuperAdmin, + { + cache: false, + headers: { + 'X-ECOMP-RequestID':this.uuid.generate() + } + }) + .then( res => { + // If response comes back as a redirected HTML page which IS NOT a success + // But don't declare an empty list to be an error. + if (res == null || res.data == null) { + deferred.reject("ApplicationsService::checkIfUserIsSuperAdmin Failed"); + } else { + deferred.resolve(res.data); + } + }) + .catch( status => { + deferred.reject(status); + }); + return deferred.promise; + } saveAppsSortTypeManual(appsSortManual){ let deferred = this.$q.defer(); if (appsSortManual== undefined @@ -639,8 +663,8 @@ }).then( res => { // If response comes back as a redirected HTML page which IS NOT a success // But don't declare an empty list to be an error. - if (res == null || res.data == null || _this13.utilsService.isValidJSON(res.data) == false) { - deferred.reject("ApplicationsService::syncRolesEcompFromExtAuthSystem Failed"); + if (res == null || res.data == null || _this13.utilsService.isValidJSON(res.data) == false || res.data.status == 'ERROR') { + deferred.reject("ApplicationsService::syncRolesEcompFromExtAuthSystem Failed" + res.data.message); } else { deferred.resolve(res); }