From b117ed336a8744e6b2b7a8a531743ba58178d8a0 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 27 Nov 2013 10:50:45 +0000
Subject: [PATCH] Factor out duplicate code and fix cut n paste bug in LocalBackendModifyOperation which was preventing sync operations from bypassing backend INTERNAL_ONLY mode.
---
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java | 45 ++-------------------------------------------
1 files changed, 2 insertions(+), 43 deletions(-)
diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
index 06114da..7ed2707 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -484,49 +484,8 @@
applyPreOpModifications(modifications, 0, false);
}
- // Actually perform the modify DN operation.
- // This should include taking
- // care of any synchronization that might be needed.
- // If it is not a private backend, then check to see if the server or
- // backend is operating in read-only mode.
- if (!currentBackend.isPrivateBackend())
- {
- switch (DirectoryServer.getWritabilityMode())
- {
- case DISABLED:
- setResultCode(ResultCode.UNWILLING_TO_PERFORM);
- appendErrorMessage(ERR_MODDN_SERVER_READONLY.get(String
- .valueOf(entryDN)));
- return;
-
- case INTERNAL_ONLY:
- if (!(isInternalOperation() || isSynchronizationOperation()))
- {
- setResultCode(ResultCode.UNWILLING_TO_PERFORM);
- appendErrorMessage(ERR_MODDN_SERVER_READONLY.get(String
- .valueOf(entryDN)));
- return;
- }
- }
-
- switch (currentBackend.getWritabilityMode())
- {
- case DISABLED:
- setResultCode(ResultCode.UNWILLING_TO_PERFORM);
- appendErrorMessage(ERR_MODDN_BACKEND_READONLY.get(String
- .valueOf(entryDN)));
- return;
-
- case INTERNAL_ONLY:
- if (!(isInternalOperation() || isSynchronizationOperation()))
- {
- setResultCode(ResultCode.UNWILLING_TO_PERFORM);
- appendErrorMessage(ERR_MODDN_BACKEND_READONLY.get(String
- .valueOf(entryDN)));
- return;
- }
- }
- }
+ LocalBackendWorkflowElement.checkIfBackendIsWritable(currentBackend,
+ this, entryDN, ERR_MODDN_SERVER_READONLY, ERR_MODDN_BACKEND_READONLY);
if (noOp)
{
--
Gitblit v1.10.0