summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e9dc0a)
raw | patch | inline | side by side (parent: 4e9dc0a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 11 May 2010 05:29:35 +0000 (05:29 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 11 May 2010 05:29:35 +0000 (05:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18300 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/functions.inc | patch | blob | history |
index b66953840fe6f84100c9e3928942e4b598e1f7cd..2a27f7a66482d365dbfcf55e41835573fcb18bd1 100644 (file)
* $ldap->cd($base);
* \endcode
* */
-function get_ou($name)
+function get_ou($class,$name)
{
- global $config;
+ global $config;
- $map = array(
- "roleRDN" => "ou=roles,",
- "ogroupRDN" => "ou=groups,",
- "applicationRDN" => "ou=apps,",
- "systemRDN" => "ou=systems,",
- "serverRDN" => "ou=servers,ou=systems,",
- "terminalRDN" => "ou=terminals,ou=systems,",
- "workstationRDN" => "ou=workstations,ou=systems,",
- "printerRDN" => "ou=printers,ou=systems,",
- "phoneRDN" => "ou=phones,ou=systems,",
- "componentRDN" => "ou=netdevices,ou=systems,",
- "sambaMachineAccountRDN" => "ou=winstation,",
-
- "faxBlocklistRDN" => "ou=gofax,ou=systems,",
- "systemIncomingRDN" => "ou=incoming,",
- "aclRoleRDN" => "ou=aclroles,",
- "phoneMacroRDN" => "ou=macros,ou=asterisk,ou=configs,ou=systems,",
- "phoneConferenceRDN" => "ou=conferences,ou=asterisk,ou=configs,ou=systems,",
-
- "faiBaseRDN" => "ou=fai,ou=configs,ou=systems,",
- "faiScriptRDN" => "ou=scripts,",
- "faiHookRDN" => "ou=hooks,",
- "faiTemplateRDN" => "ou=templates,",
- "faiVariableRDN" => "ou=variables,",
- "faiProfileRDN" => "ou=profiles,",
- "faiPackageRDN" => "ou=packages,",
- "faiPartitionRDN"=> "ou=disk,",
-
- "sudoRDN" => "ou=sudoers,",
-
- "deviceRDN" => "ou=devices,",
- "mimetypeRDN" => "ou=mime,");
-
- /* Preset ou... */
- if ($config->get_cfg_value("core",$name, "_not_set_") != "_not_set_"){
- $ou= $config->get_cfg_value("core",$name);
- } elseif (isset($map[$name])) {
- $ou = $map[$name];
- return($ou);
- } else {
- trigger_error("No department mapping found for type ".$name);
- return "";
- }
-
- if ($ou != ""){
- if (!preg_match('/^[^=]+=[^=]+/', $ou)){
- $ou = @LDAP::convert("ou=$ou");
- } else {
- $ou = @LDAP::convert("$ou");
+ if(!$config->configRegistry->propertyExists($class,$name)){
+ trigger_error("No department mapping found for type ".$name);
+ return "";
}
- if(preg_match("/".preg_quote($config->current['BASE'], '/')."$/",$ou)){
- return($ou);
- }else{
- return("$ou,");
+ $ou = $config->configRegistry->getPropertyValue($class,$name);
+ if ($ou != ""){
+ if (!preg_match('/^[^=]+=[^=]+/', $ou)){
+ $ou = @LDAP::convert("ou=$ou");
+ } else {
+ $ou = @LDAP::convert("$ou");
+ }
+
+ if(preg_match("/".preg_quote($config->current['BASE'], '/')."$/",$ou)){
+ return($ou);
+ }else{
+ if(!preg_match("/,$/", $ou)){
+ return("$ou,");
+ }else{
+ return($ou);
+ }
+ }
+
+ } else {
+ return "";
}
-
- } else {
- return "";
- }
}