[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 679 Fixed token change status operation.



The TokenService has been modified to ignore token change status
operation if the status is unchanged.

https://fedorahosted.org/pki/ticket/1684

--
Endi S. Dewata
From 84a1eca1a30f61fbd2ef29af14bb888bcd387abe Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata redhat com>
Date: Sat, 6 Feb 2016 01:15:13 +0100
Subject: [PATCH] Fixed token change status operation.

The TokenService has been modified to ignore token change status
operation if the status is unchanged.

https://fedorahosted.org/pki/ticket/1684
---
 base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java
index 1a447a73ed95fd896b16059e0ae0d4034f7ed8b2..b3608aef2fff1d12352dc74bce6f89388dffa1ee 100644
--- a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java
+++ b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java
@@ -541,6 +541,14 @@ public class TokenService extends PKIService implements TokenResource {
             tokenRecord = database.getRecord(tokenID);
             TokenStatus currentTokenStatus = getTokenStatus(tokenRecord);
             CMS.debug("TokenService.changeTokenStatus(): current status: " + currentTokenStatus);
+
+            if (currentTokenStatus == tokenStatus) {
+                CMS.debug("TokenService.changeTokenStatus(): no status change, no activity log generated");
+
+                TokenData tokenData = createTokenData(tokenRecord);
+                return createOKResponse(tokenData);
+            }
+
             msg = msg + " from " + currentTokenStatus + " to " + tokenStatus;
 
             // make sure transition is allowed
-- 
2.4.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]