include unixusers in pillar

This commit is contained in:
Peter Hormanns 2021-08-10 19:36:43 +02:00
parent 607f9f57fb
commit 61357a596e

View File

@ -99,13 +99,33 @@ public class JsonPillarServlet extends HttpServlet {
final PacComponent pacQuota = pac.getPacComponent("QUOTA");
if (pacQuota != null) {
int quota = pacQuota.getQuantity();
writer.println(" , \"quota\": \"" + quota + "\"");
writer.println(" , \"quota\": " + quota);
}
final PacComponent pacOffice = pac.getPacComponent("OFFICE");
if (pacOffice != null) {
int office = pacOffice.getQuantity();
writer.println(" , \"office\": \"" + office + "\"");
}
writer.println(" , \"users\": [");
boolean firstLoopUsers = true;
final Set<UnixUser> users = pac.getUnixUser();
for (UnixUser user: users) {
if (firstLoopUsers) {
firstLoopUsers = false;
writer.println(" {");
} else {
writer.println(" , {");
}
writer.println(" \"user\": \"" + user.getName() + "\"");
writer.println(" , \"uid\": " + user.getUserId());
writer.println(" , \"comment\": \"" + user.getComment() + "\"");
writer.println(" , \"shell\": \"" + user.getShell() + "\"");
writer.println(" , \"homedir\": \"" + user.getHomedir() + "\"");
writer.println(" , \"quota_soft\": " + user.getQuotaSoftlimit());
writer.println(" , \"quota_hard\": " + user.getQuotaHardlimit());
writer.println(" }");
}
writer.println(" ]");
writer.println(" }");
}
writer.println(" ]");