index 817071a44c4a902ab0c4691bc99d15e7beee0a48..da98e1f39e56afda8c68a36086a29a6c2780d7bb 100644 (file)
*/
function class_available($name)
{
- global $class_mapping;
- return(isset($class_mapping[$name]));
+ global $class_mapping, $config;
+
+ $disabled = array();
+ if($config instanceOf config && $config->configRegistry instanceOf configRegistry){
+ $disabled = $config->configRegistry->getDisabledPlugins();
+ }
+
+ return(isset($class_mapping[$name]) && !isset($disabled[$name]));
}
}
/* Check for global language settings in gosa.conf */
- if (isset ($config) && $config->get_cfg_value('language') != ""){
- $lang = $config->get_cfg_value('language');
+ if (isset ($config) && $config->get_cfg_value("core",'language') != ""){
+ $lang = $config->get_cfg_value("core",'language');
if(!preg_match("/utf/i",$lang)){
$lang .= ".UTF-8";
}
/* Set theme */
if (isset ($config)){
- $theme= $config->get_cfg_value("theme", "default");
+ $theme= $config->get_cfg_value("core","theme");
} else {
$theme= "default";
}
$config->set_current($name);
$mode= "kerberos";
- if ($config->get_cfg_value("useSaslForKerberos") == "true"){
+ if ($config->get_cfg_value("core","useSaslForKerberos") == "true"){
$mode= "sasl";
}
$ldap->cd($config->current['BASE']);
$allowed_attributes = array("uid","mail");
$verify_attr = array();
- if($config->get_cfg_value("loginAttribute") != ""){
- $tmp = explode(",", $config->get_cfg_value("loginAttribute"));
+ if($config->get_cfg_value("core","loginAttribute") != ""){
+ $tmp = explode(",", $config->get_cfg_value("core","loginAttribute"));
foreach($tmp as $attr){
if(in_array($attr,$allowed_attributes)){
$verify_attr[] = $attr;
/* Check for existing entries in lock area */
$ldap= $config->get_ldap_link();
- $ldap->cd ($config->get_cfg_value("config"));
+ $ldap->cd ($config->get_cfg_value("core","config"));
$ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64_encode($object)."))",
array("gosaUser"));
if (!$ldap->success()){
if ($ldap->count() == 0){
$attrs= array();
$name= md5($object);
- $ldap->cd("cn=$name,".$config->get_cfg_value("config"));
+ $ldap->cd("cn=$name,".$config->get_cfg_value("core","config"));
$attrs["objectClass"] = "gosaLockEntry";
$attrs["gosaUser"] = $user;
$attrs["gosaObject"] = base64_encode($object);
$attrs["cn"] = "$name";
$ldap->add($attrs);
if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "cn=$name,".$config->get_cfg_value("config"), 0, ERROR_DIALOG));
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "cn=$name,".$config->get_cfg_value("core","config"), 0, ERROR_DIALOG));
return;
}
}
/* Check for existance and remove the entry */
$ldap= $config->get_ldap_link();
- $ldap->cd ($config->get_cfg_value("config"));
+ $ldap->cd ($config->get_cfg_value("core","config"));
$ldap->search ("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaObject"));
$attrs= $ldap->fetch();
if ($ldap->getDN() != "" && $ldap->success()){
/* Get LDAP ressources */
$ldap= $config->get_ldap_link();
- $ldap->cd ($config->get_cfg_value("config"));
+ $ldap->cd ($config->get_cfg_value("core","config"));
/* Remove all objects of this user, drop errors silently in this case. */
$ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$userdn))", array("gosaUser"));
/* Get LDAP link, check for presence of the lock entry */
$user= "";
$ldap= $config->get_ldap_link();
- $ldap->cd ($config->get_cfg_value("config"));
+ $ldap->cd ($config->get_cfg_value("core","config"));
$ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser"));
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_SEARCH, ERROR_DIALOG));
/* Get LDAP link, check for presence of the lock entry */
$user= "";
$ldap= $config->get_ldap_link();
- $ldap->cd ($config->get_cfg_value("config"));
+ $ldap->cd ($config->get_cfg_value("core","config"));
$ldap->search($filter, array("gosaUser","gosaObject"));
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_SEARCH, ERROR_DIALOG));
* Example:
* \code
* # Determine LDAP base where systems are stored
- * $base = get_ou('systemRDN') . $this->config->current['BASE'];
+ * $base = get_ou("systemManagement", "systemRDN") . $this->config->current['BASE'];
* $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($name, "_not_set_") != "_not_set_"){
- $ou= $config->get_cfg_value($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 "";
- }
}
* */
function get_people_ou()
{
- return (get_ou("userRDN"));
+ return (get_ou("core", "userRDN"));
}
*/
function get_groups_ou()
{
- return (get_ou("groupRDN"));
+ return (get_ou("core", "groupRDN"));
}
*/
function get_winstations_ou()
{
- return (get_ou("sambaMachineAccountRDN"));
+ return (get_ou("wingeneric", "sambaMachineAccountRDN"));
}
global $config;
if (isset($config)){
- return ($config->get_cfg_value("strictNamingRules") == "true");
+ return ($config->get_cfg_value("core","strictNamingRules") == "true");
}
return (TRUE);
}
{
global $config;
- if ($config->get_cfg_value("baseIdHook") != ""){
+ if ($config->get_cfg_value("core","baseIdHook") != ""){
/* Call hook script - if present */
- $command= $config->get_cfg_value("baseIdHook");
+ $command= $config->get_cfg_value("core","baseIdHook");
if ($command != ""){
$command.= " '".LDAP::fix($dn)."' $attrib";
return ($output[0]);
} else {
msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidNumberBase"));
+ return ($config->get_cfg_value("core","uidNumberBase"));
}
} else {
msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidNumberBase"));
+ return ($config->get_cfg_value("core","uidNumberBase"));
}
} else {
msg_dialog::display(_("Warning"), _("'baseIdHook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidNumberBase"));
+ return ($config->get_cfg_value("core","uidNumberBase"));
}
}
}
/* Find postmodify entries for this class */
- $command= $config->search("password", "POSTMODIFY",array('menu'));
+ $command= $config->get_cfg_value("password","postmodify");
if ($command != ""){
/* Walk through attribute list */
global $config;
# Try to use gosa-si?
- if ($config->get_cfg_value("gosaSupportURI") != ""){
+ if ($config->get_cfg_value("core","gosaSupportURI") != ""){
$res= gosaSupportDaemon::send("gosa_gen_smb_hash", "GOSA", array("password" => $password), TRUE);
if (isset($res['XML']['HASH'])){
$hash= $res['XML']['HASH'];
return ("");
}
} else {
- $tmp= $config->get_cfg_value('sambaHashHook')." ".escapeshellarg($password);
+ $tmp= $config->get_cfg_value("core",'sambaHashHook')." ".escapeshellarg($password);
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
exec($tmp, $ar);
$hash= current($ar);
if ($hash == "") {
- msg_dialog::display(_("Configuration error"), sprintf(_("Generating SAMBA hash by running %s failed: check %s!"), bold($config->get_cfg_value('sambaHashHook'), bold("sambaHashHook"))), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"), sprintf(_("Generating SAMBA hash by running %s failed: check %s!"), bold($config->get_cfg_value("core",'sambaHashHook'), bold("sambaHashHook"))), ERROR_DIALOG);
return ("");
}
}
}
/* Get attribute that we should use as serial number */
- $attr= $config->get_cfg_value("modificationDetectionAttribute");
+ $attr= $config->get_cfg_value("core","modificationDetectionAttribute");
if($attr != ""){
$ldap = $config->get_ldap_link();
$ldap->cat($dn,array($attr));
{
global $config;
- switch ($config->get_cfg_value("idAllocationMethod", "traditional")){
+ switch ($config->get_cfg_value("core","idAllocationMethod")){
case "pool":
return get_next_id_pool($attrib);
case "traditional":
global $config;
/* Fill informational values */
- $min= $config->get_cfg_value("${attrib}PoolMin", 10000);
- $max= $config->get_cfg_value("${attrib}PoolMax", 40000);
+ $min= $config->get_cfg_value("core","${attrib}PoolMin");
+ $max= $config->get_cfg_value("core","${attrib}PoolMax");
/* Sanity check */
if ($min >= $max) {
/* If it does not exist, create one with these defaults */
if ($ldap->count() == 0) {
/* Fill informational values */
- $minUserId= $config->get_cfg_value("uidPoolMin", 10000);
- $minGroupId= $config->get_cfg_value("gidPoolMin", 10000);
+ $minUserId= $config->get_cfg_value("core","uidNumberPoolMin");
+ $minGroupId= $config->get_cfg_value("core","gidNumberPoolMin");
/* Add as default */
$attrs= array("objectClass" => array("organizationalUnit", "sambaUnixIdPool"));
/* get the ranges */
$tmp = array('0'=> 1000);
- if (preg_match('/posixAccount/', $oc) && $config->get_cfg_value("uidNumberBase") != ""){
- $tmp= explode('-',$config->get_cfg_value("uidNumberBase"));
- } elseif($config->get_cfg_value("gidNumberBase") != ""){
- $tmp= explode('-',$config->get_cfg_value("gidNumberBase"));
+ if (preg_match('/posixAccount/', $oc) && $config->get_cfg_value("core","uidNumberBase") != ""){
+ $tmp= explode('-',$config->get_cfg_value("core","uidNumberBase"));
+ } elseif($config->get_cfg_value("core","gidNumberBase") != ""){
+ $tmp= explode('-',$config->get_cfg_value("core","gidNumberBase"));
}
/* Set hwm to max if not set - for backward compatibility */
$hwm= pow(2,32);
}
/* Find out next free id near to UID_BASE */
- if ($config->get_cfg_value("baseIdHook") == ""){
+ if ($config->get_cfg_value("core","baseIdHook") == ""){
$base= $lwm;
} else {
/* Call base hook */
// Get theme
if (isset ($config)){
- $theme= $config->get_cfg_value("theme", "default");
+ $theme= $config->get_cfg_value("core","theme");
} else {
- # For debuging - avoid that there's no theme set
- die("config not set!");
+
+ // Fall back to default theme
$theme= "default";
}