From: hickert Date: Tue, 3 Apr 2007 08:11:11 +0000 (+0000) Subject: Added step8, configuration file handing. Not working yet. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e3bb62448b4d5a5a3bbd733d47f30bff9c3383fa;p=gosa.git Added step8, configuration file handing. Not working yet. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5956 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/setup/class_setupStep5.inc b/setup/class_setupStep5.inc index 98fe7e694..7cad07cc0 100644 --- a/setup/class_setupStep5.inc +++ b/setup/class_setupStep5.inc @@ -158,6 +158,8 @@ class setup_step_5 extends setup_step }else{ $this->pwd_rules['pwdiffer_active'] = FALSE; } + + /* Get password minimum length posts */ if(isset($_POST['pwminlen_active'])){ $this->pwd_rules['pwminlen_active'] = TRUE; if(isset($_POST['pwminlen'])){ @@ -176,6 +178,16 @@ class setup_step_5 extends setup_step }else{ $this->mail_settings['vacationdir_active'] = FALSE; } + + /* Mail settings */ + if(isset($_POST['externalpwdhook_active'])){ + $this->pwd_rules['externalpwdhook_active'] = TRUE; + if(isset($_POST['externalpwdhook'])){ + $this->pwd_rules['externalpwdhook'] = $_POST['externalpwdhook']; + } + }else{ + $this->pwd_rules['externalpwdhook_active'] = FALSE; + } } $tmp = $this->check(); diff --git a/setup/class_setupStep8.inc b/setup/class_setupStep8.inc new file mode 100644 index 000000000..f7dc508ef --- /dev/null +++ b/setup/class_setupStep8.inc @@ -0,0 +1,111 @@ +s_title = _("Configuration file"); + $this->s_title_long = _("In this step the configuration file will be created."); + $this->s_info = _("Saving configuration file"); + } + + + function execute() + { + + /* Check if there is currently an active gosa.conf + */ + $exists = file_exists(CONFIG_DIR.$this->gosa_conf_name); + + /* Check if existing config file is writeable */ + if($exists){ + $writeable = is_writeable(CONFIG_DIR.$this->gosa_conf_name); + }else{ + $writeable = is_writeable(CONFIG_DIR); + } + + $smarty = get_smarty(); + + $info= posix_getgrgid(posix_getgid()); + $smarty->assign("webgroup", $info['name']); + + $smarty->assign("gosa_conf_name" , $this->gosa_conf_name); + $smarty->assign("create_backup" , $this->create_backup); + $smarty->assign("CONFIG_DIR",CONFIG_DIR); + + $smarty->assign("msg_permissions",sprintf(_("The following file(s), folders(s) must be writeable for the web-user '%s'."),$info['name'])); + + $smarty->assign("exists",$exists); + $smarty->assign("writeable",$writeable); + + $smarty->assign("cv",$this->parent->captured_values); + return($smarty -> fetch (get_template_path("../setup/setup_step8.tpl"))); + } + + + /* Create a backup of the currently existing configuration file. + */ + function create_backup() + { + if(is_writeable(CONFIG_DIR) && is_writeable(CONFIG_DIR.$this->gosa_conf_name)){ + $src = CONFIG_DIR.$this->gosa_conf_name; + $dst = CONFIG_DIR.$this->gosa_conf_name."_".date("Ymd"); + $dst_backup= $dst; + $i = 1; + while(file_exists($dst)){ + $dst = $dst_backup."-".$i; + $i ++; + } + return(rename($src,$dst)); + }else{ + return(FALSE); + } + } + + + function save_object() + { + if(isset($_POST['step8_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + + /* Backup toggle */ + if(isset($_POST['create_backup'])){ + $this->create_backup = TRUE; + }else{ + $this->create_backup = FALSE; + } + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/setup_step5.tpl b/setup/setup_step5.tpl index ff9814552..ee93b8f90 100644 --- a/setup/setup_step5.tpl +++ b/setup/setup_step5.tpl @@ -125,7 +125,7 @@ {t}Different characters from old password{/t} {else} - + {t}Different characters from old password{/t} {/if} diff --git a/setup/setup_step8.tpl b/setup/setup_step8.tpl new file mode 100644 index 000000000..70cfee63e --- /dev/null +++ b/setup/setup_step8.tpl @@ -0,0 +1,49 @@ +
+ +

{t}Configuration File{/t}

+

+ {t}GOsa setup has collected all data needed to create an initial configuration file.{/t} +

+

+ {t}If you want the setup routine to write the configuration file, use the 'Save configuration' button below. If you prefer to copy the 'gosa.conf' manually to '/etc/gosa/' you can download the configuration file by using the 'Download configuration' button.{/t} +

+

+ {t}Automatically write configuration{/t} +

+

+ {if $writeable} + {t}Write configuration file{/t}  + +
+   + {t}Create a backup from existing configuration file{/t} + {else} +

{t}Can't write configuration file, please check permissions.{/t}
+
+{$msg_permissions}
+	{$CONFIG_DIR} 
+	{$CONFIG_DIR}{$gosa_conf_name}
+			
+ {/if} +

+
+

+ {t}Manually create configuration file{/t} +

+

+ {t}Download the configuration file{/t}  + +

+

+ {t}After placing the file under /etc/gosa, place make sure that the webserver user is able to read gosa.conf, while other users shouldn't. You may want to execute these commands to achieve this requirement:{/t} +

+
+	# chown root.{$webgroup} /etc/gosa/gosa.conf
+	# chmod 640 /etc/gosa/gosa.conf
+	
+

+ + + +
+