Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
eed944d
added core action mapping
naman108 Jan 24, 2023
4867fb1
updated node docs and added configuration validation
naman108 Jan 24, 2023
d96534c
removed unsupported functionalities left over from php migration temp…
naman108 Jan 24, 2023
d9191cd
fully implemented iam component
naman108 Jan 24, 2023
934b690
implemented serialization component for xml
naman108 Jan 24, 2023
df42b68
implemented service_management component to support creating topics
naman108 Jan 24, 2023
3635167
added support for a next action key to be passed from a business rule…
naman108 Jan 24, 2023
6428d11
added default get_properties function
naman108 Jan 24, 2023
9938c90
refactored set_OID to coform with lowercase style conventions
naman108 Jan 24, 2023
1e0c0f4
allowed support for next_action to be specified by the sub_request
naman108 Jan 24, 2023
b41b31d
implemented general DigitalPy startup
naman108 Jan 24, 2023
7a22b61
updated default routing worker to support multiple topics generated b…
naman108 Jan 24, 2023
adda459
updated zmq_subscriber to receive and process a recipients list in th…
naman108 Jan 24, 2023
65a1948
improved documentation added kwargs to conform to execute function co…
naman108 Jan 24, 2023
4ffe2a1
updated version number
naman108 Jan 24, 2023
0bda64e
updated to remove hardcoded paths
naman108 Jan 24, 2023
704e67c
updated default file logger to create base logging path
naman108 Jan 24, 2023
1b1cbc6
added ini, json and conf files to index
naman108 Jan 24, 2023
2bf2084
Update setup.py
naman108 Jan 24, 2023
a508151
added missing init to service management
naman108 Jan 24, 2023
66c4369
removed todo
naman108 Jan 24, 2023
3c11b81
re-named iam_facade to IAM_facade to add linux support
naman108 Jan 24, 2023
5360458
updated version
naman108 Jan 24, 2023
4ca1c84
fixed bug causing lower subversions to be rejected e.g. versionRequir…
naman108 Jan 25, 2023
1e9b221
added default persistency if no user persistency exists or is empty a…
naman108 Jan 25, 2023
2fc2e80
added comment
naman108 Jan 25, 2023
325473f
added support for serialization of message value of type list
naman108 Jan 25, 2023
ad8fc3a
Merge branch 'message-sharing-between-services' of https://github.com…
naman108 Jan 25, 2023
63d33fa
Update setup.py
naman108 Jan 28, 2023
afacada
Rename iam_facade.py to IAM_facade.py
naman108 Jan 29, 2023
aa68759
added self arguments to placeholder functions
naman108 Jan 29, 2023
5d23105
removed default connections file and added init so persistence packag…
naman108 Jan 29, 2023
c41e767
Update setup.py
naman108 Jan 29, 2023
4f3dd3f
updated to include ini files
naman108 Jan 29, 2023
be107a5
Merge branch 'message-sharing-between-services' of https://github.com…
naman108 Jan 29, 2023
6e2ca90
updated version
naman108 Jan 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __init__.py

This file was deleted.

96 changes: 0 additions & 96 deletions digitalpy/core/IAM/IAMFacade.py

This file was deleted.

23 changes: 0 additions & 23 deletions digitalpy/core/IAM/IAMManifest.ini

This file was deleted.

176 changes: 176 additions & 0 deletions digitalpy/core/IAM/IAM_facade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#######################################################
#
# IAMFacade.py
# Python implementation of the Class IAMFacade
# Generated by Enterprise Architect
# Created on: 27-Dec-2022 9:33:15 AM
# Original author: Giu Platania
# example of simplified component with no routing class
#######################################################

from typing import List
from digitalpy.core.component_management.impl.default_facade import DefaultFacade
from digitalpy.core.main.object_factory import ObjectFactory

from .controllers.iam_group_controller import IAMGroupController
from .controllers.iam_users_controller import IAMUsersController
from .configuration.iam_constants import (
ACTION_MAPPING_PATH,
LOGGING_CONFIGURATION_PATH,
INTERNAL_ACTION_MAPPING_PATH,
MANIFEST_PATH,
CONFIGURATION_PATH_TEMPLATE,
LOG_FILE_PATH,
CONNECTIONS_PERSISTENCE
)
from . import base


class IAM(DefaultFacade):
"""the IAM facade provides the single point of entry to all the Autentication and
authorization functions
"""

def __init__(
self,
iam_action_mapper,
request,
response,
configuration,
log_file_path: str = LOG_FILE_PATH,
):
super().__init__(
# the path to the external action mapping
action_mapping_path=ACTION_MAPPING_PATH,
# the path to the internal action mapping
internal_action_mapping_path=INTERNAL_ACTION_MAPPING_PATH,
# the path to the logger configuration
logger_configuration=LOGGING_CONFIGURATION_PATH,
# the package containing the base classes
base=base,
# the component specific action mapper (passed by constructor)
action_mapper=iam_action_mapper,
# the request object (passed by constructor)
request=request,
# the response object (passed by constructor)
response=response,
# the configuration object (passed by constructor)
configuration=configuration,
# the template for the absolute path to the model object definitions
configuration_path_template=CONFIGURATION_PATH_TEMPLATE,
# the path to the manifest file
manifest_path=MANIFEST_PATH,
# the path for log files to be stored
log_file_path=log_file_path
)
#self.function_controller = IAMController()
self.group_controller = IAMGroupController(request, response, sync_action_mapper=iam_action_mapper, configuration=configuration)
self.users_controller = IAMUsersController(request=request, response=response, action_mapper=iam_action_mapper, configuration=configuration)
#self.group_permissions_controller = IAMController()
#self.system_user_controller = IAMController()
self.functions = {}
self.groups = {}
self.group_permissions = {}
self.system_users = {}

def initialize(self, request, response):
self.request = request
self.response = response
#self.function_controller.initialize(request, response)
self.group_controller.initialize(request, response)
self.users_controller.initialize(request, response)
#self.group_permissions_controller.initialize(request, response)
#self.system_user_controller.initialize(request, response)

def execute(self, method):
self.request.set_value("logger", self.logger)
self.request.set_value("config_loader", self.config_loader)
self.request.set_value("tracer", self.tracer)
try:
if hasattr(self, method):
getattr(self, method)(**self.request.get_values())
else:
response = self.execute_sub_action(self.request.get_action())
self.response.set_values(response.get_values())
except Exception as e:
self.logger.fatal(str(e))


def get_all_functions(self, **kwargs):
return self.function_controller.get_all_functions()

def get_function_by_id(self, function_id, **kwargs):
return self.function_controller.get_function_by_id(function_id)

def create_function(self, function, **kwargs):
return self.function_controller.create_function(function)

def update_function(self, function_id, updated_function, **kwargs):
return self.function_controller.update_function(function_id, updated_function)

def delete_function(self, function_id, **kwargs):
return self.function_controller.delete_function(function_id)

def get_all_groups(self, **kwargs):
return self.group_controller.get_all_groups()

def get_group_by_id(self, group_id, **kwargs):
return self.group_controller.get_group_by_id(group_id)

def create_group(self, group, **kwargs):
return self.group_controller.create_group(group)

def update_group(self, group_id, updated_group, **kwargs):
return self.group_controller.update_group(group_id, updated_group)

def delete_group(self, group_id, **kwargs):
return self.group_controller.delete_group(group_id)

def get_all_group_permissions(self, **kwargs):
return self.group_permissions_controller.get_all_group_permissions()

def get_group_permissions_by_id(self, group_permissions_id, **kwargs):
return self.group_permissions_controller.get_group_permissions_by_id(group_permissions_id)

def create_group_permissions(self, group_permissions, **kwargs):
return self.group_permissions_controller.create_group_permissions(group_permissions)

def update_group_permissions(self, group_permissions_id, updated_group_permissions, **kwargs):
return self.group_permissions_controller.update_group_permissions(group_permissions_id, updated_group_permissions)

def delete_group_permissions(self, group_permissions_id, **kwargs):
return self.group_permissions_controller.delete_group_permissions(group_permissions_id)

def get_all_system_users(self, **kwargs):
return self.system_user_controller.get_all_system_users()

def get_system_user_by_id(self, system_user_id, **kwargs):
return self.system_user_controller.get_system_user_by_id(system_user_id)

def create_system_user(self, system_user, **kwargs):
return self.system_user_controller.Createsystem_user(system_user)

def add_function(self, function, **kwargs):
self.functions[function.uid] = function

def get_function(self, uid, **kwargs):
return self.functions.get(uid)

def get_connections_by_id(self, *args, **kwargs):
self.users_controller.get_connections_by_id(*args, **kwargs)

def get_all_connections(self, *args, **kwargs):
self.users_controller.get_all_connections(*args, **kwargs)

def ValidateUsers(self, **kwargs):
self.group_controller.validate_users(**kwargs)

def connection(self, *args, **kwargs):
"""a wrapper to call the users controller
"""
self.users_controller.connection(*args, **kwargs)

def disconnection(self, *args, **kwargs):
"""a wrapper to call the users controller
"""
self.users_controller.disconnection(*args, **kwargs)
1 change: 1 addition & 0 deletions digitalpy/core/IAM/base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .iam_action_mapper import IAMActionMapper as ActionMapper
2 changes: 1 addition & 1 deletion digitalpy/core/IAM/base/iam_action_mapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Catalog.Implementation.Libraries.Digitalpy.digitalpy.Async.routing.impl.default_action_mapper import DefaultActionMapper
from digitalpy.core.zmanager.impl.default_action_mapper import DefaultActionMapper

class IAMActionMapper(DefaultActionMapper):
"""This is the CoreName action mapper. Each core Package must have its own action
Expand Down
Empty file.
23 changes: 23 additions & 0 deletions digitalpy/core/IAM/configuration/external_action_mapping.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[actionmapping]
??Connection = digitalpy.core.IAM.IAM_facade.IAM.connection

??disconnection = digitalpy.core.IAM.IAM_facade.IAM.disconnection

??ValidateUsers = digitalpy.core.IAM.IAM_facade.IAM.ValidateUsers

??GetAllConnections = digitalpy.core.IAM.IAM_facade.IAM.get_all_connections

[IAM]
__class = digitalpy.core.IAM.IAM_facade.IAM

[Request]
__class = digitalpy.core.zmanager.impl.default_request.DefaultRequest

[ActionMapper]
__class = digitalpy.core.zmanager.impl.default_action_mapper.DefaultActionMapper

[event_manager]
__class = digitalpy.core.main.impl.default_event_manager.DefaultEventManager

[Response]
__class = digitalpy.core.zmanager.impl.default_response.DefaultResponse
58 changes: 58 additions & 0 deletions digitalpy/core/IAM/configuration/iam_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import json
import pathlib
from string import Template

COMPONENT_NAME = "IAM"

CONFIGURATION_FORMAT = "json"

CURRENT_COMPONENT_PATH = pathlib.Path(__file__).parent.parent.absolute()

CONFIGURATION_PATH_TEMPLATE = Template(
str(
pathlib.PurePath(
CURRENT_COMPONENT_PATH, "configuration/model_definitions/$message_type"
)
)
+ f".{CONFIGURATION_FORMAT}"
)

LOGGING_CONFIGURATION_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "configuration/logging.conf")
)

LOG_FILE_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "logs")
)

PERSISTENCE_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "persistence")
)

CONNECTIONS_PERSISTENCE = str(
pathlib.PurePath(PERSISTENCE_PATH, "connections.json")
)

ACTION_MAPPING_PATH = str(
pathlib.PurePath(
CURRENT_COMPONENT_PATH, "configuration/external_action_mapping.ini"
)
)

INTERNAL_ACTION_MAPPING_PATH = str(
pathlib.PurePath(
CURRENT_COMPONENT_PATH, "configuration/internal_action_mapping.ini"
)
)

BUSINESS_RULES_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "configuration/business_rules.json")
)

PERSISTENCE_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "persistence/emergencies.json")
)

MANIFEST_PATH = str(
pathlib.PurePath(CURRENT_COMPONENT_PATH, "configuration/manifest.ini")
)
Loading