summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0da88d5)
raw | patch | inline | side by side (parent: 0da88d5)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Sep 2009 08:03:32 +0000 (08:03 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Sep 2009 08:03:32 +0000 (08:03 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14260 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/contrib/gosa.conf.5 | patch | blob | history | |
gosa-core/include/functions.inc | patch | blob | history |
index d1718e209af0d72777a40c0426fcae1aa9a74d72..75ccf4858d0db647995951e004ebe9d92e1ccfb2 100644 (file)
will generate a three digits id with the next free entry appended to
"acct".
+.nf
+ idGenerator="acct{id!1}"
+.fi
+
+ will generate a one digit id with the next free entry appended to
+ "acct" - if needed.
+
.nf
idGenerator="ext{id#3}"
.fi
index 1e6cba28f2f643811e65615d8c08b342646a1106..d9d12986fd5aa5ba65846f3604594aa4025f3899 100644 (file)
function expand_id($rule, $attributes)
{
/* Check for id rule */
- if(preg_match('/^id(:|#)\d+$/',$rule)){
- return (array("\{$rule}"));
+ if(preg_match('/^id(:|#|!)\d+$/',$rule)){
+ return (array("{$rule}"));
}
/* Check for clean attribute */
foreach($proposed as $uid){
/* Check for id tag and modify uid if needed */
- if(preg_match('/\{id:\d+}/',$uid)){
- $size= preg_replace('/^.*{id:(\d+)}.*$/', '\\1', $uid);
+ if(preg_match('/\{id(:|!)\d+}/',$uid, $m)){
+ $size= preg_replace('/^.*{id(:|!)(\d+)}.*$/', '\\2', $uid);
- for ($i= 0, $p= pow(10,$size); $i < $p; $i++){
- $number= sprintf("%0".$size."d", $i);
- $res= preg_replace('/{id:(\d+)}/', $number, $uid);
+ $start= $m[1]==":"?0:-1;
+ for ($i= $start, $p= pow(10,$size); $i < $p; $i++){
+ if ($i == -1) {
+ $number= "";
+ } else {
+ $number= sprintf("%0".$size."d", $i+1);
+ }
+ $res= preg_replace('/{id(:|!)\d+}/', $number, $uid);
$ldap->search("(uid=".preg_replace('/[{}]/', '', $res).")",array('dn'));
if($ldap->count() == 0){