No known key found for this signature in database
GPG Key ID: B4C3BF012D9B26BE
2 changed files with
10 additions and
0 deletions
-
src/main/java/de/hsfulda/informatik/LdapSync.java
-
src/test/java/de/hsfulda/informatik/LdapSyncTest.java
|
|
@ -27,6 +27,7 @@ public class LdapSync { |
|
|
|
private final Properties properties = new Properties(); |
|
|
|
private final static Pattern legacyPattern = Pattern.compile("^fd([a-z][a-z])?([0-9]*?)$"); |
|
|
|
private final static Pattern newPattern = Pattern.compile("^fd([0-9][0-9][0-9][0-9][0-9][0-9][0-9])$"); |
|
|
|
private final static Pattern newGuestPattern = Pattern.compile("^fdg([0-9][0-9][0-9][0-9][0-9])$"); |
|
|
|
private Map<String, Integer> userDefinedMappings = Collections.emptyMap(); |
|
|
|
|
|
|
|
public LdapSync() throws IOException, LDAPException, GeneralSecurityException { |
|
|
@ -157,6 +158,13 @@ public class LdapSync { |
|
|
|
return 270000000 + Integer.parseInt(x.group(1)); |
|
|
|
} |
|
|
|
|
|
|
|
final Matcher y = newGuestPattern.matcher(cn); |
|
|
|
|
|
|
|
if (y.find()) { |
|
|
|
return 300000000 + Integer.parseInt(y.group(1)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final Matcher m = legacyPattern.matcher(cn); |
|
|
|
|
|
|
|
if (m.find()) { |
|
|
|
|
|
@ -122,6 +122,8 @@ public class LdapSyncTest { |
|
|
|
assertEquals(10149999, (int) LdapSync.computeUid("fdaa9999", mappings)); |
|
|
|
assertEquals(262641000, (int) LdapSync.computeUid("fdzz1000", mappings)); |
|
|
|
assertEquals(262649999, (int) LdapSync.computeUid("fdzz9999", mappings)); |
|
|
|
assertEquals(300000000, (int) LdapSync.computeUid("fdg00000", mappings)); |
|
|
|
assertEquals(300099999, (int) LdapSync.computeUid("fdg99999", mappings)); |
|
|
|
|
|
|
|
mappings = LdapSync.parseUserDefinedMappings("aaabbb"); |
|
|
|
assertEquals(0, mappings.size()); |
|
|
|