From 7bb53c64da2dcf88894bfd31503accdd81498f3d Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Wed, 3 Jun 2020 10:06:52 +0200 Subject: Update to new version 5.4 Signed-off-by: Thomas Duval Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea --- .../parameter/perimeter/perimeter-edit.tpl.html | 166 -------- .../parameter/perimeter/perimeter-list.tpl.html | 240 ----------- .../edit/parameter/perimeter/perimeter.edit.dir.js | 437 --------------------- .../edit/parameter/perimeter/perimeter.list.dir.js | 284 ------------- 4 files changed, 1127 deletions(-) delete mode 100755 moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-edit.tpl.html delete mode 100755 moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-list.tpl.html delete mode 100755 moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.edit.dir.js delete mode 100755 moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.list.dir.js (limited to 'moon_gui/static/app/policy/edit/parameter/perimeter') diff --git a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-edit.tpl.html b/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-edit.tpl.html deleted file mode 100755 index fa2f93c0..00000000 --- a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-edit.tpl.html +++ /dev/null @@ -1,166 +0,0 @@ -
- - - -
- -
- -
- - - - - -
-
- -
- -
- - - - - -
- -
- -
- - - -
- - - -
- Name is required -
- -
- -
- -
- - -
- -
- -
- - - - -
- - - -
- -
- -
- - -
- - - -
- - - - - -
-
- -
- -
- -
- -
- -
- -
- - - -
- -
    - -
  • - - - -
  • - -
- -
- -
- -
- -
- - - - Create - - - - -
- -
- -
- -
- -
\ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-list.tpl.html b/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-list.tpl.html deleted file mode 100755 index a94d663e..00000000 --- a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter-list.tpl.html +++ /dev/null @@ -1,240 +0,0 @@ -
-
- -
- -

List of associated Subjects

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionEmail
- - - - Unmap - - -
- - - -
- -
There is no Subjects
- -
- -
- -
- -
- -
- -

Add a Subject Category

- -
- -
- - - -
- -
- - -
- -
- -

List associated of Objects

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
- - - - Unmap - - -
- - - -
- -
There is no Objects
- -
- -
- -
- -
- -
- -

Add an Object Category

- -
- -
- - - -
- -
- -
- -
- -

List associated of Actions

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
- - - - Unmap - - -
- - - -
- -
There is no Actions
- -
- - -
- -
- -
- -
- -

Add an Action Category

- -
- -
. - - - -
- -
- -
\ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.edit.dir.js b/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.edit.dir.js deleted file mode 100755 index d72e23b7..00000000 --- a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.edit.dir.js +++ /dev/null @@ -1,437 +0,0 @@ -(function () { - - 'use strict'; - - angular - .module('moon') - .directive('moonPerimeterEdit', moonPerimeterEdit); - - moonPerimeterEdit.$inject = []; - - function moonPerimeterEdit() { - - return { - templateUrl: 'html/policy/edit/parameter/perimeter/perimeter-edit.tpl.html', - bindToController: true, - controller: moonPerimeterEditController, - controllerAs: 'edit', - scope: { - //Type can be 'ACTION', 'OBJECT', 'SUBJECT' - perimeterType: '=', - policy: '=' - }, - restrict: 'E', - replace: true - }; - } - - - angular - .module('moon') - .controller('moonPerimeterEditController', moonPerimeterEditController); - - moonPerimeterEditController.$inject = ['$scope', '$rootScope', - 'perimeterService', 'PERIMETER_CST', 'alertService', - '$translate', 'formService', 'policyService', 'utilService']; - - function moonPerimeterEditController($scope, $rootScope, - perimeterService, PERIMETER_CST, alertService, - $translate, formService, policyService, utilService) { - - var edit = this; - - edit.perimeterType = $scope.edit.perimeterType; - // This variable is used in the view in order to display or not display email field - edit.subjectType = PERIMETER_CST.TYPE.SUBJECT; - edit.policy = $scope.edit.policy; - - edit.fromList = true; - - edit.loading = false; - - edit.form = {}; - - edit.perimeter = {name: null, description: null, partner_id: null, policy_list: [], email: null}; - - edit.list = []; - edit.policyList = []; - edit.policiesToBeSelected = []; - edit.selectedPolicyList = []; // List of Policies to be added to a new perimeter - - edit.create = createPerimeter; - edit.addToPolicy = addToPolicy; - edit.addPolicyToPerimeter = addPolicyToPerimeter; - edit.clearSelectedPolicies = clearSelectedPolicies; - edit.removeSelectedPolicy = removeSelectedPolicy; - edit.deletePerimeter = deletePerimeter; - - activate(); - - /* - * - */ - - function activate() { - - loadAllPolicies(); - - switch (edit.perimeterType) { - - case PERIMETER_CST.TYPE.SUBJECT: - - perimeterService.subject.findAllWithCallback(callBackList); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - perimeterService.object.findAllWithCallback(callBackList); - break; - - case PERIMETER_CST.TYPE.ACTION: - - perimeterService.action.findAllWithCallback(callBackList); - break; - - default : - - edit.list = []; - break; - - } - - function callBackList(list) { - - // For each Perimeter, there is a check about the mapping between the perimeter and the policy - _.each(list, function (element) { - - if (_.indexOf(element.policy_list, edit.policy.id) === -1) { - - edit.list.push(element); - - } - - }); - - } - - } - - var rootListeners = { - - 'event:unMapPerimeterFromPerimeterList': $rootScope.$on('event:unMapPerimeterFromPerimeterList', manageUnMappedPerimeter) - - }; - - _.each(rootListeners, function(unbind){ - $scope.$on('$destroy', rootListeners[unbind]); - }); - - - function loadAllPolicies() { - - edit.policyList = []; - - policyService.findAllWithCallback( function(data) { - - edit.policyList = data; - edit.policiesToBeSelected = angular.copy(edit.policyList); - - }); - } - - function addPolicyToPerimeter() { - - if (!edit.selectedPolicy || _.contains(edit.perimeter.policy_list, edit.selectedPolicy.id)) { - return; - } - - edit.perimeter.policy_list.push(edit.selectedPolicy.id); - edit.selectedPolicyList.push(edit.selectedPolicy); - edit.policiesToBeSelected = _.without(edit.policiesToBeSelected, edit.selectedPolicy); - - } - - function clearSelectedPolicies() { - - edit.perimeter.policy_list = []; - edit.selectedPolicyList = []; - edit.policiesToBeSelected = angular.copy(edit.policyList); - - } - - function removeSelectedPolicy(policy) { - - edit.policiesToBeSelected.push(policy); - edit.perimeter.policy_list = _.without(edit.perimeter.policy_list, policy.id); - edit.selectedPolicyList = _.without(edit.selectedPolicyList, policy); - - } - - /** - * Add - */ - - function addToPolicy() { - - if (!edit.selectedPerimeter) { - - return; - - } - - startLoading(); - - var perimeterToSend = edit.selectedPerimeter; - - perimeterToSend.policy_list.push(edit.policy.id); - - switch (edit.perimeterType) { - - case PERIMETER_CST.TYPE.SUBJECT: - - perimeterService.subject.update(perimeterToSend, updatePerimeterSuccess, updatePerimeterError); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - perimeterService.object.update(perimeterToSend, updatePerimeterSuccess, updatePerimeterError); - break; - - case PERIMETER_CST.TYPE.ACTION: - - perimeterService.action.update(perimeterToSend, updatePerimeterSuccess, updatePerimeterError); - break; - } - - - function updatePerimeterSuccess(data) { - - $translate('moon.perimeter.update.success', {policyName: perimeterToSend.name}).then(function (translatedValue) { - - alertService.alertSuccess(translatedValue); - - }); - - stopLoading(); - - } - - function updatePerimeterError(reason) { - - $translate('moon.policy.update.error', { - policyName: perimeterToSend.name, - reason: reason.message - }).then(function (translatedValue) { - - alertService.alertError(translatedValue); - - }); - - stopLoading(); - - } - - } - - /** - * Create - */ - - function createPerimeter() { - - if (formService.isInvalid(edit.form)) { - - formService.checkFieldsValidity(edit.form); - - } else { - - startLoading(); - - var perimeterToSend = angular.copy(edit.perimeter); - - switch (edit.perimeterType) { - - case PERIMETER_CST.TYPE.SUBJECT: - - perimeterService.subject.add(perimeterToSend, createSuccess, createError); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - perimeterService.object.add(perimeterToSend, createSuccess, createError); - break; - - case PERIMETER_CST.TYPE.ACTION: - - perimeterService.action.add(perimeterToSend, createSuccess, createError); - break; - } - - } - - function createSuccess(data) { - - var created = {}; - - switch (edit.perimeterType) { - - case PERIMETER_CST.TYPE.SUBJECT: - - created = utilService.transformOne(data, 'subjects'); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - created = utilService.transformOne(data, 'objects'); - break; - - case PERIMETER_CST.TYPE.ACTION: - - created = utilService.transformOne(data, 'actions'); - break; - } - - $translate('moon.policy.perimeter.edit.create.success', {name: created.name}).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - stopLoading(); - - /** - * If during the creating the created assignments has be mapped with the current policy, then it is not required to push the new Assignments in the list - */ - if (_.indexOf(created.policy_list, edit.policy.id) === -1) { - - edit.list.push(created); - - }else{ - - $scope.$emit('event:createAssignmentsFromAssignmentsEditSuccess', created, edit.perimeterType); - - } - - displayList(); - - clearSelectedPolicies(); - - } - - function createError(reason) { - - $translate('moon.policy.perimeter.edit.create.error', {name: perimeterToSend.name}).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - stopLoading(); - - } - - } - - /** - * Delete - */ - function deletePerimeter() { - - if (!edit.selectedPerimeter) { - - return; - - } - - startLoading(); - - var perimeterToDelete = angular.copy(edit.selectedPerimeter); - - switch (edit.perimeterType) { - case PERIMETER_CST.TYPE.SUBJECT: - - perimeterService.subject.delete(perimeterToDelete, deleteSuccess, deleteError); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - perimeterService.object.delete(perimeterToDelete, deleteSuccess, deleteError); - break; - - case PERIMETER_CST.TYPE.ACTION: - - perimeterService.action.delete(perimeterToDelete, deleteSuccess, deleteError); - break; - } - - - function deleteSuccess(data) { - - $translate('moon.policy.perimeter.edit.delete.success', {name: perimeterToDelete.name}) - .then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - policyService.findOneReturningPromise(edit.policy.id).then(function (data) { - - edit.policy = utilService.transformOne(data, 'policies'); - - cleanSelectedValue(); - activate(); - stopLoading(); - - $scope.$emit('event:deletePerimeterFromPerimeterAddSuccess', edit.policy); - - }); - - } - - function deleteError(reason) { - - $translate('moon.policy.perimeter.edit.delete.error', {name: perimeterToDelete.name}).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - stopLoading(); - - } - } - - function cleanSelectedValue() { - edit.list = _.without(edit.list, edit.selectedPerimeter); - delete edit.selectedPerimeter; - - } - - function startLoading() { - - edit.loading = true; - - } - - function stopLoading() { - - edit.loading = false; - - } - - function displayList() { - - edit.fromList = true; - - } - - /** - * If A perimeter has been unMapped, maybe it has to be display into the available list of Perimeter - * @param perimeter - * @param type - */ - function manageUnMappedPerimeter(event, perimeter, type){ - - if(type === edit.perimeterType && _.indexOf(perimeter.policy_list, edit.policy.id) === -1){ - - edit.list.push(perimeter); - - } - - } - - } - -})(); \ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.list.dir.js b/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.list.dir.js deleted file mode 100755 index dffa7783..00000000 --- a/moon_gui/static/app/policy/edit/parameter/perimeter/perimeter.list.dir.js +++ /dev/null @@ -1,284 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonPerimeterList', moonPerimeterList); - - moonPerimeterList.$inject = []; - - function moonPerimeterList() { - - return { - templateUrl : 'html/policy/edit/parameter/perimeter/perimeter-list.tpl.html', - bindToController : true, - controller : moonPerimeterListController, - controllerAs : 'list', - scope : { - policy: '=', - editMode : '=' - }, - restrict : 'E', - replace : true - }; - - } - - angular - .module('moon') - .controller('moonPerimeterListController', moonPerimeterListController); - - moonPerimeterListController.$inject = ['$scope', '$rootScope', 'perimeterService', '$translate', 'alertService', 'PERIMETER_CST']; - - function moonPerimeterListController($scope, $rootScope, perimeterService, $translate, alertService, PERIMETER_CST){ - - var list = this; - - list.policy = $scope.list.policy; - list.editMode = $scope.list.editMode; - - list.typeOfSubject = PERIMETER_CST.TYPE.SUBJECT; - list.typeOfObject = PERIMETER_CST.TYPE.OBJECT; - list.typeOfAction = PERIMETER_CST.TYPE.ACTION; - - list.unMapSub = unMapSub; - list.unMapObj = unMapObj; - list.unMapAct = unMapAct; - - list.getSubjects = getSubjects; - list.getObjects = getObjects; - list.getActions = getActions; - - activate(); - - function activate(){ - - manageSubjects(); - - manageObjects(); - - manageActions(); - - } - - var rootListeners = { - - 'event:deletePerimeterFromPerimeterAddSuccess': $rootScope.$on('event:deletePerimeterFromPerimeterAddSuccess', deletePolicy), - 'event:createAssignmentsFromAssignmentsEditSuccess': $rootScope.$on('event:createAssignmentsFromAssignmentsEditSuccess', addAssignmentsToPolicy) - - }; - - _.each(rootListeners, function(unbind){ - $scope.$on('$destroy', rootListeners[unbind]); - }); - - - function manageSubjects(){ - - list.loadingSub = true; - - perimeterService.subject.findAllFromPolicyWithCallback(list.policy.id, function(perimeters){ - - list.subjects = perimeters; - list.loadingSub = false; - - }); - } - - function manageObjects(){ - - list.loadingObj = true; - - perimeterService.object.findAllFromPolicyWithCallback(list.policy.id, function(perimeters){ - - list.objects = perimeters; - list.loadingObj = false; - - }); - - } - - function manageActions(){ - - list.loadingAct = true; - - perimeterService.action.findAllFromPolicyWithCallback(list.policy.id, function(perimeters){ - - list.actions = perimeters; - list.loadingAct = false; - - }); - - } - - /** - * UnMap - */ - - function unMapSub(perimeter){ - - perimeter.policy_list = _.without(perimeter.policy_list, list.policy.id); - - perimeter.loader = true; - - var perimeterToSend = angular.copy(perimeter); - - perimeterService.subject.unMapPerimeterFromPolicy(list.policy.id , perimeter.id, updatePerimeterSuccess, updatePerimeterError); - - function updatePerimeterSuccess(data){ - - $translate('moon.policy.perimeter.update.success', { perimeterName: perimeterToSend.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - $scope.$emit('event:unMapPerimeterFromPerimeterList', perimeter, PERIMETER_CST.TYPE.SUBJECT); - - activate(); - - perimeter.loader = false; - } - - function updatePerimeterError(reason){ - - $translate('moon.policy.perimeter.update.error', { perimeterName: perimeter.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - perimeter.loader = false; - - } - - } - - function unMapObj(perimeter){ - - perimeter.policy_list = _.without(perimeter.policy_list, list.policy.id); - - perimeter.loader = true; - - var perimeterToSend = angular.copy(perimeter); - - perimeterService.object.unMapPerimeterFromPolicy(list.policy.id , perimeter.id, updatePerimeterSuccess, updatePerimeterError); - - function updatePerimeterSuccess(data){ - - $translate('moon.policy.perimeter.update.success', { perimeterName: perimeterToSend.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - $scope.$emit('event:unMapPerimeterFromPerimeterList', perimeter, PERIMETER_CST.TYPE.OBJECT); - - activate(); - - perimeter.loader = false; - } - - function updatePerimeterError(reason){ - - $translate('moon.policy.perimeter.update.error', { perimeterName: perimeter.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - perimeter.loader = false; - - } - - } - - function unMapAct(perimeter){ - - perimeter.policy_list = _.without(perimeter.policy_list, list.policy.id); - - perimeter.loader = true; - - var perimeterToSend = angular.copy(perimeter); - - perimeterService.action.unMapPerimeterFromPolicy(list.policy.id , perimeter.id, updatePerimeterSuccess, updatePerimeterError); - - function updatePerimeterSuccess(data){ - - $translate('moon.policy.perimeter.update.success', { perimeterName: perimeterToSend.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - $scope.$emit('event:unMapPerimeterFromPerimeterList', perimeter, PERIMETER_CST.TYPE.ACTION); - - activate(); - - perimeter.loader = false; - } - - function updatePerimeterError(reason){ - - $translate('moon.policy.perimeter.update.error', { perimeterName: perimeter.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - perimeter.loader = false; - - } - - } - - function getSubjects(){ - return list.subjects ? list.subjects : []; - } - - function getObjects(){ - return list.objects ? list.objects : []; - } - - function getActions(){ - return list.actions ? list.actions : []; - } - - function removeSubFromSubList(subject){ - list.subjects = _.without(list.subjects, subject); - } - - function removeObjFromObjList(object){ - list.objects = _.without(list.objects, object); - } - - function removeActFromActList(action){ - list.actions = _.without(list.actions, action); - } - - function deletePolicy( event, policy){ - - list.policy = policy; - - activate(); - - } - - function addAssignmentsToPolicy( event, assignments, type){ - - switch (type) { - - case PERIMETER_CST.TYPE.SUBJECT: - - list.subjects.push(assignments); - break; - - case PERIMETER_CST.TYPE.OBJECT: - - list.objects.push(assignments); - break; - - case PERIMETER_CST.TYPE.ACTION: - - list.actions.push(assignments); - break; - - default : - break; - - } - - } - - } - -})(); \ No newline at end of file -- cgit 1.2.3-korg