Merge "Fix sql injection vulnerability"
[portal.git] / ecomp-portal-FE-common / client / app / views / role / rolefunctionpopupController.js
index 0fa84f3..5cfb6c5 100644 (file)
@@ -33,7 +33,7 @@
  *
  * ============LICENSE_END============================================
  *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * 
  */
 app.controller('rolefunctionpopupController',function($scope, confirmBoxService, message, $http, $modalInstance, RoleService, conf, isEditing) {
        if (message.availableRoleFunction == null) {
@@ -98,10 +98,10 @@ app.controller('rolefunctionpopupController',function($scope, confirmBoxService,
                        confirmBoxService.showInformation('Instance can only contain alphanumeric characters, hyphens(-), dots(.), colons(:), forwardSlash(/) , asterisk(*) and underscores(_)').then(isConfirmed => {});
                        return;
                }
-               if(/[^a-zA-Z0-9\-\_ \.]/.test(availableRoleFunction.name)){
+/*             if(/[^a-zA-Z0-9\-\_ \.]/.test(availableRoleFunction.name)){
                        confirmBoxService.showInformation('Name can only contain alphanumeric characters, spaces, hyphens(-), dots(.) and underscores(_)').then(isConfirmed => {});
                        return;
-               }
+               }*/
                confirmBoxService.confirm(
                                "You are about to Create the role function "+ availableRoleFunction.name+ ". Do you want to continue?")
                                .then(function(confirmed) {
@@ -124,8 +124,11 @@ app.controller('rolefunctionpopupController',function($scope, confirmBoxService,
                                                                break;
                                                        }
                                                        if (!isEditing) {
-                                                               if (message.availableRoleFunctions[x].code == availableRoleFunction.code) {
-                                                                       confirmBoxService.showInformation("Code already exists. Please create a role function with a different code to proceed.");
+                                                               if (message.availableRoleFunctions[x].type == availableRoleFunction.type
+                                                                               && message.availableRoleFunctions[x].code == availableRoleFunction.code
+                                                                               && message.availableRoleFunctions[x].action == availableRoleFunction.action
+                                                                       ) {
+                                                                       confirmBoxService.showInformation("Please make sure code, type and action is unique. Please create a role function with a different code or type or action to proceed.");
                                                                        exists = true;
                                                                        availableRoleFunction.name = $scope.tempText;
                                                                        break;