From e93c1de651a76f06ef0a3f247db4be5a40860139 Mon Sep 17 00:00:00 2001 From: ReemMahmoud Date: Thu, 12 Apr 2018 14:39:39 +0200 Subject: Check data before category Change-Id: I7e523a08fcfd3f9ea322a399c71637f268cbb38e Signed-off-by: ReemMahmoud --- python_moonutilities/Changelog | 6 ++- .../python_moonutilities/__init__.py | 2 +- .../python_moonutilities/exceptions.py | 49 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) (limited to 'python_moonutilities') diff --git a/python_moonutilities/Changelog b/python_moonutilities/Changelog index e6ab2f6e..61225b2b 100644 --- a/python_moonutilities/Changelog +++ b/python_moonutilities/Changelog @@ -89,4 +89,8 @@ CHANGES 1.4.8 ----- -- Add SubjectScopeExisting, ObjectScopeExisting, ActionScopeExisting exceptions \ No newline at end of file +- Add SubjectScopeExisting, ObjectScopeExisting, ActionScopeExisting exceptions + +1.4.9 +----- +- Add some exceptions when deletion of elements is impossible diff --git a/python_moonutilities/python_moonutilities/__init__.py b/python_moonutilities/python_moonutilities/__init__.py index cabb4c52..d313ecc3 100644 --- a/python_moonutilities/python_moonutilities/__init__.py +++ b/python_moonutilities/python_moonutilities/__init__.py @@ -3,6 +3,6 @@ # license which can be found in the file 'LICENSE' in this package distribution # or at 'http://www.apache.org/licenses/LICENSE-2.0'. -__version__ = "1.4.8" +__version__ = "1.4.9" diff --git a/python_moonutilities/python_moonutilities/exceptions.py b/python_moonutilities/python_moonutilities/exceptions.py index f1dcd31e..bb2d35b7 100644 --- a/python_moonutilities/python_moonutilities/exceptions.py +++ b/python_moonutilities/python_moonutilities/exceptions.py @@ -651,3 +651,52 @@ class PolicyExisting(MoonError): code = 409 title = 'Policy Error' logger = "Error" + + +class DeleteData(MoonError): + description = _("Cannot delete data with assignment") + code = 400 + title = 'Data Error' + logger = "Error" + + +class DeleteCategoryWithData(MoonError): + description = _("Cannot delete category with data") + code = 400 + title = 'Category Error' + logger = "Error" + + +class DeleteCategoryWithMetaRule(MoonError): + description = _("Cannot delete category with meta rule") + code = 400 + title = 'Category Error' + logger = "Error" + + +class DeleteCategoryWithData(MoonError): + description = _("Cannot delete category with data") + code = 400 + title = 'Category Error' + logger = "Error" + + +class DeleteModelWithPolicy(MoonError): + description = _("Cannot delete model with policy") + code = 400 + title = 'Model Error' + logger = "Error" + + +class DeletePolicyWithPdp(MoonError): + description = _("Cannot delete policy with pdp") + code = 400 + title = 'Policy Error' + logger = "Error" + + +class DeleteMetaRuleWithModel(MoonError): + description = _("Cannot delete meta rule with model") + code = 400 + title = 'Meta rule Error' + logger = "Error" -- cgit 1.2.3-korg