aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/moon_gui/static/app/services
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2017-06-09 16:18:59 +0200
committerasteroide <thomas.duval@orange.com>2017-06-09 16:18:59 +0200
commit60bb98696ee93f979914d8e88ed4708f59fcff9c (patch)
treea404880ec261f95c69fa4a6a1edd50ef9a66d160 /moonv4/moon_gui/static/app/services
parent8039214d0caedfec5456bd8ee0898a1b9a55629a (diff)
Stable version
Change-Id: I70001bedbdf1823cb9e8dccd545800387777201b
Diffstat (limited to 'moonv4/moon_gui/static/app/services')
-rw-r--r--moonv4/moon_gui/static/app/services/gui/form.service.js4
-rw-r--r--moonv4/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js53
-rw-r--r--moonv4/moon_gui/static/app/services/moon/policy/parameters/data.service.js85
-rw-r--r--moonv4/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js57
-rw-r--r--moonv4/moon_gui/static/app/services/moon/policy/policy.service.js2
-rw-r--r--moonv4/moon_gui/static/app/services/moon/rule/metadata.service.js14
-rw-r--r--moonv4/moon_gui/static/app/services/moon/rule/metarule.service.js4
7 files changed, 175 insertions, 44 deletions
diff --git a/moonv4/moon_gui/static/app/services/gui/form.service.js b/moonv4/moon_gui/static/app/services/gui/form.service.js
index bc137943..e436593c 100644
--- a/moonv4/moon_gui/static/app/services/gui/form.service.js
+++ b/moonv4/moon_gui/static/app/services/gui/form.service.js
@@ -41,7 +41,7 @@
});
}
-
+
}
-
+
})();
diff --git a/moonv4/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js b/moonv4/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js
index ad7d8e8b..ca138b45 100644
--- a/moonv4/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js
@@ -8,17 +8,17 @@
angular
.module('moon')
- .factory('assignmentService', assignmentService);
+ .factory('assignmentsService', assignmentsService);
- assignmentService.$inject = ['$resource', 'REST_URI', 'utilService'];
+ assignmentsService.$inject = ['$resource', 'REST_URI', 'utilService'];
- function assignmentService($resource, REST_URI, utilService) {
+ function assignmentsService($resource, REST_URI, utilService) {
var data = {
subject: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/subject_assignments/:subject_id', {}, {
+ policy: $resource(REST_URI.POLICIES + ':policy_id/subject_assignments/:perimeter_id/:category_id/:data_id', {}, {
get: {method: 'GET'},
create: {method: 'POST'},
remove: {method: 'DELETE'}
@@ -29,8 +29,8 @@
object: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/object_assignments/:object_id', {}, {
- get: {method: 'GET', isArray: false},
+ policy: $resource(REST_URI.POLICIES + ':policy_id/object_assignments/:perimeter_id/:category_id/:data_id', {}, {
+ get: {method: 'GET'},
create: {method: 'POST'},
remove: {method: 'DELETE'}
})
@@ -39,8 +39,8 @@
action: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/action_assignments/:action_id', {}, {
- get: {method: 'GET', isArray: false},
+ policy: $resource(REST_URI.POLICIES + ':policy_id/action_assignments/:perimeter_id/:category_id/:data_id', {}, {
+ get: {method: 'GET'},
create: {method: 'POST'},
remove: {method: 'DELETE'}
})
@@ -53,6 +53,18 @@
subject : {
+ delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) {
+
+ data.subject.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError);
+
+ },
+
+ add:function (subject, policyId, callbackSuccess, callbackError ) {
+
+ data.subject.policy.create({policy_id: policyId}, subject, callbackSuccess, callbackError);
+
+ },
+
findAllFromPolicyWithCallback: function(policyId, callback){
data.subject.policy.get({policy_id: policyId}).$promise.then(function(data) {
@@ -66,6 +78,19 @@
object : {
+
+ delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) {
+
+ data.object.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError);
+
+ },
+
+ add:function (object, policyId, callbackSuccess, callbackError ) {
+
+ data.object.policy.create({policy_id: policyId}, object, callbackSuccess, callbackError);
+
+ },
+
findAllFromPolicyWithCallback: function(policyId, callback){
data.object.policy.get({policy_id: policyId}).$promise.then(function(data) {
@@ -79,6 +104,18 @@
action : {
+ delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) {
+
+ data.action.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError);
+
+ },
+
+ add:function (action, policyId, callbackSuccess, callbackError ) {
+
+ data.action.policy.create({policy_id: policyId}, action, callbackSuccess, callbackError);
+
+ },
+
findAllFromPolicyWithCallback: function(policyId, callback){
data.action.policy.get({policy_id: policyId}).$promise.then(function(data) {
diff --git a/moonv4/moon_gui/static/app/services/moon/policy/parameters/data.service.js b/moonv4/moon_gui/static/app/services/moon/policy/parameters/data.service.js
index 22f35e45..1bbd3b24 100644
--- a/moonv4/moon_gui/static/app/services/moon/policy/parameters/data.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/policy/parameters/data.service.js
@@ -18,7 +18,7 @@
subject: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/subject_data/:subject_id/:data_id', {}, {
+ policy: $resource(REST_URI.POLICIES + ':policy_id/subject_data/:subject_id/:category_id/:data_id', {}, {
get: {method: 'GET'},
create: {method: 'POST'},
remove: {method: 'DELETE'}
@@ -28,7 +28,7 @@
object: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/object_data/:object_id/:data_id', {}, {
+ policy: $resource(REST_URI.POLICIES + ':policy_id/object_data/:object_id/:category_id/:data_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
remove: {method: 'DELETE'}
@@ -38,7 +38,7 @@
action: {
- policy: $resource(REST_URI.POLICIES + ':policy_id/action_data/:action_id/:data_id', {}, {
+ policy: $resource(REST_URI.POLICIES + ':policy_id/action_data/:action_id/:category_id/:data_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
remove: {method: 'DELETE'}
@@ -62,15 +62,33 @@
},
- delete: function (subject, callbackSuccess, callbackError ) {
+ findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){
- data.subject.perimeter.remove({subject_id: subject.id}, subject, callbackSuccess, callbackError);
+ data.subject.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) {
+
+ if(data['subject_data'][0]) {
+
+ callback(utilService.transform(data['subject_data'][0], 'data'));
+
+ }else{
+
+ callback([])
+
+ }
+
+ });
},
- add: function (subject, callbackSuccess, callbackError ) {
+ delete: function (subject, policyId, categoryId, callbackSuccess, callbackError ) {
- data.subject.perimeter.create({}, subject, callbackSuccess, callbackError);
+ data.subject.policy.remove({policy_id: policyId, category_id: categoryId, data_id: subject.id}, subject, callbackSuccess, callbackError);
+
+ },
+
+ add: function (subject, policyId, categoryId, callbackSuccess, callbackError ) {
+
+ data.subject.policy.create({policy_id: policyId, category_id: categoryId}, subject, callbackSuccess, callbackError);
},
@@ -108,15 +126,33 @@
},
- delete: function (object, callbackSuccess, callbackError ) {
+ findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){
+
+ data.object.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) {
+
+ if(data['object_data'][0]) {
+
+ callback(utilService.transform(data['object_data'][0], 'data'));
+
+ }else{
+
+ callback([])
+
+ }
+
+ });
+
+ },
+
+ delete: function (object, policyId, categoryId, callbackSuccess, callbackError ) {
- data.object.perimeter.remove({object_id: object.id}, object, callbackSuccess, callbackError);
+ data.object.policy.remove({policy_id: policyId, category_id: categoryId, data_id: object.id}, object, callbackSuccess, callbackError);
},
- add:function (object, callbackSuccess, callbackError ) {
+ add:function (object, policyId, categoryId, callbackSuccess, callbackError ) {
- data.object.perimeter.create({}, object, callbackSuccess, callbackError);
+ data.object.policy.create({policy_id: policyId, category_id: categoryId}, object, callbackSuccess, callbackError);
},
@@ -126,7 +162,6 @@
data.object.policy.get({policy_id: policyId, object_id: objectId, data_id : dataId}).$promise.then(function(data) {
-
if(data['object_data'][0]){
callback(utilService.transformOne(data['object_data'][0], 'data'));
@@ -155,15 +190,33 @@
},
- delete: function (action, callbackSuccess, callbackError ) {
+ findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){
+
+ data.action.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) {
+
+ if(data['action_data'][0]) {
+
+ callback(utilService.transform(data['action_data'][0], 'data'));
+
+ }else{
+
+ callback([])
+
+ }
+
+ });
+
+ },
+
+ delete: function (action, policyId, categoryId, callbackSuccess, callbackError ) {
- data.action.perimeter.remove({action_id: action.id}, action, callbackSuccess, callbackError);
+ data.action.policy.remove({policy_id: policyId, category_id: categoryId, data_id: action.id}, action, callbackSuccess, callbackError);
},
- add:function (action, callbackSuccess, callbackError ) {
+ add:function (action, policyId, categoryId, callbackSuccess, callbackError ) {
- data.action.perimeter.create({}, action, callbackSuccess, callbackError);
+ data.action.policy.create({policy_id: policyId, category_id: categoryId}, action, callbackSuccess, callbackError);
},
diff --git a/moonv4/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js b/moonv4/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js
index 6e929aba..42e7288a 100644
--- a/moonv4/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js
@@ -21,30 +21,33 @@
perimeter: $resource(REST_URI.PERIMETERS.subject + ':subject_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
}),
policy: $resource(REST_URI.POLICIES + ':policy_id/subjects/:subject_id', {}, {
get: {method: 'GET'},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
})
},
-
object: {
perimeter: $resource(REST_URI.PERIMETERS.object + ':object_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
}),
policy: $resource(REST_URI.POLICIES + ':policy_id/objects/:object_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
})
},
@@ -54,13 +57,15 @@
perimeter: $resource(REST_URI.PERIMETERS.action + ':action_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
}),
policy: $resource(REST_URI.POLICIES + ':policy_id/actions/:action_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
- remove: {method: 'DELETE'}
+ remove: {method: 'DELETE'},
+ update: { method: 'PATCH' }
})
}
@@ -113,6 +118,12 @@
},
+ unMapPerimeterFromPolicy: function(policyId, subjectId, callbackSuccess, callbackError ){
+
+ data.subject.policy.remove({policy_id: policyId, subject_id: subjectId}, {}, callbackSuccess, callbackError);
+
+ },
+
findAllFromPolicyWithCallback: function(policyId, callback){
data.subject.policy.get({policy_id: policyId}).$promise.then(function(data) {
@@ -162,6 +173,12 @@
data.subject.perimeter.create({}, subject, callbackSuccess, callbackError);
+ },
+
+ update: function(subject, callbackSuccess, callbackError){
+
+ data.subject.perimeter.update({subject_id: subject.id}, subject, callbackSuccess, callbackError);
+
}
},
@@ -173,7 +190,7 @@
callback(utilService.transformOne(data, 'objects'));
- })
+ });
},
@@ -210,6 +227,12 @@
},
+ unMapPerimeterFromPolicy: function(policyId, objectId, callbackSuccess, callbackError ){
+
+ data.object.policy.remove({policy_id: policyId, object_id: objectId}, {}, callbackSuccess, callbackError);
+
+ },
+
findSomeWithCallback: function(objectListId, callback){
var _self = this;
@@ -287,6 +310,12 @@
data.object.perimeter.create({}, object, callbackSuccess, callbackError);
+ },
+
+ update: function(object, callbackSuccess, callbackError){
+
+ data.object.perimeter.update({object_id: object.id}, object, callbackSuccess, callbackError);
+
}
},
@@ -334,6 +363,12 @@
},
+ unMapPerimeterFromPolicy: function(policyId, actionId, callbackSuccess, callbackError){
+
+ data.action.policy.remove({policy_id: policyId, action_id: actionId}, {}, callbackSuccess, callbackError);
+
+ },
+
findSomeWithCallback: function(actionListId, callback){
var _self = this;
@@ -410,6 +445,12 @@
data.action.perimeter.create({}, action, callbackSuccess, callbackError);
+ },
+
+ update: function(action, callbackSuccess, callbackError){
+
+ data.action.perimeter.update({action_id: action.id}, action, callbackSuccess, callbackError);
+
}
}
diff --git a/moonv4/moon_gui/static/app/services/moon/policy/policy.service.js b/moonv4/moon_gui/static/app/services/moon/policy/policy.service.js
index 5c8ad4f5..5ad31421 100644
--- a/moonv4/moon_gui/static/app/services/moon/policy/policy.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/policy/policy.service.js
@@ -82,7 +82,7 @@
findOne: function (policyId) {
- return this.data.policy.get({policy_id: policyId}).$promise.then(function (data) {
+ return this.data.policy.get({policy_id: policyId}).$promise.then(function (data) {
return utilService.transformOne(data, 'policies');
diff --git a/moonv4/moon_gui/static/app/services/moon/rule/metadata.service.js b/moonv4/moon_gui/static/app/services/moon/rule/metadata.service.js
index 659e0b30..8c68b2ef 100644
--- a/moonv4/moon_gui/static/app/services/moon/rule/metadata.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/rule/metadata.service.js
@@ -29,7 +29,7 @@
remove: {method: 'DELETE'}
}),
- action: $resource(REST_URI.METADATA.action + ':action_id', {}, {
+ action: $resource(REST_URI.METADATA.action + ':action_id', {}, {
get: {method: 'GET', isArray: false},
create: {method: 'POST'},
remove: {method: 'DELETE'}
@@ -194,9 +194,9 @@
callback([]);
}
- var promises = _(objectListId).map( function(subjectId) {
+ var promises = _(objectListId).map( function(objectId) {
- return _self.findOneReturningPromise(subjectId);
+ return _self.findOneReturningPromise(objectId);
});
@@ -249,7 +249,7 @@
findOne: function(actionId, callback){
- data.action.get({actionId: actionId}).$promise.then(function(data) {
+ data.action.get({action_id: actionId}).$promise.then(function(data) {
callback(utilService.transformOne(data, 'action_categories'));
@@ -259,7 +259,7 @@
findOneReturningPromise: function(actionId){
- return data.action.get({actionId: actionId}).$promise;
+ return data.action.get({action_id: actionId}).$promise;
},
@@ -297,9 +297,9 @@
callback([]);
}
- var promises = _(actionListId).map( function(subjectId) {
+ var promises = _(actionListId).map( function(actionId) {
- return _self.findOneReturningPromise(subjectId);
+ return _self.findOneReturningPromise(actionId);
});
diff --git a/moonv4/moon_gui/static/app/services/moon/rule/metarule.service.js b/moonv4/moon_gui/static/app/services/moon/rule/metarule.service.js
index 71a36c50..2679fc5b 100644
--- a/moonv4/moon_gui/static/app/services/moon/rule/metarule.service.js
+++ b/moonv4/moon_gui/static/app/services/moon/rule/metarule.service.js
@@ -115,7 +115,7 @@
return utilService.transformOne(data, 'meta_rules');
- })
+ });
},
@@ -141,7 +141,7 @@
return metaRule;
- })
+ });
},