From 44d9ba804f1a9776581dc0f901e98334fc6231e4 Mon Sep 17 00:00:00 2001 From: Dustin Frisch Date: Wed, 28 Jun 2023 11:08:16 +0200 Subject: [PATCH] make gid, shell and home configurable --- default.nix | 1 - src/main/java/de/hsfulda/informatik/LdapSync.java | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 40036ff..1572929 100644 --- a/default.nix +++ b/default.nix @@ -36,7 +36,6 @@ in stdenv.mkDerivation rec { ''; installPhase = '' - ls -l target install -Dm644 target/${name}-1.0-SNAPSHOT-jar-with-dependencies.jar $out/share/java/${name}.jar makeWrapper ${jdk17_headless}/bin/java $out/bin/${name} \ diff --git a/src/main/java/de/hsfulda/informatik/LdapSync.java b/src/main/java/de/hsfulda/informatik/LdapSync.java index 43d9155..1992b58 100644 --- a/src/main/java/de/hsfulda/informatik/LdapSync.java +++ b/src/main/java/de/hsfulda/informatik/LdapSync.java @@ -122,9 +122,11 @@ public class LdapSync { e.addAttribute(new Attribute("givenname", s.getAttributeValue("givenName"))); e.addAttribute(new Attribute("uid", cn)); e.addAttribute(new Attribute("uidNumber", String.valueOf(computeUid(cn, this.userDefinedMappings)))); - e.addAttribute(new Attribute("gidNumber", "20")); - e.addAttribute(new Attribute("loginShell", "/bin/zsh")); - e.addAttribute(new Attribute("homeDirectory", "/Users/" + cn)); + e.addAttribute(new Attribute("gidNumber", properties.getProperty("sync.dst.gid", "1000"))); + if (properties.getProperty("sync.dst.shell") != null) { + e.addAttribute(new Attribute("loginShell", properties.getProperty("sync.dst.shell"))); + } + e.addAttribute(new Attribute("homeDirectory", String.format(properties.getProperty("sync.dst.home"), cn))); e.addAttribute(new Attribute("userPassword", "{SASL}" + cn)); return e;