Skip to content

Commit

Permalink
model: remove security.py
Browse files Browse the repository at this point in the history
The security model wasn't implemented and isn't part of the new V3.0
schemata. The (de-)serialization functions weren't used since the
removal of the security attribute from `AssetAdministrationShell` in
1c45c3c.

In turn, also remove security (de-)serialization functions from JSON/XML
adapters.
Remove ABAC XML namespace definition as it isn't used.
  • Loading branch information
jkhsjdhjs committed Apr 7, 2023
1 parent f3b3b4f commit 9a4d9e3
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 77 deletions.
4 changes: 1 addition & 3 deletions basyx/aas/adapter/_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
from basyx.aas import model

# XML Namespace definition
XML_NS_MAP = {"aas": "https://admin-shell.io/aas/3/0",
"abac": "https://admin-shell.io/aas/abac/3/0"}
XML_NS_MAP = {"aas": "https://admin-shell.io/aas/3/0"}
XML_NS_AAS = "{" + XML_NS_MAP["aas"] + "}"
XML_NS_ABAC = "{" + XML_NS_MAP["abac"] + "}"

MODELING_KIND: Dict[model.ModelingKind, str] = {
model.ModelingKind.TEMPLATE: 'Template',
Expand Down
4 changes: 0 additions & 4 deletions basyx/aas/adapter/json/json_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,6 @@ def _construct_administrative_information(
logger.warning("Ignoring 'revision' attribute of AdministrativeInformation object due to missing 'version'")
return ret

@classmethod
def _construct_security(cls, _dct: Dict[str, object], object_class=model.Security) -> model.Security:
return object_class()

@classmethod
def _construct_operation_variable(
cls, dct: Dict[str, object], object_class=model.OperationVariable) -> model.OperationVariable:
Expand Down
15 changes: 0 additions & 15 deletions basyx/aas/adapter/json/json_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,6 @@ def _asset_administration_shell_to_json(cls, obj: model.AssetAdministrationShell
data["submodels"] = list(obj.submodel)
return data

# #################################################################
# transformation functions to serialize classes from model.security
# #################################################################

@classmethod
def _security_to_json(cls, obj: model.Security) -> Dict[str, object]: # has no attributes in our implementation
"""
serialization of an object from class Security to json
:param obj: object of class Security
:return: dict with the serialized attributes of this object
"""
data = cls._abstract_classes_to_json(obj)
return data

# #################################################################
# transformation functions to serialize classes from model.submodel
# #################################################################
Expand Down
9 changes: 0 additions & 9 deletions basyx/aas/adapter/xml/xml_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,6 @@ def construct_extension(cls, element: etree.Element, object_class=model.Extensio
cls._amend_abstract_attributes(extension, element)
return extension

@classmethod
def construct_security(cls, _element: etree.Element, object_class=model.Security, **_kwargs: Any) -> model.Security:
"""
TODO: this is just a stub implementation
"""
return object_class()

@classmethod
def construct_submodel_element(cls, element: etree.Element, **kwargs: Any) -> model.SubmodelElement:
"""
Expand Down Expand Up @@ -1346,8 +1339,6 @@ def read_aas_xml_element(file: IO, construct: XMLConstructables, failsafe: bool
constructor = decoder_.construct_administrative_information
elif construct == XMLConstructables.QUALIFIER:
constructor = decoder_.construct_qualifier
elif construct == XMLConstructables.SECURITY:
constructor = decoder_.construct_security
elif construct == XMLConstructables.OPERATION_VARIABLE:
constructor = decoder_.construct_operation_variable
elif construct == XMLConstructables.ANNOTATED_RELATIONSHIP_ELEMENT:
Expand Down
19 changes: 0 additions & 19 deletions basyx/aas/adapter/xml/xml_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,25 +510,6 @@ def asset_administration_shell_to_xml(obj: model.AssetAdministrationShell,
return et_aas


# ##############################################################
# transformation functions to serialize classes from model.security
# ##############################################################


def security_to_xml(obj: model.Security,
tag: str = _generic.XML_NS_ABAC+"security") -> etree.Element:
"""
Serialization of objects of class :class:`~aas.model.security.Security` to XML
todo: This is not yet implemented
:param obj: Object of class :class:`~aas.model.security.Security`
:param tag: Namespace+Tag of the serialized element (optional). Default is "aas:security"
:return: Serialized ElementTree object
"""
return abstract_classes_to_xml(tag, obj)


# ##############################################################
# transformation functions to serialize classes from model.submodel
# ##############################################################
Expand Down
4 changes: 0 additions & 4 deletions basyx/aas/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@
Providers for AAS objects, in order to store and retrieve :class:`~aas.model.base.Identifiable` objects by their
:class:`~aas.model.base.Identifier`.
security.py
Security model of the AAS. Currently not existing.
submodel.py
Meta-model of the submodels and events.
"""

from .aas import *
from .security import *
from .base import *
from .submodel import *
from .provider import *
Expand Down
17 changes: 0 additions & 17 deletions basyx/aas/model/security.py

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/model/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ initiating the class. If there is discrepancy between the two, it should be stat
concept
datatypes
provider
security
submodel
5 changes: 0 additions & 5 deletions docs/source/model/security.rst

This file was deleted.

0 comments on commit 9a4d9e3

Please sign in to comment.