Merge "Fix sql injection vulnerability"
[portal.git] / ecomp-portal-FE-os / client / src / views / applications / applications.controller.js
index d1c2b09..0bcc1eb 100644 (file)
@@ -1,29 +1,48 @@
 /*-
- * ================================================================================
- * eCOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
  * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ================================================================================
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * 
  */
 'use strict';
 (function () {
     class ApplicationsCtrl {
 
        constructor($log, $cookies, conf, ngDialog,
-                               applicationsService, confirmBoxService, userProfileService, utilsService,$modal) {
+                               applicationsService, confirmBoxService, userProfileService, utilsService,$modal,$scope) {
             this.emptyImgForPreview = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
+            $scope.isAdmin = false;
             let getOnboardingApps = () => {
                 this.isLoadingTable = true;
                 applicationsService.getOnboardingApps()
                                        appsList[i].imageLink = appsList[i].imageLink+'?' + new Date().getTime();
                                }
                        }
+                       if(appsList.length == 0)
+                               {
+                               confirmBoxService.showInformation('You do not have applications to edit').then(isConfirmed => {});
+                               }
                        this.appsList = appsList;
                     }).catch(err => {
                         confirmBoxService.showInformation('There was a problem retrieving the Applications. ' +
                     });
             };
 
+            let checkIfUserIsSuperAdmin = () => {
+               applicationsService.checkIfUserIsSuperAdmin().then(res => {   
+                       if(res) {
+                               $scope.isAdmin = true;
+                               }
+                        }).catch(err => {
+                            $log.error('ApplicationsCtrl.checkIfUserIsSuperAdmin:: Failed - ' + err);
+                        }).finally(()=> {
+                            this.isSaving = false;
+                        });
+              };
+                 
             let init = () => {
                 this.isLoadingTable = false;
+                checkIfUserIsSuperAdmin();
                 getOnboardingApps();
                 this.searchString = '';
                 this.appsTableHeaders = [
                     templateUrl: 'app/views/applications/application-details-dialog/application-details.modal.html',
                     controller: 'AppDetailsModalCtrl as appDetails',
                     sizeClass: 'modal-large', 
+                       windowClass:"modal-docked",
                     resolve: {
                                        items: function () {
                                  return data;
         }
     }
     ApplicationsCtrl.$inject = ['$log', '$cookies', 'conf', 'ngDialog',
-                               'applicationsService', 'confirmBoxService', 'userProfileService', 'utilsService','$modal'];
+                               'applicationsService', 'confirmBoxService', 'userProfileService', 'utilsService','$modal', '$scope'];
     angular.module('ecompApp').controller('ApplicationsCtrl', ApplicationsCtrl);
 })();