aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--moonv4/moon_interface/moon_interface/api/assignments.py23
-rw-r--r--moonv4/moon_interface/moon_interface/api/authz.py4
-rw-r--r--moonv4/moon_interface/moon_interface/api/data.py20
-rw-r--r--moonv4/moon_interface/moon_interface/api/generic.py8
-rw-r--r--moonv4/moon_interface/moon_interface/api/meta_data.py20
-rw-r--r--moonv4/moon_interface/moon_interface/api/meta_rules.py10
-rw-r--r--moonv4/moon_interface/moon_interface/api/models.py10
-rw-r--r--moonv4/moon_interface/moon_interface/api/pdp.py10
-rw-r--r--moonv4/moon_interface/moon_interface/api/perimeter.py26
-rw-r--r--moonv4/moon_interface/moon_interface/api/policies.py10
-rw-r--r--moonv4/moon_interface/moon_interface/api/rules.py8
-rw-r--r--moonv4/moon_interface/moon_interface/tools.py19
12 files changed, 77 insertions, 91 deletions
diff --git a/moonv4/moon_interface/moon_interface/api/assignments.py b/moonv4/moon_interface/moon_interface/api/assignments.py
index c270440a..34a0ea3f 100644
--- a/moonv4/moon_interface/moon_interface/api/assignments.py
+++ b/moonv4/moon_interface/moon_interface/api/assignments.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.2.0"
@@ -79,7 +79,8 @@ class SubjectAssignments(Resource):
}
:internal_api: update_subject_assignment
"""
- return call(ctx={"id": uuid, "method": "update_subject_assignment", "user_id": user_id}, args=request.json)
+ return call("security_router",
+ ctx={"id": uuid, "method": "update_subject_assignment", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None):
@@ -96,7 +97,8 @@ class SubjectAssignments(Resource):
}
:internal_api: delete_subject_assignment
"""
- return call(ctx={"id": uuid, "method": "delete_subject_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
+ return call("security_router",
+ ctx={"id": uuid, "method": "delete_subject_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@@ -132,7 +134,8 @@ class ObjectAssignments(Resource):
}
:internal_api: get_object_assignments
"""
- return call(ctx={"id": uuid, "method": "get_object_assignments", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
+ return call("security_router",
+ ctx={"id": uuid, "method": "get_object_assignments", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@check_auth
@@ -159,7 +162,8 @@ class ObjectAssignments(Resource):
}
:internal_api: update_object_assignment
"""
- return call(ctx={"id": uuid, "method": "update_object_assignment", "user_id": user_id}, args=request.json)
+ return call("security_router",
+ ctx={"id": uuid, "method": "update_object_assignment", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None):
@@ -176,7 +180,8 @@ class ObjectAssignments(Resource):
}
:internal_api: delete_object_assignment
"""
- return call(ctx={"id": uuid, "method": "delete_object_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
+ return call("security_router",
+ ctx={"id": uuid, "method": "delete_object_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@@ -212,7 +217,7 @@ class ActionAssignments(Resource):
}
:internal_api: get_action_assignments
"""
- return call(ctx={"id": uuid, "method": "get_action_assignments", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "get_action_assignments", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@check_auth
@@ -239,7 +244,7 @@ class ActionAssignments(Resource):
}
:internal_api: update_action_assignment
"""
- return call(ctx={"id": uuid, "method": "update_action_assignment", "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "update_action_assignment", "user_id": user_id},
args=request.json)
@check_auth
@@ -257,5 +262,5 @@ class ActionAssignments(Resource):
}
:internal_api: delete_action_assignment
"""
- return call(ctx={"id": uuid, "method": "delete_action_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "delete_action_assignment", "perimeter_id": perimeter_id, "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
diff --git a/moonv4/moon_interface/moon_interface/api/authz.py b/moonv4/moon_interface/moon_interface/api/authz.py
index d1bf3407..5224f762 100644
--- a/moonv4/moon_interface/moon_interface/api/authz.py
+++ b/moonv4/moon_interface/moon_interface/api/authz.py
@@ -10,7 +10,7 @@ from uuid import uuid4
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -55,7 +55,7 @@ class Authz(Resource):
"""
# Note (asteroide): user_id default to admin to be able to read the database
# it would be better to have a read-only user.
- return call(ctx={"id": uuid,
+ return call("security_router", ctx={"id": uuid,
"call_master": False,
"method": "authz",
"subject_name": subject_name,
diff --git a/moonv4/moon_interface/moon_interface/api/data.py b/moonv4/moon_interface/moon_interface/api/data.py
index fdd28e9e..e378b3d3 100644
--- a/moonv4/moon_interface/moon_interface/api/data.py
+++ b/moonv4/moon_interface/moon_interface/api/data.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.2.0"
@@ -52,7 +52,7 @@ class SubjectData(Resource):
}]
:internal_api: get_subject_data
"""
- return call(ctx={"id": uuid, "method": "get_subject_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "get_subject_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@check_auth
@@ -79,7 +79,7 @@ class SubjectData(Resource):
}
:internal_api: add_subject_data
"""
- return call(ctx={"id": uuid, "method": "add_subject_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "add_subject_data", "category_id": category_id, "user_id": user_id},
args=request.json)
@check_auth
@@ -96,7 +96,7 @@ class SubjectData(Resource):
}]
:internal_api: delete_subject_data
"""
- return call(ctx={"id": uuid, "method": "delete_subject_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "delete_subject_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@@ -132,7 +132,7 @@ class ObjectData(Resource):
}]
:internal_api: get_object_data
"""
- return call(ctx={"id": uuid, "method": "get_object_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "get_object_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@check_auth
@@ -159,7 +159,7 @@ class ObjectData(Resource):
}
:internal_api: add_object_data
"""
- return call(ctx={"id": uuid, "method": "add_object_data", "category_id": category_id, "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "add_object_data", "category_id": category_id, "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, category_id=None, data_id=None, user_id=None):
@@ -175,7 +175,7 @@ class ObjectData(Resource):
}
:internal_api: delete_object_data
"""
- return call(ctx={"id": uuid, "method": "delete_object_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "delete_object_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@@ -211,7 +211,7 @@ class ActionData(Resource):
}]
:internal_api: get_action_data
"""
- return call(ctx={"id": uuid, "method": "get_action_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "get_action_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
@check_auth
@@ -238,7 +238,7 @@ class ActionData(Resource):
}
:internal_api: add_action_data
"""
- return call(ctx={"id": uuid, "method": "add_action_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "add_action_data", "category_id": category_id, "user_id": user_id},
args=request.json)
@check_auth
@@ -255,7 +255,7 @@ class ActionData(Resource):
}
:internal_api: delete_action_data
"""
- return call(ctx={"id": uuid, "method": "delete_action_data", "category_id": category_id, "user_id": user_id},
+ return call("security_router", ctx={"id": uuid, "method": "delete_action_data", "category_id": category_id, "user_id": user_id},
args={"data_id": data_id})
diff --git a/moonv4/moon_interface/moon_interface/api/generic.py b/moonv4/moon_interface/moon_interface/api/generic.py
index 6c29039d..d7afd6fb 100644
--- a/moonv4/moon_interface/moon_interface/api/generic.py
+++ b/moonv4/moon_interface/moon_interface/api/generic.py
@@ -9,7 +9,7 @@ Those API are helping API used to manage the Moon platform.
from flask_restful import Resource, request
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
import moon_interface.api
from moon_interface.tools import check_auth
@@ -38,7 +38,7 @@ class Status(Resource):
}
}
"""
- return call(method="get_status", ctx={"component_id": component_id})
+ return call("security_router", method="get_status", ctx={"component_id": component_id})
class Logs(Resource):
@@ -73,7 +73,7 @@ class Logs(Resource):
args["to"] = to_str
args["event_number"] = event_number
- return call(method="get_logs", ctx={"component_id": component_id}, args=args)
+ return call("security_router", method="get_logs", ctx={"component_id": component_id}, args=args)
class API(Resource):
@@ -148,6 +148,6 @@ class InternalAPI(Resource):
if component_id in api_list:
api_desc = dict()
api_desc["name"] = component_id
- api_desc["endpoints"] = call(component_id, {}, "list_api")
+ api_desc["endpoints"] = call("security_router", component_id, {}, "list_api")
return api_desc
diff --git a/moonv4/moon_interface/moon_interface/api/meta_data.py b/moonv4/moon_interface/moon_interface/api/meta_data.py
index c34faa20..2f115e94 100644
--- a/moonv4/moon_interface/moon_interface/api/meta_data.py
+++ b/moonv4/moon_interface/moon_interface/api/meta_data.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.2.0"
@@ -45,7 +45,7 @@ class SubjectCategories(Resource):
}
:internal_api: get_subject_categories
"""
- return call(ctx={"method": "get_subject_categories", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "get_subject_categories", "user_id": user_id}, args={"category_id": category_id})
@check_auth
def post(self, category_id=None, user_id=None):
@@ -65,7 +65,7 @@ class SubjectCategories(Resource):
}
:internal_api: add_subject_category
"""
- return call(ctx={"method": "set_subject_category", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"method": "set_subject_category", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, category_id=None, user_id=None):
@@ -79,7 +79,7 @@ class SubjectCategories(Resource):
}
:internal_api: delete_subject_category
"""
- return call(ctx={"method": "delete_subject_category", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "delete_subject_category", "user_id": user_id}, args={"category_id": category_id})
class ObjectCategories(Resource):
@@ -107,7 +107,7 @@ class ObjectCategories(Resource):
}
:internal_api: get_object_categories
"""
- return call(ctx={"method": "get_object_categories", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "get_object_categories", "user_id": user_id}, args={"category_id": category_id})
@check_auth
def post(self, category_id=None, user_id=None):
@@ -127,7 +127,7 @@ class ObjectCategories(Resource):
}
:internal_api: add_object_category
"""
- return call(ctx={"method": "set_object_category", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"method": "set_object_category", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, category_id=None, user_id=None):
@@ -141,7 +141,7 @@ class ObjectCategories(Resource):
}
:internal_api: delete_object_category
"""
- return call(ctx={"method": "delete_object_category", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "delete_object_category", "user_id": user_id}, args={"category_id": category_id})
class ActionCategories(Resource):
@@ -169,7 +169,7 @@ class ActionCategories(Resource):
}
:internal_api: get_action_categories
"""
- return call(ctx={"method": "get_action_categories", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "get_action_categories", "user_id": user_id}, args={"category_id": category_id})
@check_auth
def post(self, category_id=None, user_id=None):
@@ -189,7 +189,7 @@ class ActionCategories(Resource):
}
:internal_api: add_action_category
"""
- return call(ctx={"method": "set_action_category", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"method": "set_action_category", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, category_id=None, user_id=None):
@@ -203,4 +203,4 @@ class ActionCategories(Resource):
}
:internal_api: delete_action_category
"""
- return call(ctx={"method": "delete_action_category", "user_id": user_id}, args={"category_id": category_id})
+ return call("security_router", ctx={"method": "delete_action_category", "user_id": user_id}, args={"category_id": category_id})
diff --git a/moonv4/moon_interface/moon_interface/api/meta_rules.py b/moonv4/moon_interface/moon_interface/api/meta_rules.py
index 5e059109..a3648fbf 100644
--- a/moonv4/moon_interface/moon_interface/api/meta_rules.py
+++ b/moonv4/moon_interface/moon_interface/api/meta_rules.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -49,7 +49,7 @@ class MetaRules(Resource):
}
:internal_api: get_meta_rules
"""
- return call(ctx={"method": "get_meta_rules",
+ return call("security_router", ctx={"method": "get_meta_rules",
"user_id": user_id,
"meta_rule_id": meta_rule_id}, args={})
@@ -77,7 +77,7 @@ class MetaRules(Resource):
}
:internal_api: add_meta_rules
"""
- return call(ctx={"method": "add_meta_rules",
+ return call("security_router", ctx={"method": "add_meta_rules",
"user_id": user_id,
"meta_rule_id": meta_rule_id}, args=request.json)
@@ -105,7 +105,7 @@ class MetaRules(Resource):
}
:internal_api: set_meta_rules
"""
- return call(ctx={"method": "set_meta_rules",
+ return call("security_router", ctx={"method": "set_meta_rules",
"user_id": user_id,
"meta_rule_id": meta_rule_id}, args=request.json)
@@ -133,7 +133,7 @@ class MetaRules(Resource):
}
:internal_api: delete_meta_rules
"""
- return call(ctx={"method": "delete_meta_rules",
+ return call("security_router", ctx={"method": "delete_meta_rules",
"user_id": user_id,
"meta_rule_id": meta_rule_id}, args=request.json)
diff --git a/moonv4/moon_interface/moon_interface/api/models.py b/moonv4/moon_interface/moon_interface/api/models.py
index 0226a87e..66e2e1d8 100644
--- a/moonv4/moon_interface/moon_interface/api/models.py
+++ b/moonv4/moon_interface/moon_interface/api/models.py
@@ -10,7 +10,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -46,7 +46,7 @@ class Models(Resource):
}
:internal_api: get_models
"""
- return call(ctx={"id": uuid, "method": "get_models", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "get_models", "user_id": user_id}, args={})
@check_auth
def post(self, uuid=None, user_id=None):
@@ -68,7 +68,7 @@ class Models(Resource):
}
:internal_api: add_model
"""
- return call(ctx={"id": uuid, "method": "add_model", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "add_model", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, user_id=None):
@@ -82,7 +82,7 @@ class Models(Resource):
}
:internal_api: delete_model
"""
- return call(ctx={"id": uuid, "method": "delete_model", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "delete_model", "user_id": user_id}, args={})
@check_auth
def patch(self, uuid=None, user_id=None):
@@ -99,5 +99,5 @@ class Models(Resource):
}
:internal_api: update_model
"""
- return call(ctx={"id": uuid, "method": "update_model", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "update_model", "user_id": user_id}, args=request.json)
diff --git a/moonv4/moon_interface/moon_interface/api/pdp.py b/moonv4/moon_interface/moon_interface/api/pdp.py
index 3a3519c4..13a76bfa 100644
--- a/moonv4/moon_interface/moon_interface/api/pdp.py
+++ b/moonv4/moon_interface/moon_interface/api/pdp.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -48,7 +48,7 @@ class PDP(Resource):
}
:internal_api: get_pdp
"""
- return call(ctx={"id": uuid, "method": "get_pdp", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "get_pdp", "user_id": user_id}, args={})
@check_auth
def post(self, uuid=None, user_id=None):
@@ -72,7 +72,7 @@ class PDP(Resource):
}
:internal_api: add_pdp
"""
- return call(ctx={"id": uuid, "method": "add_pdp", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "add_pdp", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, user_id=None):
@@ -86,7 +86,7 @@ class PDP(Resource):
}
:internal_api: delete_pdp
"""
- return call(ctx={"id": uuid, "method": "delete_pdp", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "delete_pdp", "user_id": user_id}, args={})
@check_auth
def patch(self, uuid=None, user_id=None):
@@ -104,5 +104,5 @@ class PDP(Resource):
}
:internal_api: update_pdp
"""
- return call(ctx={"id": uuid, "method": "update_pdp", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "update_pdp", "user_id": user_id}, args=request.json)
diff --git a/moonv4/moon_interface/moon_interface/api/perimeter.py b/moonv4/moon_interface/moon_interface/api/perimeter.py
index 8907c8f4..df7b6dd1 100644
--- a/moonv4/moon_interface/moon_interface/api/perimeter.py
+++ b/moonv4/moon_interface/moon_interface/api/perimeter.py
@@ -12,7 +12,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.2.0"
@@ -51,7 +51,7 @@ class Subjects(Resource):
}
:internal_api: get_subjects
"""
- return call(ctx={"id": uuid, "method": "get_subjects", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "get_subjects", "user_id": user_id}, args={"perimeter_id": perimeter_id})
@check_auth
def post(self, uuid=None, perimeter_id=None, user_id=None):
@@ -77,7 +77,7 @@ class Subjects(Resource):
}
:internal_api: set_subject
"""
- return call(ctx={"id": uuid, "method": "set_subject", "user_id": user_id, "perimeter_id": None},
+ return call("security_router", ctx={"id": uuid, "method": "set_subject", "user_id": user_id, "perimeter_id": None},
args=request.json)
@check_auth
@@ -104,7 +104,7 @@ class Subjects(Resource):
}
:internal_api: set_subject
"""
- return call(ctx={"id": uuid, "method": "set_subject", "user_id": user_id, "perimeter_id": perimeter_id},
+ return call("security_router", ctx={"id": uuid, "method": "set_subject", "user_id": user_id, "perimeter_id": perimeter_id},
args=request.json)
@check_auth
@@ -125,7 +125,7 @@ class Subjects(Resource):
}
:internal_api: delete_subject
"""
- return call(ctx={"id": uuid, "method": "delete_subject", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "delete_subject", "user_id": user_id}, args={"perimeter_id": perimeter_id})
class Objects(Resource):
@@ -157,7 +157,7 @@ class Objects(Resource):
}
:internal_api: get_objects
"""
- return call(ctx={"id": uuid, "method": "get_objects", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "get_objects", "user_id": user_id}, args={"perimeter_id": perimeter_id})
@check_auth
def post(self, uuid=None, perimeter_id=None, user_id=None):
@@ -178,7 +178,7 @@ class Objects(Resource):
}
:internal_api: set_object
"""
- return call(ctx={"id": uuid, "method": "set_object", "user_id": user_id, "perimeter_id": None},
+ return call("security_router", ctx={"id": uuid, "method": "set_object", "user_id": user_id, "perimeter_id": None},
args=request.json)
@check_auth
@@ -200,7 +200,7 @@ class Objects(Resource):
}
:internal_api: set_object
"""
- return call(ctx={"id": uuid, "method": "set_object", "user_id": user_id, "perimeter_id": perimeter_id},
+ return call("security_router", ctx={"id": uuid, "method": "set_object", "user_id": user_id, "perimeter_id": perimeter_id},
args=request.json)
@check_auth
@@ -218,7 +218,7 @@ class Objects(Resource):
}
:internal_api: delete_object
"""
- return call(ctx={"id": uuid, "method": "delete_object", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "delete_object", "user_id": user_id}, args={"perimeter_id": perimeter_id})
class Actions(Resource):
@@ -250,7 +250,7 @@ class Actions(Resource):
}
:internal_api: get_actions
"""
- return call(ctx={"id": uuid, "method": "get_actions", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "get_actions", "user_id": user_id}, args={"perimeter_id": perimeter_id})
@check_auth
def post(self, uuid=None, perimeter_id=None, user_id=None):
@@ -271,7 +271,7 @@ class Actions(Resource):
}
:internal_api: set_action
"""
- return call(ctx={"id": uuid, "method": "set_action", "user_id": user_id, "perimeter_id": None},
+ return call("security_router", ctx={"id": uuid, "method": "set_action", "user_id": user_id, "perimeter_id": None},
args=request.json)
@check_auth
@@ -293,7 +293,7 @@ class Actions(Resource):
}
:internal_api: set_action
"""
- return call(ctx={"id": uuid, "method": "set_action", "user_id": user_id, "perimeter_id": perimeter_id},
+ return call("security_router", ctx={"id": uuid, "method": "set_action", "user_id": user_id, "perimeter_id": perimeter_id},
args=request.json)
@check_auth
@@ -311,4 +311,4 @@ class Actions(Resource):
}
:internal_api: delete_action
"""
- return call(ctx={"id": uuid, "method": "delete_action", "user_id": user_id}, args={"perimeter_id": perimeter_id})
+ return call("security_router", ctx={"id": uuid, "method": "delete_action", "user_id": user_id}, args={"perimeter_id": perimeter_id})
diff --git a/moonv4/moon_interface/moon_interface/api/policies.py b/moonv4/moon_interface/moon_interface/api/policies.py
index ba2b2e1e..b9ccb4be 100644
--- a/moonv4/moon_interface/moon_interface/api/policies.py
+++ b/moonv4/moon_interface/moon_interface/api/policies.py
@@ -11,7 +11,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -48,7 +48,7 @@ class Policies(Resource):
}
:internal_api: get_policies
"""
- return call(ctx={"id": uuid, "method": "get_policies", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "get_policies", "user_id": user_id}, args={})
@check_auth
def post(self, uuid=None, user_id=None):
@@ -72,7 +72,7 @@ class Policies(Resource):
}
:internal_api: add_policy
"""
- return call(ctx={"id": uuid, "method": "add_policy", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "add_policy", "user_id": user_id}, args=request.json)
@check_auth
def delete(self, uuid=None, user_id=None):
@@ -86,7 +86,7 @@ class Policies(Resource):
}
:internal_api: delete_policy
"""
- return call(ctx={"id": uuid, "method": "delete_policy", "user_id": user_id}, args={})
+ return call("security_router", ctx={"id": uuid, "method": "delete_policy", "user_id": user_id}, args={})
@check_auth
def patch(self, uuid=None, user_id=None):
@@ -104,5 +104,5 @@ class Policies(Resource):
}
:internal_api: update_policy
"""
- return call(ctx={"id": uuid, "method": "update_policy", "user_id": user_id}, args=request.json)
+ return call("security_router", ctx={"id": uuid, "method": "update_policy", "user_id": user_id}, args=request.json)
diff --git a/moonv4/moon_interface/moon_interface/api/rules.py b/moonv4/moon_interface/moon_interface/api/rules.py
index 7757d275..882a7d9f 100644
--- a/moonv4/moon_interface/moon_interface/api/rules.py
+++ b/moonv4/moon_interface/moon_interface/api/rules.py
@@ -10,7 +10,7 @@ from flask import request
from flask_restful import Resource
from oslo_config import cfg
from oslo_log import log as logging
-from moon_interface.tools import call
+from moon_utilities.security_functions import call
from moon_interface.tools import check_auth
__version__ = "0.1.0"
@@ -47,7 +47,7 @@ class Rules(Resource):
}
:internal_api: get_rules
"""
- return call(ctx={"id": uuid,
+ return call("security_router", ctx={"id": uuid,
"method": "get_rules",
"user_id": user_id,
"rule_id": rule_id}, args={})
@@ -94,7 +94,7 @@ class Rules(Resource):
}
:internal_api: add_rule
"""
- return call(ctx={"id": uuid,
+ return call("security_router", ctx={"id": uuid,
"method": "add_rule",
"user_id": user_id,
"rule_id": rule_id}, args=request.json)
@@ -109,7 +109,7 @@ class Rules(Resource):
:return: { "result": true }
:internal_api: delete_rule
"""
- return call(ctx={"id": uuid,
+ return call("security_router", ctx={"id": uuid,
"method": "delete_rule",
"user_id": user_id,
"rule_id": rule_id}, args={})
diff --git a/moonv4/moon_interface/moon_interface/tools.py b/moonv4/moon_interface/moon_interface/tools.py
index 443519ac..0d43a857 100644
--- a/moonv4/moon_interface/moon_interface/tools.py
+++ b/moonv4/moon_interface/moon_interface/tools.py
@@ -20,25 +20,6 @@ CONF = cfg.CONF
TOKENS = {}
-def timeit(function):
- def wrapper(*args, **kwargs):
- LOG.info("Calling {} with {} {}...".format(function, args, kwargs))
- ret = function(*args, **kwargs)
- LOG.info("End of {}".format(function))
- return ret
- return wrapper
-
-
-def call(topic="security_router", ctx=None, method="route", **kwargs):
- if not ctx:
- ctx = dict()
- transport = oslo_messaging.get_transport(CONF)
- target = oslo_messaging.Target(topic=topic, version='1.0')
- client = oslo_messaging.RPCClient(transport, target)
- LOG.info("Calling {} on {}...".format(method, topic))
- return client.call(ctx, method, **kwargs)
-
-
def check_token(token, url=None):
_verify = False
if CONF.keystone.server_crt: