minor fixes
This commit is contained in:
parent
48b95db29c
commit
828420d4a7
@ -92,6 +92,9 @@ public class UnixUserModuleImpl extends AbstractModuleImpl {
|
||||
if (userName.length() < 7 || userName.charAt(5) != '-' || userName.lastIndexOf('-') > 5) {
|
||||
throw new AuthorisationException(loginUser, "add", newUnixUser, "userId");
|
||||
}
|
||||
if (userName.length() > 32) {
|
||||
throw new HSAdminException("username exceeds the allowed length");
|
||||
}
|
||||
String passWord = newUnixUser.getPassword();
|
||||
if (passWord == null || passWord.length() == 0) {
|
||||
throw new HSAdminException("password is required");
|
||||
|
@ -132,7 +132,7 @@ public class JsonPillarServlet extends HttpServlet {
|
||||
writer.println(" \"user\": \"" + fullUsername + "\"");
|
||||
writer.println(" , \"dirname\": \"" + usernamePostfix + "\"");
|
||||
writer.println(" , \"uid\": " + user.getUserId());
|
||||
writer.println(" , \"comment\": \"" + user.getComment() + "\"");
|
||||
writer.println(" , \"comment\": \"" + quoteJSON(user.getComment()) + "\"");
|
||||
writer.println(" , \"shell\": \"" + user.getShell() + "\"");
|
||||
writer.println(" , \"homedir\": \"" + user.getHomedir() + "\"");
|
||||
writer.println(" , \"quota_soft\": " + user.getQuotaSoftlimit());
|
||||
@ -222,4 +222,9 @@ public class JsonPillarServlet extends HttpServlet {
|
||||
transaction.close();
|
||||
}
|
||||
|
||||
private String quoteJSON(final String unquoted) {
|
||||
final String quoted = unquoted.replaceAll("\\\"", "\\\\\"");
|
||||
return quoted;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user