changeset 5383:33410f14033b

new error code ForbiddenAccess
author Alain Mazy <am@osimis.io>
date Wed, 06 Sep 2023 15:57:11 +0200
parents 746a8a792a74
children 31bfa492311e
files OrthancFramework/Resources/CodeGeneration/ErrorCodes.json OrthancFramework/Sources/Enumerations.cpp OrthancFramework/Sources/Enumerations.h OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h OrthancServer/Sources/main.cpp
diffstat 5 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CodeGeneration/ErrorCodes.json	Wed Sep 06 13:05:42 2023 +0200
+++ b/OrthancFramework/Resources/CodeGeneration/ErrorCodes.json	Wed Sep 06 15:57:11 2023 +0200
@@ -250,6 +250,12 @@
     "Name": "MainDicomTagsMultiplyDefined",
     "Description": "A main DICOM Tag has been defined multiple times for the same resource level"
   }, 
+  {
+    "Code": 45, 
+    "HttpStatus": 403, 
+    "Name": "ForbiddenAccess", 
+    "Description": "Access to a resource is forbidden"
+  }, 
 
 
 
--- a/OrthancFramework/Sources/Enumerations.cpp	Wed Sep 06 13:05:42 2023 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Wed Sep 06 15:57:11 2023 +0200
@@ -199,6 +199,9 @@
       case ErrorCode_MainDicomTagsMultiplyDefined:
         return "A main DICOM Tag has been defined multiple times for the same resource level";
 
+      case ErrorCode_ForbiddenAccess:
+        return "Access to a resource is forbidden";
+
       case ErrorCode_SQLiteNotOpened:
         return "SQLite: The database is not opened";
 
@@ -2278,6 +2281,9 @@
       case ErrorCode_Revision:
         return HttpStatus_409_Conflict;
 
+      case ErrorCode_ForbiddenAccess:
+        return HttpStatus_403_Forbidden;
+
       case ErrorCode_CreateDicomNotString:
         return HttpStatus_400_BadRequest;
 
--- a/OrthancFramework/Sources/Enumerations.h	Wed Sep 06 13:05:42 2023 +0200
+++ b/OrthancFramework/Sources/Enumerations.h	Wed Sep 06 15:57:11 2023 +0200
@@ -148,6 +148,7 @@
     ErrorCode_DatabaseCannotSerialize = 42    /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
     ErrorCode_Revision = 43    /*!< A bad revision number was provided, which might indicate conflict between multiple writers */,
     ErrorCode_MainDicomTagsMultiplyDefined = 44    /*!< A main DICOM Tag has been defined multiple times for the same resource level */,
+    ErrorCode_ForbiddenAccess = 45    /*!< Access to a resource is forbidden */,
     ErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     ErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     ErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Sep 06 13:05:42 2023 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Sep 06 15:57:11 2023 +0200
@@ -245,6 +245,7 @@
     OrthancPluginErrorCode_DatabaseCannotSerialize = 42    /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
     OrthancPluginErrorCode_Revision = 43    /*!< A bad revision number was provided, which might indicate conflict between multiple writers */,
     OrthancPluginErrorCode_MainDicomTagsMultiplyDefined = 44    /*!< A main DICOM Tag has been defined multiple times for the same resource level */,
+    OrthancPluginErrorCode_ForbiddenAccess = 45    /*!< Access to a resource is forbidden */,
     OrthancPluginErrorCode_SQLiteNotOpened = 1000    /*!< SQLite: The database is not opened */,
     OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001    /*!< SQLite: Connection is already open */,
     OrthancPluginErrorCode_SQLiteCannotOpen = 1002    /*!< SQLite: Unable to open the database */,
--- a/OrthancServer/Sources/main.cpp	Wed Sep 06 13:05:42 2023 +0200
+++ b/OrthancServer/Sources/main.cpp	Wed Sep 06 15:57:11 2023 +0200
@@ -819,6 +819,7 @@
     PrintErrorCode(ErrorCode_DatabaseCannotSerialize, "Database could not serialize access due to concurrent update, the transaction should be retried");
     PrintErrorCode(ErrorCode_Revision, "A bad revision number was provided, which might indicate conflict between multiple writers");
     PrintErrorCode(ErrorCode_MainDicomTagsMultiplyDefined, "A main DICOM Tag has been defined multiple times for the same resource level");
+    PrintErrorCode(ErrorCode_ForbiddenAccess, "Access to a resource is forbidden");
     PrintErrorCode(ErrorCode_SQLiteNotOpened, "SQLite: The database is not opened");
     PrintErrorCode(ErrorCode_SQLiteAlreadyOpened, "SQLite: Connection is already open");
     PrintErrorCode(ErrorCode_SQLiteCannotOpen, "SQLite: Unable to open the database");