>From cada3602a953e690330a0707b73ca12f941f9542 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 3 Feb 2016 23:54:56 +0100 Subject: [PATCH] Fixed token add operation. The TPS UI and CLI have been modified to accept only token ID, and optionally user ID and policy attributes when adding a token. https://fedorahosted.org/pki/ticket/1477 https://fedorahosted.org/pki/ticket/1687 --- .../netscape/cmstools/tps/token/TokenAddCLI.java | 14 +++++++-- base/tps/shared/webapps/tps/js/token.js | 25 +++++++++++++++ base/tps/shared/webapps/tps/ui/token.html | 22 ++++++------- base/tps/shared/webapps/tps/ui/tokens.html | 6 ++-- .../dogtagpki/server/tps/rest/TokenService.java | 36 ++++++++++------------ 5 files changed, 66 insertions(+), 37 deletions(-) diff --git a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java index a63df2e8005ad9161a2c90c7c88953abc6a85be4..1615846d6b6ae91c74cb87dda2e48667c24ff811 100644 --- a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java @@ -42,13 +42,16 @@ public class TokenAddCLI extends CLI { } public void printHelp() { - formatter.printHelp(getFullName() + " --user [OPTIONS...]", options); + formatter.printHelp(getFullName() + " [OPTIONS...]", options); } public void createOptions() { Option option = new Option(null, "user", true, "User ID"); option.setArgName("User ID"); - option.setRequired(true); + options.addOption(option); + + option = new Option(null, "policy", true, "Policy"); + option.setArgName("Policy"); options.addOption(option); } @@ -83,7 +86,12 @@ public class TokenAddCLI extends CLI { TokenData tokenData = new TokenData(); tokenData.setTokenID(tokenID); - tokenData.setUserID(cmd.getOptionValue("user")); + + String userID = cmd.getOptionValue("user"); + tokenData.setUserID(userID); + + String policy = cmd.getOptionValue("policy"); + tokenData.setPolicy(policy); tokenData = tokenCLI.tokenClient.addToken(tokenData); diff --git a/base/tps/shared/webapps/tps/js/token.js b/base/tps/shared/webapps/tps/js/token.js index 1a4267f72de1c378522dc16ec18f3c90414f1dd7..b4d5a717beb7e7c49e2641044881abaaa7c49b32 100644 --- a/base/tps/shared/webapps/tps/js/token.js +++ b/base/tps/shared/webapps/tps/js/token.js @@ -201,8 +201,33 @@ var TokenPage = EntryPage.extend({ if (self.mode == "add") { self.changeStatusAction.hide(); + self.$("label[name='type']").hide(); + self.$("input[name='type']").hide(); + self.$("label[name='appletID']").hide(); + self.$("input[name='appletID']").hide(); + self.$("label[name='keyInfo']").hide(); + self.$("input[name='keyInfo']").hide(); + self.$("label[name='createTimestamp']").hide(); + self.$("input[name='createTimestamp']").hide(); + self.$("label[name='modifyTimestamp']").hide(); + self.$("input[name='modifyTimestamp']").hide(); + self.$("label[name='status']").hide(); + self.$("input[name='statusLabel']").hide(); + } else { self.changeStatusAction.show(); + self.$("label[name='type']").show(); + self.$("input[name='type']").show(); + self.$("label[name='appletID']").show(); + self.$("input[name='appletID']").show(); + self.$("label[name='keyInfo']").show(); + self.$("input[name='keyInfo']").show(); + self.$("label[name='createTimestamp']").show(); + self.$("input[name='createTimestamp']").show(); + self.$("label[name='modifyTimestamp']").show(); + self.$("input[name='modifyTimestamp']").show(); + self.$("label[name='status']").show(); + self.$("input[name='statusLabel']").show(); } } }); diff --git a/base/tps/shared/webapps/tps/ui/token.html b/base/tps/shared/webapps/tps/ui/token.html index 90b9c72a585f5723e47d7830b4a70805088a2fd4..aaf18141424d972eb3312eec5819a8bc06e8420c 100644 --- a/base/tps/shared/webapps/tps/ui/token.html +++ b/base/tps/shared/webapps/tps/ui/token.html @@ -43,24 +43,24 @@
- +
- +
- + +
+
- -
- +
- +
- -
- +
- +
+ +
diff --git a/base/tps/shared/webapps/tps/ui/tokens.html b/base/tps/shared/webapps/tps/ui/tokens.html index 42a93cd93ff45c920e7dc22e88004a2e3a439665..ec89de958a17bba09b181e8bbe3d15b6c8287cad 100644 --- a/base/tps/shared/webapps/tps/ui/tokens.html +++ b/base/tps/shared/webapps/tps/ui/tokens.html @@ -105,9 +105,6 @@

- -

@@ -118,6 +115,9 @@

+ +