[Pki-devel] [PATCH] 678 Fixed token modify operation.

Endi Sukma Dewata edewata at redhat.com
Sat Feb 6 00:08:15 UTC 2016


The TPS UI and CLI have been modified to accept only user ID and
policy attributes when modifying a token.

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

-- 
Endi S. Dewata
-------------- next part --------------
From d021c9cab5ba54c9fe4acfc059c5438488c0fed2 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Sat, 6 Feb 2016 00:49:51 +0100
Subject: [PATCH] Fixed token modify operation.

The TPS UI and CLI have been modified to accept only user ID and
policy attributes when modifying a token.

https://fedorahosted.org/pki/ticket/1687
---
 .../cmstools/tps/token/TokenModifyCLI.java         | 30 ----------------------
 base/tps/shared/webapps/tps/ui/index.html          |  2 +-
 .../dogtagpki/server/tps/rest/TokenService.java    | 30 ----------------------
 3 files changed, 1 insertion(+), 61 deletions(-)

diff --git a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenModifyCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenModifyCLI.java
index 071d1500010a4a98965f1613b8d0b9931f3955ac..a5eac68d29696fd8705496fec4fb6c415b581480 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenModifyCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenModifyCLI.java
@@ -51,18 +51,6 @@ public class TokenModifyCLI extends CLI {
         option.setArgName("User ID");
         options.addOption(option);
 
-        option = new Option(null, "type", true, "Type");
-        option.setArgName("Type");
-        options.addOption(option);
-
-        option = new Option(null, "applet", true, "Applet ID");
-        option.setArgName("Applet ID");
-        options.addOption(option);
-
-        option = new Option(null, "key-info", true, "Key info");
-        option.setArgName("Key info");
-        options.addOption(option);
-
         option = new Option(null, "policy", true, "Policy");
         option.setArgName("Policy");
         options.addOption(option);
@@ -111,24 +99,6 @@ public class TokenModifyCLI extends CLI {
             modify = true;
         }
 
-        String type = cmd.getOptionValue("type");
-        if (type != null) {
-            tokenData.setType(type);
-            modify = true;
-        }
-
-        String appletID = cmd.getOptionValue("applet");
-        if (appletID != null) {
-            tokenData.setAppletID(appletID);
-            modify = true;
-        }
-
-        String keyInfo = cmd.getOptionValue("key-info");
-        if (keyInfo != null) {
-            tokenData.setKeyInfo(keyInfo);
-            modify = true;
-        }
-
         String policy = cmd.getOptionValue("policy");
         if (policy != null) {
             tokenData.setPolicy(policy);
diff --git a/base/tps/shared/webapps/tps/ui/index.html b/base/tps/shared/webapps/tps/ui/index.html
index 2354e8d1c1cd0942a467ef4828612b4c6f81be9a..8080a125cb277024af3ff7e837247c86fd9fccc6 100644
--- a/base/tps/shared/webapps/tps/ui/index.html
+++ b/base/tps/shared/webapps/tps/ui/index.html
@@ -303,7 +303,7 @@ $(function() {
             el: content,
             url: "token.html",
             model: new TokenModel({ id: id }),
-            editable: ["userID", "type", "appletID", "keyInfo", "policy"]
+            editable: ["userID", "policy"]
         }).open();
     });
 
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 cb660f3b1db5649fffb1533b5a407e692e0dcaf6..1a447a73ed95fd896b16059e0ae0d4034f7ed8b2 100644
--- a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java
+++ b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java
@@ -480,36 +480,6 @@ public class TokenService extends PKIService implements TokenResource {
                 }
             }
 
-            // update type if specified
-            String type = tokenData.getType();
-            if (type != null) {
-                if (type.equals("")) { // remove value if empty
-                    tokenRecord.setType(null);
-                } else { // otherwise replace value
-                    tokenRecord.setType(type);
-                }
-            }
-
-            // update applet ID if specified
-            String appletID = tokenData.getAppletID();
-            if (appletID != null) {
-                if (appletID.equals("")) { // remove value if empty
-                    tokenRecord.setAppletID(null);
-                } else { // otherwise replace value
-                    tokenRecord.setAppletID(appletID);
-                }
-            }
-
-            // update key info if specified
-            String keyInfo = tokenData.getKeyInfo();
-            if (keyInfo != null) {
-                if (keyInfo.equals("")) { // remove value if empty
-                    tokenRecord.setKeyInfo(null);
-                } else { // otherwise replace value
-                    tokenRecord.setKeyInfo(keyInfo);
-                }
-            }
-
             // update policy if specified
             String policy = tokenData.getPolicy();
             if (policy != null) {
-- 
2.4.3



More information about the Pki-devel mailing list