From 61357a596ef21027682c167e0b0ebfa7923dacbe Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Tue, 10 Aug 2021 19:36:43 +0200 Subject: [PATCH] include unixusers in pillar --- .../de/hsadmin/pillar/JsonPillarServlet.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java index ff9042a..91c85d2 100644 --- a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java +++ b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java @@ -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 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(" ]");