summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cms/client/user
diff options
context:
space:
mode:
Diffstat (limited to 'base/common/src/com/netscape/cms/client/user')
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserAddCLI.java106
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserAddCertCLI.java97
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserCLI.java162
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserClient.java89
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserFindCLI.java98
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserFindCertCLI.java104
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserModifyCLI.java107
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserRemoveCLI.java53
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserRemoveCertCLI.java61
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserShowCLI.java56
-rw-r--r--base/common/src/com/netscape/cms/client/user/UserShowCertCLI.java96
11 files changed, 0 insertions, 1029 deletions
diff --git a/base/common/src/com/netscape/cms/client/user/UserAddCLI.java b/base/common/src/com/netscape/cms/client/user/UserAddCLI.java
deleted file mode 100644
index f65d75cd9..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserAddCLI.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserAddCLI extends CLI {
-
- public UserCLI parent;
-
- public UserAddCLI(UserCLI parent) {
- super("add", "Add user");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "fullName", true, "Full name");
- option.setArgName("fullName");
- option.setRequired(true);
- options.addOption(option);
-
- option = new Option(null, "email", true, "Email");
- option.setArgName("email");
- options.addOption(option);
-
- option = new Option(null, "password", true, "Password");
- option.setArgName("password");
- options.addOption(option);
-
- option = new Option(null, "phone", true, "Phone");
- option.setArgName("phone");
- options.addOption(option);
-
- option = new Option(null, "type", true, "Type");
- option.setArgName("type");
- options.addOption(option);
-
- option = new Option(null, "state", true, "State");
- option.setArgName("state");
- options.addOption(option);
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- String[] cmdArgs = cmd.getArgs();
-
- if (cmdArgs.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userId = cmdArgs[0];
-
- UserData userData = new UserData();
- userData.setID(userId);
- userData.setFullName(cmd.getOptionValue("fullName"));
- userData.setEmail(cmd.getOptionValue("email"));
- userData.setPassword(cmd.getOptionValue("password"));
- userData.setPhone(cmd.getOptionValue("phone"));
- userData.setType(cmd.getOptionValue("type"));
- userData.setState(cmd.getOptionValue("state"));
-
- userData = parent.client.addUser(userData);
-
- MainCLI.printMessage("Added user \"" + userId + "\"");
-
- UserCLI.printUser(userData);
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserAddCertCLI.java b/base/common/src/com/netscape/cms/client/user/UserAddCertCLI.java
deleted file mode 100644
index 61ca60137..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserAddCertCLI.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.io.File;
-import java.util.Scanner;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserCertData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserAddCertCLI extends CLI {
-
- public UserCLI parent;
-
- public UserAddCertCLI(UserCLI parent) {
- super("add-cert", "Add user cert");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "input", true, "Input file");
- option.setArgName("file");
- option.setRequired(true);
- options.addOption(option);
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- String[] cmdArgs = cmd.getArgs();
-
- if (cmdArgs.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userId = cmdArgs[0];
- String file = cmd.getOptionValue("input");
-
- // get cert from file
- if (verbose) {
- System.out.println("Reading cert from "+file+".");
- }
- String encoded = new Scanner(new File(file)).useDelimiter("\\A").next();
- if (verbose) {
- System.out.println(encoded);
- }
-
- UserCertData userCertData = new UserCertData();
- userCertData.setEncoded(encoded);
-
- if (verbose) {
- System.out.println(userCertData);
- }
-
- userCertData = parent.client.addUserCert(userId, userCertData);
-
- MainCLI.printMessage("Added certificate \"" + userCertData.getID() + "\"");
-
- UserCLI.printCert(userCertData, false, false);
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserCLI.java b/base/common/src/com/netscape/cms/client/user/UserCLI.java
deleted file mode 100644
index cc9bc8aa5..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserCLI.java
+++ /dev/null
@@ -1,162 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.util.Arrays;
-
-import org.apache.commons.lang.StringUtils;
-import org.jboss.resteasy.plugins.providers.atom.Link;
-
-import com.netscape.certsrv.user.UserCertData;
-import com.netscape.certsrv.user.UserData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserCLI extends CLI {
-
- public MainCLI parent;
- public UserClient client;
-
- public UserCLI(MainCLI parent) {
- super("user", "User management commands");
- this.parent = parent;
-
- addModule(new UserFindCLI(this));
- addModule(new UserShowCLI(this));
- addModule(new UserAddCLI(this));
- addModule(new UserModifyCLI(this));
- addModule(new UserRemoveCLI(this));
-
- addModule(new UserFindCertCLI(this));
- addModule(new UserShowCertCLI(this));
- addModule(new UserAddCertCLI(this));
- addModule(new UserRemoveCertCLI(this));
- }
-
- public void printHelp() {
-
- System.out.println("Commands:");
-
- int leftPadding = 1;
- int rightPadding = 25;
-
- for (CLI module : modules.values()) {
- String label = name + "-" + module.getName();
-
- int padding = rightPadding - leftPadding - label.length();
- if (padding < 1)
- padding = 1;
-
- System.out.print(StringUtils.repeat(" ", leftPadding));
- System.out.print(label);
- System.out.print(StringUtils.repeat(" ", padding));
- System.out.println(module.getDescription());
- }
- }
-
- public void execute(String[] args) throws Exception {
-
- client = new UserClient(parent.config);
- client.setVerbose(verbose);
-
- if (args.length == 0) {
- printHelp();
- System.exit(1);
- }
-
- String command = args[0];
- String[] commandArgs = Arrays.copyOfRange(args, 1, args.length);
-
- if (command == null) {
- printHelp();
- System.exit(1);
- }
-
- CLI module = getModule(command);
- if (module != null) {
- module.execute(commandArgs);
-
- } else {
- System.err.println("Error: Invalid command \"" + command + "\"");
- printHelp();
- System.exit(1);
- }
- }
-
- public static void printUser(UserData userData) {
- System.out.println(" User ID: " + userData.getID());
-
- String fullName = userData.getFullName();
- if (!StringUtils.isEmpty(fullName))
- System.out.println(" Full name: " + fullName);
-
- String email = userData.getEmail();
- if (!StringUtils.isEmpty(email))
- System.out.println(" Email: " + email);
-
- String phone = userData.getPhone();
- if (!StringUtils.isEmpty(phone))
- System.out.println(" Phone: " + phone);
-
- String type = userData.getType();
- if (!StringUtils.isEmpty(type))
- System.out.println(" Type: " + type);
-
- String state = userData.getState();
- if (!StringUtils.isEmpty(state))
- System.out.println(" State: " + state);
-
- Link link = userData.getLink();
- if (verbose && link != null) {
- System.out.println(" Link: " + link.getHref());
- }
- }
-
- public static void printCert(
- UserCertData userCertData,
- boolean showPrettyPrint,
- boolean showEncoded) {
-
- System.out.println(" Cert ID: " + userCertData.getID());
- System.out.println(" Version: " + userCertData.getVersion());
- System.out.println(" Serial Number: " + userCertData.getSerialNumber().toHexString());
- System.out.println(" Issuer: " + userCertData.getIssuerDN());
- System.out.println(" Subject: " + userCertData.getSubjectDN());
-
- Link link = userCertData.getLink();
- if (verbose && link != null) {
- System.out.println(" Link: " + link.getHref());
- }
-
- String prettyPrint = userCertData.getPrettyPrint();
- if (showPrettyPrint && prettyPrint != null) {
- System.out.println();
- System.out.println(prettyPrint);
- }
-
- String encoded = userCertData.getEncoded();
- if (showEncoded && encoded != null) {
- System.out.println();
- System.out.println(encoded);
- }
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserClient.java b/base/common/src/com/netscape/cms/client/user/UserClient.java
deleted file mode 100644
index 010468e8a..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserClient.java
+++ /dev/null
@@ -1,89 +0,0 @@
-//--- BEGIN COPYRIGHT BLOCK ---
-//This program is free software; you can redistribute it and/or modify
-//it under the terms of the GNU General Public License as published by
-//the Free Software Foundation; version 2 of the License.
-//
-//This program is distributed in the hope that it will be useful,
-//but WITHOUT ANY WARRANTY; without even the implied warranty of
-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-//GNU General Public License for more details.
-//
-//You should have received a copy of the GNU General Public License along
-//with this program; if not, write to the Free Software Foundation, Inc.,
-//51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-//(C) 2012 Red Hat, Inc.
-//All rights reserved.
-//--- END COPYRIGHT BLOCK ---
-package com.netscape.cms.client.user;
-
-import java.net.URISyntaxException;
-
-import org.jboss.resteasy.client.ClientResponse;
-
-import com.netscape.certsrv.user.UserCertCollection;
-import com.netscape.certsrv.user.UserCertData;
-import com.netscape.certsrv.user.UserCertResource;
-import com.netscape.certsrv.user.UserCollection;
-import com.netscape.certsrv.user.UserData;
-import com.netscape.certsrv.user.UserResource;
-import com.netscape.cms.client.ClientConfig;
-import com.netscape.cms.client.PKIClient;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserClient extends PKIClient {
-
- public UserResource userClient;
- public UserCertResource userCertClient;
-
- public UserClient(ClientConfig config) throws URISyntaxException {
- super(config);
-
- userClient = createProxy(UserResource.class);
- userCertClient = createProxy(UserCertResource.class);
- }
-
- public UserCollection findUsers(String filter, Integer start, Integer size) {
- return userClient.findUsers(filter, start, size);
- }
-
- public UserData getUser(String userID) {
- return userClient.getUser(userID);
- }
-
- public UserData addUser(UserData userData) {
- @SuppressWarnings("unchecked")
- ClientResponse<UserData> response = (ClientResponse<UserData>)userClient.addUser(userData);
- return getEntity(response);
- }
-
- public UserData modifyUser(String userID, UserData userData) {
- @SuppressWarnings("unchecked")
- ClientResponse<UserData> response = (ClientResponse<UserData>)userClient.modifyUser(userID, userData);
- return getEntity(response);
- }
-
- public void removeUser(String userID) {
- userClient.removeUser(userID);
- }
-
- public UserCertCollection findUserCerts(String userID, Integer start, Integer size) {
- return userCertClient.findUserCerts(userID, start, size);
- }
-
- public UserCertData getUserCert(String userID, String certID) {
- return userCertClient.getUserCert(userID, certID);
- }
-
- public UserCertData addUserCert(String userID, UserCertData userCertData) {
- @SuppressWarnings("unchecked")
- ClientResponse<UserCertData> response = (ClientResponse<UserCertData>)userCertClient.addUserCert(userID, userCertData);
- return getEntity(response);
- }
-
- public void removeUserCert(String userID, String certID) {
- userCertClient.removeUserCert(userID, certID);
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserFindCLI.java b/base/common/src/com/netscape/cms/client/user/UserFindCLI.java
deleted file mode 100644
index c40149872..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserFindCLI.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.util.Collection;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserCollection;
-import com.netscape.certsrv.user.UserData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserFindCLI extends CLI {
-
- public UserCLI parent;
-
- public UserFindCLI(UserCLI parent) {
- super("find", "Find users");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " [FILTER] [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "start", true, "Page start");
- option.setArgName("start");
- options.addOption(option);
-
- option = new Option(null, "size", true, "Page size");
- option.setArgName("size");
- options.addOption(option);
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- String[] cmdArgs = cmd.getArgs();;
- String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
-
- String s = cmd.getOptionValue("start");
- Integer start = s == null ? null : Integer.valueOf(s);
-
- s = cmd.getOptionValue("size");
- Integer size = s == null ? null : Integer.valueOf(s);
-
- UserCollection response = parent.client.findUsers(filter, start, size);
-
- Collection<UserData> entries = response.getUsers();
-
- MainCLI.printMessage(entries.size() + " user(s) matched");
-
- boolean first = true;
-
- for (UserData userData : entries) {
-
- if (first) {
- first = false;
- } else {
- System.out.println();
- }
-
- UserCLI.printUser(userData);
- }
-
- MainCLI.printMessage("Number of entries returned " + entries.size());
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserFindCertCLI.java b/base/common/src/com/netscape/cms/client/user/UserFindCertCLI.java
deleted file mode 100644
index c06d21faf..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserFindCertCLI.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.util.Collection;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserCertCollection;
-import com.netscape.certsrv.user.UserCertData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserFindCertCLI extends CLI {
-
- public UserCLI parent;
-
- public UserFindCertCLI(UserCLI parent) {
- super("find-cert", "Find user certs");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "start", true, "Page start");
- option.setArgName("start");
- options.addOption(option);
-
- option = new Option(null, "size", true, "Page size");
- option.setArgName("size");
- options.addOption(option);
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- String[] cmdArgs = cmd.getArgs();
-
- if (cmdArgs.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userID = cmdArgs[0];
-
- String s = cmd.getOptionValue("start");
- Integer start = s == null ? null : Integer.valueOf(s);
-
- s = cmd.getOptionValue("size");
- Integer size = s == null ? null : Integer.valueOf(s);
-
- UserCertCollection response = parent.client.findUserCerts(userID, start, size);
-
- Collection<UserCertData> entries = response.getCerts();
-
- MainCLI.printMessage(entries.size() + " user cert(s) matched");
-
- boolean first = true;
-
- for (UserCertData userCertData : entries) {
-
- if (first) {
- first = false;
- } else {
- System.out.println();
- }
-
- UserCLI.printCert(userCertData, false, false);
- }
-
- MainCLI.printMessage("Number of entries returned " + entries.size());
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserModifyCLI.java b/base/common/src/com/netscape/cms/client/user/UserModifyCLI.java
deleted file mode 100644
index 2eca31f01..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserModifyCLI.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserModifyCLI extends CLI {
-
- public UserCLI parent;
-
- public UserModifyCLI(UserCLI parent) {
- super("mod", "Modify user");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "fullName", true, "Full name");
- option.setArgName("fullName");
- options.addOption(option);
-
- option = new Option(null, "email", true, "Email");
- option.setArgName("email");
- options.addOption(option);
-
- option = new Option(null, "password", true, "Password");
- option.setArgName("password");
- options.addOption(option);
-
- option = new Option(null, "phone", true, "Phone");
- option.setArgName("phone");
- options.addOption(option);
-
- // type cannot be modified
- // option = new Option(null, "type", true, "Type");
- // option.setArgName("type");
- // options.addOption(option);
-
- option = new Option(null, "state", true, "State");
- option.setArgName("state");
- options.addOption(option);
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- String[] cmdArgs = cmd.getArgs();
-
- if (cmdArgs.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userId = cmdArgs[0];
-
- UserData userData = new UserData();
- userData.setID(userId);
- userData.setFullName(cmd.getOptionValue("fullName"));
- userData.setEmail(cmd.getOptionValue("email"));
- userData.setPassword(cmd.getOptionValue("password"));
- userData.setPhone(cmd.getOptionValue("phone"));
- // type cannot be modified
- // userData.setType(cmd.getOptionValue("type"));
- userData.setState(cmd.getOptionValue("state"));
-
- userData = parent.client.modifyUser(userId, userData);
-
- MainCLI.printMessage("Modified user \"" + userId + "\"");
-
- UserCLI.printUser(userData);
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserRemoveCLI.java b/base/common/src/com/netscape/cms/client/user/UserRemoveCLI.java
deleted file mode 100644
index 6c367ec48..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserRemoveCLI.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserRemoveCLI extends CLI {
-
- public UserCLI parent;
-
- public UserRemoveCLI(UserCLI parent) {
- super("del", "Remove user");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- if (args.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userID = args[0];
-
- parent.client.removeUser(userID);
-
- MainCLI.printMessage("Deleted user \"" + userID + "\"");
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserRemoveCertCLI.java b/base/common/src/com/netscape/cms/client/user/UserRemoveCertCLI.java
deleted file mode 100644
index 096e46d64..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserRemoveCertCLI.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.net.URLEncoder;
-
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-
-/**
- * @author Endi S. Dewata
- */
-public class UserRemoveCertCLI extends CLI {
-
- public UserCLI parent;
-
- public UserRemoveCertCLI(UserCLI parent) {
- super("remove-cert", "Remove user cert");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> <Cert ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- if (args.length != 2) {
- printHelp();
- System.exit(1);
- }
-
- String userID = args[0];
- String certID = args[1];
-
- if (verbose) {
- System.out.println("Removing cert "+certID+" from user "+userID+".");
- }
-
- parent.client.removeUserCert(userID, URLEncoder.encode(certID, "UTF-8"));
-
- MainCLI.printMessage("Deleted certificate \"" + certID + "\"");
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserShowCLI.java b/base/common/src/com/netscape/cms/client/user/UserShowCLI.java
deleted file mode 100644
index d46c5578c..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserShowCLI.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import com.netscape.certsrv.user.UserData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserShowCLI extends CLI {
-
- public UserCLI parent;
-
- public UserShowCLI(UserCLI parent) {
- super("show", "Show user");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- if (args.length != 1) {
- printHelp();
- System.exit(1);
- }
-
- String userId = args[0];
-
- UserData userData = parent.client.getUser(userId);
-
- MainCLI.printMessage("User \"" + userId + "\"");
-
- UserCLI.printUser(userData);
- }
-}
diff --git a/base/common/src/com/netscape/cms/client/user/UserShowCertCLI.java b/base/common/src/com/netscape/cms/client/user/UserShowCertCLI.java
deleted file mode 100644
index 99bc55af0..000000000
--- a/base/common/src/com/netscape/cms/client/user/UserShowCertCLI.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.client.user;
-
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.net.URLEncoder;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-
-import com.netscape.certsrv.user.UserCertData;
-import com.netscape.cms.client.cli.CLI;
-import com.netscape.cms.client.cli.MainCLI;
-
-/**
- * @author Endi S. Dewata
- */
-public class UserShowCertCLI extends CLI {
-
- public UserCLI parent;
-
- public UserShowCertCLI(UserCLI parent) {
- super("show-cert", "Show user cert");
- this.parent = parent;
- }
-
- public void printHelp() {
- formatter.printHelp(parent.name + "-" + name + " <User ID> <Cert ID> [OPTIONS...]", options);
- }
-
- public void execute(String[] args) throws Exception {
-
- Option option = new Option(null, "output", true, "Output file");
- option.setArgName("file");
- options.addOption(option);
-
- options.addOption(null, "pretty", false, "Pretty print");
- options.addOption(null, "encoded", false, "Base-64 encoded");
-
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- printHelp();
- System.exit(1);
- }
-
- boolean showPrettyPrint = cmd.hasOption("pretty");
- boolean showEncoded = cmd.hasOption("encoded");
-
- String[] cmdArgs = cmd.getArgs();
-
- if (cmdArgs.length != 2) {
- printHelp();
- System.exit(1);
- }
-
- String userID = cmdArgs[0];
- String certID = cmdArgs[1];
- String file = cmd.getOptionValue("output");
-
- UserCertData userCertData = parent.client.getUserCert(userID, URLEncoder.encode(certID, "UTF-8"));
-
- String encoded = userCertData.getEncoded();
- if (encoded != null && file != null) {
- // store cert to file
- PrintWriter out = new PrintWriter(new FileWriter(file));
- out.print(encoded);
- out.close();
- }
-
- MainCLI.printMessage("Certificate \"" + userCertData.getID() + "\"");
-
- UserCLI.printCert(userCertData, showPrettyPrint, showEncoded);
- }
-}