From: cajus Date: Thu, 17 Jan 2008 16:18:16 +0000 (+0000) Subject: Moved directories X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0367aee8b588169f98d7df284506838e77f35081;p=gosa.git Moved directories git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8473 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc b/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc deleted file mode 100644 index 6fa572b9d..000000000 --- a/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc +++ /dev/null @@ -1,85 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goCupsServer"); - var $attributes = array(); - var $StatusFlag = "goCupsServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goCupsServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $acl; - var $cn = ""; - var $goCupsServerStatus = ""; - var $view_logged =FALSE; - - function goCupsServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("Print service"); - } - - - function execute() - { - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - $smarty = get_smarty(); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__)))); - } - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Print service"); - $fields['AllowEdit'] = false; - return($fields); - } - - function check() - { - $message = plugin::check(); - return($message); - } - - function save_object() - { - plugin::save_object(); - } - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Cups"), - "plDescription" => _("Print service")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 100, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "start" => _("Start"), - "stop" => _("Stop"), - "restart" => _("Restart"), - - "plProvidedAcls"=> array() - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl b/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl deleted file mode 100644 index e10bd2f67..000000000 --- a/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl +++ /dev/null @@ -1,9 +0,0 @@ -

{t}Print Service{/t} {t}enabled{/t}

- -

 

-
- -   - -
- diff --git a/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc deleted file mode 100644 index 287ed9e36..000000000 --- a/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc +++ /dev/null @@ -1,245 +0,0 @@ -DisplayName = _("Kiosk profile service"); - $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs')); - $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path); - - /* Load list of profiles and check if they still exists */ - if ($this->baseDir == ""){ - print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!")); - }else{ - $this->gotoKioskProfiles = array(); - if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){ - for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){ - $url = $this->attrs['gotoKioskProfile'][$i]; - $this->server_path = preg_replace("/\/[^\/]*$/","",$url); - $name= preg_replace("/^.*\//","",$url); - $this->gotoKioskProfiles[] = array('url' => $url , - 'name' => $name , - 'initial' =>TRUE, - 'exists' => file_exists($this->baseDir."/".$name)); - } - } - } - } - - - function remove_from_parent() - { - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn")); - $str =""; - $cnt = 3; - while($cnt && $attrs = $ldap->fetch()){ - $str .= $attrs['cn'][0].", "; - $cnt --; - } - $str = preg_replace("/, $/","",$str); - if($cnt != 3){ - print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str)); - }else{ - goService::remove_from_parent(); - } - } - - - function execute() - { - /* log actions */ - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - /* Fill templating stuff */ - $smarty= get_smarty(); - $display= ""; - - /* Add new kiosk profile - * in profile directory ($this->baseDir); - */ - if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){ - $file = $_FILES['newProfile']; - if(!file_exists($this->baseDir.$file['name'])){ - $tmp = array( - 'url' => "" , - 'name' => $file['name'] , - 'initial' => FALSE, - 'tmp_name'=> $file['tmp_name'], - 'content' => file_get_contents($file['tmp_name']), - 'exists' => TRUE); - $this->gotoKioskProfiles[] = $tmp; - } - if(!is_writeable($this->baseDir)){ - print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir)); - } - } - - $only_once = true; - foreach($_POST as $name => $value){ - - if((preg_match("/^delkiosk_/",$name))&&($only_once)){ - - /* Get id, name and path */ - $only_once = false; - $id = preg_replace("/^delkiosk_/","",$name); - $id = preg_replace("/_.*$/","",$id); - $name = $this->gotoKioskProfiles[$id]['name']; - $filename = $this->baseDir."/".$name; - - /* check if profile is still in use */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile")); - $used_by = ""; - $cnt = 3; - while(($attrs = $ldap->fetch()) && ($cnt)){ - $cnt --; - $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]); - if($check == $name){ - $used_by .= $attrs['cn'][0].", "; - } - } - $used_by = preg_replace("/, $/","",$used_by); - if(!empty($used_by)){ - print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by)); - }else{ - if($this->gotoKioskProfiles[$id]['initial']){ - $res = @unlink($filename); - if(!$res){ - if(!is_writeable($filename)){ - print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename)); - } - if(!file_exists($filename)){ - print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename)); - } - } - unset($this->gotoKioskProfiles[$id]); - } - } - } - } - - /* Display list of profiles */ - $divlist = new divSelectBox("KioskProfiles"); - $divlist -> SetHeight (300); - foreach($this->gotoKioskProfiles as $key => $val ){ - $divlist->AddEntry(array( - array("string"=>"".$val['name'].""), - array("string"=>"" , - "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ") - )); - } - - /* Assign all existing profiles to smarty */ - $smarty->assign("divlist",$divlist->DrawList()); - $smarty = get_smarty(); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - $smarty->assign("server_path",$this->server_path); - return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__)))); - } - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Kiosk profile service"); - $fields['AllowEdit'] = TRUE; - $fields['AllowStart'] = false; - $fields['AllowStop'] = false; - $fields['AllowRestart'] = false; - return($fields); - } - - function check() - { - $message = plugin::check(); - return($message); - } - - function save() - { - goService::save(); - - $method = $this->server_path."/"; - $method = preg_replace("/\/\/*$/","/",$method); - $this->attrs['gotoKioskProfile'] = array(); - foreach($this->gotoKioskProfiles as $profile){ - if(!$profile['initial']){ - - $contents = $profile['content']; - $path = $this->baseDir."/".$profile['name']; - $fp = @fopen($path,"w"); - if(!$fp){ - print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path); - }else{ - fwrite($fp,$contents,strlen($contents)); - $this->attrs['gotoKioskProfile'][] = $method.$profile['name']; - } - @unlink($profile['tmp_name']); - }else{ - $this->attrs['gotoKioskProfile'][] = $method.$profile['name']; - } - } - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error(),_("Wohl kaum")); - } - - - function save_object() - { - if(isset($_POST['goKioskPosted'])){ - goService::save_object(); - if(isset($_POST['server_path'])){ - $this->server_path = get_post("server_path"); - } - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Kiosk"), - "plDescription" => _("Kiosk profile management")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 100, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array() - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl b/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl deleted file mode 100644 index f81230464..000000000 --- a/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl +++ /dev/null @@ -1,24 +0,0 @@ -

 

- - - -{t}Server path{/t}  -
-
-{$divlist} - - - -

 

-
- -   - -
- - - diff --git a/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc deleted file mode 100644 index c16df0387..000000000 --- a/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc +++ /dev/null @@ -1,97 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goLdapServer"); - var $attributes = array("goLdapBase"); - var $StatusFlag = "goLdapServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goLdapServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $cn = ""; - var $goLdapServerStatus = ""; - var $goLdapBase = ""; - var $view_logged =FALSE; - - function goLdapServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("LDAP service"); - } - - - function execute() - { - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - $smarty = get_smarty(); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translated){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("LDAP Service"); - $fields['AllowEdit'] = true; - return($fields); - } - - - - function check() - { - $message = plugin::check(); - if(empty($this->goLdapBase)){ - $message[] = _("The given base is empty or contains invalid characters."); - } - return($message); - } - - - function save_object() - { - if(isset($_POST['goLdapServerPosted'])){ - plugin::save_object(); - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Ldap"), - "plDescription" => _("Ldap")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 96, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "goLdapBase" => _("Ldap base")) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl b/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl deleted file mode 100644 index 24e181771..000000000 --- a/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl +++ /dev/null @@ -1,13 +0,0 @@ -

{t}LDAP service{/t}

-{t}LDAP URI{/t}{$must} -{render acl=$goLdapBaseACL} - -{/render} - -

 

-
- -   - -
- diff --git a/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc b/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc deleted file mode 100644 index 575686627..000000000 --- a/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc +++ /dev/null @@ -1,267 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* attribute list for save action */ - var $ignore_account = TRUE; - var $attributes = array("description","type","charset","path","option", "volume"); - var $objectclasses = array("whatever"); - var $is_account = true; - - var $name =""; // Name of - var $description =""; // description - var $type =""; // Type FS/Samba/NCP - var $charset =""; // charset - var $host =""; // hostname - var $types =array(); // Array Types NFS/Samba/NCP/netatalk - var $charsets =array(); // Array with charsets - var $path =""; // Path - var $volume =""; // Volume - var $option =""; // Options - var $is_edit =false; - var $create_mount_init = false; //mount entry set for this entry (while editing)? - var $create_mount = false; //save mount entry - - var $parent = NULL; - var $view_logged = FALSE; - - function servnfs (&$config, $parent,$entry= false,$mount =false) - { - $this->parent = $parent; - $dn = $parent->dn; - plugin::plugin ($config, $dn); - - $this->types = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP"); - if($dn){ - $this->host = substr($dn, 3, strpos($dn, ',')-3); - } - - $this->charsets = array(); - - if(!file_exists(CONFIG_DIR."/encodings")){ - print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR)); - }else{ - if(!is_readable(CONFIG_DIR."/encodings")){ - print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR)); - }else{ - $fp = fopen(CONFIG_DIR."/encodings","r"); - $i = 100; - while(!feof($fp)&&$i){ - $i -- ; - $str = trim(fgets($fp,256)); - - /* Skip comments */ - if(!preg_match("/^#/",$str)){ - $arr = split("\=",$str); - if(count($arr)==2){ - $this->charsets[$arr[0]]=$arr[1]; - } - } - } - } - } - - if($entry){ - list($this->name, $this->description, $this->type, $this->charset, - $this->path, $this->option, $this->volume)= split("\|",$entry."|"); - $this->is_edit = true; - - }else{ - $this->attributes[] = "name"; - } - - - $this->create_mount_init = $mount; - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - /* Fill templating stuff */ - $smarty= get_smarty(); - - $smarty->assign("charsets" ,$this->charsets); - $smarty->assign("types" ,$this->types); - - /* attrs to smarty*/ - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - - $tmp = $this->parent->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->parent->getacl($name)); - } - - $smarty->assign("name",$this->name); - if($this->is_edit){ - $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name"))); - } - $smarty->assign("allow_mounts", $this->parent->allow_mounts); - $smarty->assign("mount_checked", ""); - - $smarty->assign("appleMountsACL", $this->getacl("appleMounts")); - - if (($this->type == "netatalk") || ($this->type == "NFS")) { - if ($this->create_mount_init) { - $smarty->assign("mount_checked", "checked"); - } else { - $tmp = split(",", $this->dn); - $clip = $tmp[0] . ",".get_ou('serverou'); - $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip)); - switch ($this->type) { - case "netatalk" : { - $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn; - break; - } - case "NFS" : { - $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn; - break; - } - default : { - continue; - } - } - $ldap = $this->config->get_ldap_link(); - $ldap->cat($mountdn, array('dn')); - $attrs = $ldap->fetch(); - if (count($attrs) > 0) { - $smarty->assign("mount_checked", "checked"); - } - } - } - - $display= $smarty->fetch(get_template_path('servnfs.tpl', TRUE)); - return($display); - } - - function remove_from_parent() - { - /* This cannot be removed... */ - } - - - /* Save data to object */ - function save_object() - { - if(isset($_POST['servnfs_posted'])){ - - foreach($this->attributes as $name){ - if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){ - $this->$name = $_POST[$name]; - } - } - - if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) { - $this->create_mount = true; - } else { - $this->create_mount = false; - } - } - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - // fixme : a check for the path ? ? - if(empty($this->path)){ - $message[]=_("Please specify a valid path for your setup."); - } - - // only 0-9a-z - if(!$this->is_edit){ - if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){ - $message[]=_("Please specify a valid name for your share."); - } - if(empty($this->name)){ - $message[]=_("Please specify a name for your share."); - } - } - - if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){ - $message[]=_("Description contains invalid characters."); - } - - if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){ - $message[]=_("Volume contains invalid characters."); - } - - if(preg_match("/\|/",$this->path)){ - $message[]=_("Path contains invalid characters."); - } - - if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){ - $message[]=_("Option contains invalid characters."); - } - - /* remove a / at the end of the path, we neither need it there nor - * do we want to check for it later. - */ - if(substr($this->path, -1, 1) == '/') { - $this->path=substr($this->path, 0, -1); - } - - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=goShareServer)", array("goExportEntry")); - while($test = $ldap->fetch()){ - if($test['dn']==$this->dn) - continue; - if(isset($test['goExportEntry'])){ - foreach($test['goExportEntry'] as $entry){ - $tmp = split("\|",$entry); - if($tmp[0] == $this->name){ - $message[]="Name already in use"; - } - } - } - } - return ($message); - } - - - /* Save to LDAP */ - function save() - { - /* Everything seems perfect, lets - generate an new export Entry - */ - - $s_return = ""; - - $s_return.= $this->name."|"; - $s_return.= $this->description."|"; - $s_return.= $this->type."|"; - $s_return.= $this->charset."|"; - $s_return.= $this->path."|"; - $s_return.= $this->option."|"; - $s_return.= $this->volume; - - return(array($this->name=>$s_return)); - } - - function should_create_mount() { - return $this->create_mount; - } - - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl b/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl deleted file mode 100644 index 9fb70a5f4..000000000 --- a/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl +++ /dev/null @@ -1,144 +0,0 @@ -

 {t}Edit share{/t}

- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- {t}Name{/t} {$must} - -{render acl=$nameACL} - -{/render} -
- {t}Description{/t} - -{render acl=$descriptionACL} - -{/render} -
- {t}Path{/t} / {t}Volume{/t} - -{render acl=$pathACL} - -{/render} -
-
{t}Server{/t}
-
-{render acl=$volumeACL} - -{/render} -
-
- - - - - - - - - - - - - - - -
- - {t}Type{/t} - -{render acl=$typeACL} - -{/render} - {if $allow_mounts == TRUE} -

-{render acl=$netatalkmountACL} - -{/render} - -
-
- {/if} - - {literal} - - {/literal} -
- {t}Codepage{/t} - -{render acl=$charsetACL} - -{/render} -
- {t}Option{/t} - -{render acl=$optionACL} - -{/render} -
-
-

 

-
- - -
- diff --git a/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc b/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc deleted file mode 100644 index b179ae95b..000000000 --- a/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc +++ /dev/null @@ -1,147 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goNtpServer"); - var $attributes = array("goTimeSource"); - var $StatusFlag = "goNtpServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goNtpServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $goTimeSource = array(); - var $goNtpServerStatus= ""; - var $acl; - var $cn = ""; - var $view_logged =FALSE; - - function goNtpServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("Time service (NTP)"); - - /* Load arrays */ - $tmp = array(); - if (isset($this->attrs['goTimeSource'])){ - for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){ - $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i]; - } - } - $this->goTimeSource= $tmp; - } - - - function execute() - { - $smarty = get_smarty(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - /* Here we add a new entry */ - if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) { - $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport']; - asort($this->goTimeSource); - } - - /* Deleting an Entry, is a bit more complicated than adding one*/ - if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) { - foreach ($_POST['goTimeSource'] as $entry){ - if (isset($this->goTimeSource[$entry])){ - unset($this->goTimeSource[$entry]); - } - } - } - - $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ; - $smarty->assign("goTimeSource" , $this->goTimeSource); - return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Time service (NTP)"); - $fields['AllowEdit'] = true; - return($fields); - } - - - function save() - { - plugin::save(); - $this->attrs['goTimeSource'] =array(); - foreach($this->goTimeSource as $entry){ - $this->attrs['goTimeSource'][] = $entry; - } - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn)); - if($this->initially_was_account){ - $this->handle_post_events("modify"); - new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - $this->handle_post_events("add"); - new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Time service"), - "plDescription" => _("Time service - NTP")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 91, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "goTimeSource" =>_("Ntp source")) - )); - } - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - - /* Load arrays */ - $tmp = array(); - if (isset($source['goTimeSource'])){ - for ($i= 0; $i<$source['goTimeSource']['count']; $i++){ - $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i]; - } - } - $this->goTimeSource= $tmp; - - - } - - function check(){ return array();} - - function save_object(){;} -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl b/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl deleted file mode 100644 index 25a91d432..000000000 --- a/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl +++ /dev/null @@ -1,32 +0,0 @@ -
-

{t}Time server{/t}

-
- - - - -
-{render acl=$goNtpServerACL} - -{/render} -
-{render acl=$goNtpServerACL} - -{/render} -{render acl=$goNtpServerACL} - -{/render} -{render acl=$goNtpServerACL} - -{/render} -
- -

 

-
- -   - -
diff --git a/gosa-core/plugins/admin/systems/services/repository/class_divListRepositories.inc b/gosa-core/plugins/admin/systems/services/repository/class_divListRepositories.inc deleted file mode 100644 index 6e43dc18c..000000000 --- a/gosa-core/plugins/admin/systems/services/repository/class_divListRepositories.inc +++ /dev/null @@ -1,84 +0,0 @@ -AddCheckBox */ - var $parent ; - var $ui ; - - var $regex ="*"; - - function divListRepository ($config,$parent) - { - MultiSelectWindow::MultiSelectWindow($config,"Repository", "server"); - - $this->parent = $parent; - $this->ui = get_userinfo(); - - $this->SetTitle("repositories"); - $this->SetSummary(_("List of configured repositories.")); - $this->SetInformation(_("This menu allows you to create, delete and edit repository settings.")); - $this->EnableCloseButton(FALSE); - $this->EnableSaveButton(FALSE); - $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'")); - $this->AddHeader(array("string"=>_("Sections"))); - $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'")); - $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE); - $this->EnableAplhabet(TRUE); - } - - function GenHeader() - { - if($this->parent->acl_is_createable()){ - $this->SetListHeader(""); - } - } - - function execute() - { - $this->ClearElementsList(); - $this->GenHeader(); - } - - function setEntries($list) - { - $link = "%s"; - $edit = " "; - - /* Hide delete icon, if delete is not allowed */ - if($this->parent->acl_is_removeable()){ - $delete = ""; - }else{ - $delete = " "; - } - - foreach($list as $name => $reps){ - - $str = " "; - if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){ - foreach($reps['Sections'] as $sec){ - $str.=$sec." "; - } - $this->AddElement(array( - array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"), - array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)), - array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text- align:right;'") - )); - } - } - - } - - function Save() - { - MultiSelectWindow :: Save(); - } - - function save_object() - { - /* Save automatic created POSTs like regex, checkboxes */ - MultiSelectWindow :: save_object(); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc b/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc deleted file mode 100644 index 1c021208b..000000000 --- a/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc +++ /dev/null @@ -1,366 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* attribute list for save action */ - // var $ignore_account = TRUE; - var $attributes = array("FAIrepository"); - var $objectclasses = array("FAIrepositoryServer"); - - /* Repositories */ - var $repositories = array(); - var $FAIrepository = array(); - var $conflicts = array("FAIrepositoryServer"); - var $DisplayName = ""; - var $StatusFlag = ""; - - var $view_logged = FALSE; - var $fai_activated = FALSE; - - var $divlist = NULL; - - function servrepository (&$config, $dn= NULL, $parent= NULL) - { - plugin::plugin ($config, $dn, $parent); - - $this->DisplayName = _("Repository service"); - - /* Skip this if fai is deactivated */ - $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs')); - if(!empty($tmp)){ - $this->fai_activated = TRUE; - }else{ - return; - } - - $this->repositories = array(); - if(isset($this->attrs['FAIrepository'])){ - for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){ - $tmp = split("\|",$this->attrs['FAIrepository'][$i]); - $tmp2 = array(); - $tmp3 = array(); - - if(isset($tmp[1])){ - $tmp2['ParentServer'] = $tmp[1]; - if(empty($tmp[1])){ - $tmp2['ParentServer'] = "none"; - } - }else{ - $tmp2['ParentServer'] = "none"; - } - - if(isset($tmp[0])){ - $tmp2['Url'] = $tmp[0]; - }else{ - $tmp2['Url'] = ""; - } - - if(isset($tmp[2])){ - $tmp2['Release'] = $tmp[2]; - }else{ - $tmp2['Release'] = ""; - } - - if(isset($tmp[3])){ - $tmp3 = split(",",$tmp[3]); - foreach($tmp3 as $sec){ - $tmp2['Sections'][$sec]=$sec; - } - }else{ - $tmp['Section']=array(); - } - - $this->repositories[$tmp[2]]=$tmp2; - } - } - - - /* Create divlist */ - $this->divlist = new divListRepository($this->config,$this); - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - if(!$this->fai_activated){ - $str = "

"._("You can't use this plugin until FAI is activated.")."

"; - return $str; - } - - /* Fill templating stuff */ - $smarty= get_smarty(); - $smarty->assign("is_createable",$this->acl_is_createable()); - $display= ""; - - /* Show tab dialog headers */ - /* - ADD / EDIT Repository - Dialog Handling - */ - $once = false; - if(isset($_POST['servRepository'])){ - foreach($_POST as $name => $value){ - - if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){ - $once = true; - $this->dialog = new servRepositorySetup($this->config,$this->dn); - $this->dialog->parent = $this; - } - - if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){ - $once = true; - $value = preg_replace("/delete_/","",$name); - $value = base64_decode(preg_replace("/_.*$/","",$value)); - - $url = $this->repositories[$value]['Url']; - $release = $this->repositories[$value]['Release']; - - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - - $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass")); - - $found = false; - $found_in = " "; - while($attrs = $ldap->fetch()){ - foreach($attrs['FAIclass'] as $class){ - if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){ - $found = true; - $found_in .= $attrs['cn'][0]." "; - } - } - } - - if($found){ - print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in)); - }else{ - if(isset($this->repositories[$value])){ - unset($this->repositories[$value]); - } - } - } - - if((preg_match("/^edit_/",$name))&&(!$once)){ - $value = preg_replace("/edit_/","",$name); - $value = base64_decode(preg_replace("/_.$/","",$value)); - - if(isset($this->repositories[$value])){ - - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - - $url = $this->repositories[$value]['Url']; - $release = $this->repositories[$value]['Release']; - - $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass")); - - $found = false; - $found_in = " "; - while($attrs = $ldap->fetch()){ - foreach($attrs['FAIclass'] as $class){ - if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){ - $found = true; - $found_in .= $attrs['cn'][0]." "; - } - } - } - - if($found){ - print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in)); - } - - if(isset($this->repositories[$value])){ - $once = true; - $obj = $this->repositories[$value]; - - /* to be able to detect if this was renamed */ - $obj['initialy_was'] = $obj['Release']; - $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj); - $this->dialog->parent = $this; - } - } - } - } - } - if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){ - $obj = $this->repositories[base64_decode($_GET['id'])]; - $obj['initialy_was'] = $obj['Release']; - $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj); - $this->dialog->parent = $this; - } - - if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){ - $this->dialog->save_object(); - if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){ - print_red(_("This name is already in use.")); - }else - - if(count($this->dialog->check())!=0){ - foreach($this->dialog->check() as $msg){ - print_red($msg); - } - }else{ - $obj = $this->dialog->save(); - if($this->dialog->is_new_name()){ - $oldname = $this->dialog->initialy_was; - $this->repositories[$obj['Release']]=$obj; - unset($this->repositories[$oldname]); - }else{ - $this->repositories[$obj['Release']]=$obj; - } - $this->dialog = FALSE; - $this->is_dialog= false; - } - } - - if(isset($_POST['repository_setup_cancel'])){ - $this->dialog=FALSE; - $this->is_dialog = false; - } - - if(is_object($this->dialog)){ - $this->dialog->save_object(); - $this->is_dialog = true; - return($this->dialog->execute()); - } - - /* - Repository setup dialog handling /END - */ - - - $link = "%s"; - $edit = " "; - - /* Hide delete icon, if delete is not allowed */ - if($this->acl_is_removeable()){ - $delete = ""; - }else{ - $delete = " "; - } - - $this->divlist->execute(); - $this->divlist->setEntries($this->repositories); - $smarty->assign("Repositories",$this->divlist->Draw()); - $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE,dirname(__FILE__))); - return($display); - } - - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - if(is_object($this->divlist)){ - $this->divlist->save_object(); - } - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - return ($message); - } - - - /* Save to LDAP */ - function save() - { - if(!$this->fai_activated) return; - - plugin::save(); - - $arr = array(); - foreach($this->repositories as $servername => $conf){ - $str = ""; - foreach($conf['Sections'] as $sec){ - $str.=$sec.","; - } - $str=preg_replace("/,$/","",$str); - - if($conf['ParentServer']=="none"){ - $conf['ParentServer'] =""; - } - - $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str; - } - $this->attrs['FAIrepository'] = $arr; - - $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - - $ldap->cat($this->dn, array('dn')); - - if($ldap->count()){ - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - $this->handle_post_events("modify"); - }else{ - $ldap->cd ($this->config->current['BASE']); - $ldap->create_missing_trees($this->dn); - $ldap->cd($this->dn); - $ldap->add($this->attrs); - $this->handle_post_events("add"); - } - - if($this->initially_was_account){ - new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Repository service"); - $fields['AllowEdit'] = true; - $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false; - return($fields); - } - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Repository"), - "plDescription" => _("Repository service")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 84, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "cn" => _("Name"), - "start" => _("Start"), - "stop" => _("Stop"), - "restart" => _("Restart"), - "Release" => _("Releases"), - "Section" => _("Sections"), - "ParentServer" => _("Parent server"), - "Url" => _("Url")) - )); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc deleted file mode 100644 index a355b190e..000000000 --- a/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc +++ /dev/null @@ -1,225 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* attribute list for save action */ - var $ignore_account = TRUE; - var $attributes = array("Release","ParentServer","Url","cn"); - var $objectclasses = array("whatever"); - - /* Attributes */ - var $Release = ""; - var $ParentServer = ""; - var $Url = ""; - var $Sections = array(); - var $ParentServers = ""; - var $initialy_was = false; - var $cn = ""; - var $parent = ""; - - function servRepositorySetup (&$config, $dn= NULL,$data = false) - { - plugin::plugin ($config, $dn); - if($data != false){ - foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){ - if(isset($data[$atr])){ - $this->$atr = $data[$atr]; - } - } - } - } - - function GetName() - { - return($this->Release); - } - - function is_new_name() - { - if(!$this->initialy_was){ - return(true); - }else{ - if($this->Release != $this->initialy_was){ - return(true); - } - } - return(false); - } - - - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - /* Fill templating stuff */ - $smarty= get_smarty(); - - if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ - - /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ - $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); - - /* check if there are more than one entry given ( "section1 section2 )*/ - if(preg_match("/ /",$val)){ - - /* Generate list of new section names */ - $vals = split(" ",$val); - - /* Add new entries */ - foreach($vals as $entry){ - $entry = trim($entry); - $this->Sections[$entry]=$entry; - } - }else{ - $this->Sections[$val]=$val; - } - } - - foreach($_POST as $name => $value){ - if(preg_match("/^delete_/",$name)){ - - $val = preg_replace("/^delete_/","",$name); - $val = base64_decode(preg_replace("/_.*$/","",$val)); - - if(isset($this->Sections[$val])){ - unset($this->Sections[$val]); - } - } - } - - $divlist = new divSelectBox("servRepositorySetup"); - $divlist->setHeight("220"); - - $dellink = ""; - - foreach($this->Sections as $sec){ - $divlist->AddEntry(array( - array("string"=>$sec), - array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'") - )); - } - - $smarty->assign("Sections",$divlist->DrawList()); - - /* Get && assign acls */ - $tmp = $this->parent->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translated){ - $smarty->assign($name."ACL",$this->parent->getacl($name)); - } - - /* Assign values */ - foreach($this->attributes as $attr){ - $smarty->assign($attr ,$this->$attr); - } - - $tmp = $this->getParentServers(); - $smarty->assign("ParentServers" ,$tmp); - $smarty->assign("ParentServerKeys",array_flip($tmp)); - - return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE,dirname(__FILE__)))); - } - - /* Save data to object */ - function save_object() - { - if(isset($_POST['servRepositorySetup_Posted'])) { - - foreach($this->attributes as $attr){ - if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){ - $this->$attr = $_POST[$attr]; - } - } - } - } - - - /* Check supplied data */ - function check() - { - /* Call common method to give check the hook */ - $message= plugin::check(); - - if(empty($this->Release)){ - $message[]=_("Please enter a value for 'release'."); - } - - if(empty($this->Url)){ - $message[] = _("Please specify a valid value for 'url'."); - } - - return ($message); - } - - - /* Save to LDAP */ - function save() - { - $tmp = array(); - $tmp['ParentServer'] = $this->ParentServer; - $tmp['Url'] = $this->Url; - $tmp['Release'] = $this->Release; - $tmp['Sections'] = $this->Sections; - return($tmp); - } - - function getParentServers() - { - $ret = array(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(objectClass=FAIrepositoryServer)",array("*")); - while($attr = $ldap->fetch()){ - if($attr['cn'][0] == $this->cn) continue; - $ret[$attr['cn'][0]]= $attr['cn'][0]; - } - - $ret = array_merge($ret,$this->GetHookElements()); - - $ret['none']= " "; - asort($ret); - return($ret); - } - - /* this funtions calls a defined hook - and parses all additional serverdata - */ - function GetHookElements() - { - $ret = array(); - $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs')); - if(!empty($cmd)){ - $res = shell_exec($cmd); - $res2 = trim($res); - if(!$res){ - print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd)); - }elseif(empty($res2)){ - print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); - }else{ - $tmp = split("\n",$res); - foreach($tmp as $hook){ - /* skip empty */ - if(empty($hook)) continue; - - if(preg_match("/;/",$hook)){ - $hookinfo = split(";",$hook); - $ret[$hookinfo[0]] = $hookinfo[0]; - }else{ - $ret[$hook] = $hook; - } - } - } - } - return($ret); - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl b/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl deleted file mode 100644 index ca42710c1..000000000 --- a/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{$Repositories} - - -

 

-
- -   - -
diff --git a/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl b/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl deleted file mode 100644 index 29691ec44..000000000 --- a/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl +++ /dev/null @@ -1,58 +0,0 @@ -

 {t}Repository{/t}

- - - - - - -
- - - - - - - - - - - - - -
{t}Parent server{/t} - -{render acl=$ParentServerACL} - -{/render} -
{t}Release{/t} - -{render acl=$ReleaseACL} - -{/render} -
{t}URL{/t} - -{render acl=$UrlACL} - -{/render} -
-
- {t}Sections{/t}
-{render acl=$SectionACL} - {$Sections} -{/render} -{render acl=$SectionACL} - -{/render} -{render acl=$SectionACL} - -{/render} -
- -

- -   - -

- diff --git a/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc b/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc deleted file mode 100644 index 105076c95..000000000 --- a/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc +++ /dev/null @@ -1,409 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goShareServer"); - var $attributes = array("goExportEntry"); - var $StatusFlag = "goShareServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goShareServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $cn = ""; - var $goShareServerStatus = ""; - var $goExportEntry = array(); - var $allow_mounts = false; - var $mounts_to_remove = array(); - var $mounts_to_add = array(); - var $view_logged =FALSE; - - function goShareServer(&$config,$dn) - { - goService::goService($config,$dn); - - $this->DisplayName = _("File service"); - - $tmp =array(); - if(isset($this->attrs['goExportEntry'])){ - if(isset($this->attrs['goExportEntry']['count'])){ - for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){ - $entry= $this->attrs['goExportEntry'][$i]; - $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry; - } - } - } - $this->goExportEntryList = $tmp; - - $ldap = $this->config->get_ldap_link(); - $avl_objectclasses = $ldap->get_objectclasses(); - if (isset($avl_objectclasses["mount"])) { - $this->allow_mounts = true; - } - } - - - function execute() - { - $smarty = get_smarty(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - - if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){ - if($this->allow_mounts){ - foreach($_POST['goExportEntryList'] as $entry){ - $this->deleteFromMountList($this->goExportEntryList[$entry]); - } - } - foreach($_POST['goExportEntryList'] as $entry){ - $this->deleteFromList($entry); - } - } - - if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){ - $this->oldone = NULL; - $this->o_subWindow = new servnfs($this->config, $this); - $this->o_subWindow->set_acl_category("server"); - $this->o_subWindow->set_acl_base($this->dn); - $this->dialog = true; - } - - if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){ - $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]]; - $add_mount=isset($this->mounts_to_add[$entry]); - $this->oldone=$entry; - $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount); - $this->o_subWindow->set_acl_base($this->dn); - $this->o_subWindow->set_acl_category("server"); - $this->dialog = true; - } - if(isset($this->o_subWindow)){ - $this->o_subWindow->save_object(TRUE); - } - - /* Save NFS setup */ - if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){ - if(count($this->o_subWindow->check())>0){ - foreach($this->o_subWindow->check() as $msg) { - print_red($msg); - } - }else{ - $this->o_subWindow->save_object(); - $newone = $this->o_subWindow->save(); - - $this->addToList($newone); - if($this->allow_mounts){ - if($this->oldone != NULL) { - $this->deleteFromMountList($this->oldone); - } - if ($this->o_subWindow->should_create_mount()) { - $this->addToMountList($newone); - } - } - unset($this->o_subWindow); - $this->dialog = false; - } - } - - /* Cancel NFS setup */ - if(isset($_POST['NFScancel'])){ - $this->oldone = NULL; - unset($this->o_subWindow); - $this->dialog = false; - } - - /* Execute NFS setup dialog*/ - if(isset($this->o_subWindow)){ - return $this->o_subWindow->execute(); - } - - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - - /* Set acls */ - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translated){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - $smarty->assign("createable",$this->acl_is_createable()); - $smarty->assign("removeable",$this->acl_is_removeable()); - - $tellSmarty= array(); - ksort($this->goExportEntryList); - foreach($this->goExportEntryList as $name=>$values){ - $tmp = split("\|",$values); - $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")"; - } - $smarty->assign("goExportEntry",array_keys($tellSmarty)); - $smarty->assign("goExportEntryKeys",($tellSmarty)); - return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("File service (Shares)"); - $fields['AllowEdit'] = true; - return($fields); - } - - - function save() - { - plugin::save(); - - /* Arrays */ - foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){ - $this->attrs[$destination]= array(); - foreach ($this->$source as $element){ - $this->attrs[$destination][]= $element; - } - } - - - /* Process netatalk mounts */ - if($this->allow_mounts) { - $this->process_mounts(); - } - - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn)); - if($this->initially_was_account){ - $this->handle_post_events("modify"); - new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - $this->handle_post_events("add"); - new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - } - - - function check() - { - $message = plugin::check(); - return($message); - } - - - function save_object() - { - if(isset($_POST['goShareServerPosted'])){ - plugin::save_object(); - } - } - - function addToList($entry){ - $key = key($entry); - $this->goExportEntryList[$key]=$entry[$key]; - } - - function deleteFromList($id) - { - /* Check if the share is used by someone */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn")); - $cnt= $ldap->count(); - if ($cnt){ - $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt); - $msg.= "

"._("Please correct the share-/profile settings of these users"); - print_red($msg); - - } else { - /* Finally remove it */ - unset($this->goExportEntryList[$id]); - } - } - - function process_mounts() { - - $clip = "cn=" . $this->cn . ",".get_ou('serverou'); - $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip)); - - $mounts = array( - "objectClass" => "container", - "cn" => "mounts" - ); - - # load data from mounts container - $ldap = $this->config->get_ldap_link(); - $ldap->cat($mountsdn, array('dn')); - $attrs = $ldap->fetch(); - - # mounts container not present yet, so we create it - if (count($attrs) == 0) { - $ldap->cd($mountsdn); - $ldap->add($mounts); - show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn)); - new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error()); - } - - # remove deleted mounts from the container - foreach ($this->mounts_to_remove as $entry) { - $mount=$this->returnMountEntry($entry); - $mountdn = "cn=".$mount["cn"].","."$mountsdn"; - - $ldap->cat($mountdn, array('dn')); - $attrs = $ldap->fetch(); - - if (count($attrs) != 0) { - $ldap->rmdir($mountdn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn)); - new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error()); - } - } - - # add new mounts to the container - foreach ($this->mounts_to_add as $entry) { - $mount=$this->returnMountEntry($entry); - $mountdn = "cn=".$mount["cn"].","."$mountsdn"; - $ldap->cd($mountdn); - $ldap->add($mount); - show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn)); - new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error()); - } - } - - function addToMountList($entry) - { - if($this->acl_is_writeable("name")){ - $key = key($entry); - $type = $this->get_share_type($entry[$key]); - if (($type == "netatalk") || ($type == "NFS")) { - $this->mounts_to_add[$entry[$key]] = $entry[$key]; - unset($this->mounts_to_remove[$entry[$key]]); - } - } - } - - function deleteFromMountList($entry) - { - if($this->acl_is_writeable("name")){ - $type = $this->get_share_type($entry); - if (($type == "netatalk") || ($type == "NFS")) { - $this->mounts_to_remove[$entry] = $entry; - unset($this->mounts_to_add[$entry]); - } - } - } - - function get_share_type($share) - { - $tmp = split("\|", $share); - return $tmp[2]; - } - - function returnMountEntry($entry) - { - $item = split("\|", $entry); - $name = $item[0]; - $description = $item[1]; - $type = $item[2]; - $charset = $item[3]; - $path = $item[4]; - $options = $item[5]; - - switch ($type) { - case "netatalk" : { - $mount = array( - "mountDirectory" => "/Network/Servers/", - "mountOption" => array( - "net", - "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/" - ), - "mountType" => "url", - "objectClass" => "mount", - "cn" => $this->cn .":/".$name - ); - break; - } - case "NFS" : { - $mount = array( - "mountDirectory" => "/Network/Servers/", - "mountOption" => "net", - "mountType" => "nfs", - "objectClass" => "mount", - "cn" => $this->cn .":".$path - ); - break; - } - default : { - continue; - } - } - return $mount; - } - - - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - - $tmp =array(); - if(isset($source['goExportEntry'])){ - if(isset($source['goExportEntry']['count'])){ - for($i= 0; $i<$source['goExportEntry']['count']; $i++){ - $entry= $source['goExportEntry'][$i]; - $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry; - } - } - } - $this->goExportEntryList = $tmp; - $this->goExportEntry = $tmp; - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("File service (Shares)"), - "plDescription" => _("File service - Shares")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 90, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "name" => _("Name"), - "netatalkmount" => _("Apple mounts"), - "description" => _("Description"), - "type" => _("Type"), - "charset" => _("Charset"), - "path" => _("Path"), - "option" => _("Option"), - "volume" => _("Volume")) - - )); - } - - -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl b/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl deleted file mode 100644 index 2c645c7f4..000000000 --- a/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl +++ /dev/null @@ -1,33 +0,0 @@ -

{t}Shares{/t}

- - - - -
-{render acl=$nameACL mode=read_active} - -{/render} -
- -{render acl=$nameACL} - -{/render} -{render acl=$nameACL mode=read_active} - -{/render} -{render acl=$nameACL} - -{/render} -
- - -

 

-
- -   - -
- diff --git a/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc b/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc deleted file mode 100644 index 3a193dbf2..000000000 --- a/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc +++ /dev/null @@ -1,106 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goLogDBServer"); - var $attributes = array("goLogAdmin", "goLogPassword"); - var $StatusFlag = "goLogDBServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goLogDBServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $acl; - var $cn = ""; - var $goLogDBServerStatus = ""; - var $goLogAdmin = ""; - var $goLogPassword = ""; - var $view_logged =FALSE; - - - function goLogDBServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("Syslog service database"); - } - - - function execute() - { - $smarty = get_smarty(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - $tmp = $this->plInfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Syslog service database"); - $fields['AllowEdit'] = true; - return($fields); - } - - - function check() - { - $message = plugin::check(); - if (empty($this->goLogAdmin)){ - $message[]= sprintf_("The attribute user is empty or contains invalid characters."); - } - if (empty($this->goLogPassword)){ - $message[]= sprintf_("The attribute password is empty or contains invalid characters."); - } - return($message); - } - - - function save_object() - { - if(isset($_POST['goLogDBServerPosted'])){ - plugin::save_object(); - } - } - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Logging database"), - "plDescription" => _("Logging database")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 97, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "start" => _("Start"), - "stop" => _("Stop"), - "restart" => _("Restart"), - "goLogAdmin" => _("Admin"), - "goLogPassword" => _("Password")) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc b/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc deleted file mode 100644 index 9461977e2..000000000 --- a/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc +++ /dev/null @@ -1,83 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goSyslogServer"); - var $attributes = array(); - var $StatusFlag = "goSyslogServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goSyslogServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $acl; - var $cn = ""; - var $goSyslogServerStatus = ""; - var $view_logged =FALSE; - - function goSyslogServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("Syslog server"); - } - - - function execute() - { - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - - $smarty = get_smarty(); - return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Syslog server"); - $fields['AllowEdit'] = false; - return($fields); - } - - function check() - { - $message = plugin::check(); - return($message); - } - - - function save_object() - { - plugin::save_object(); - } - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Logging service"), - "plDescription" => _("Logging service")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 88, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array() - )); - } - - -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl b/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl deleted file mode 100644 index 839507029..000000000 --- a/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl +++ /dev/null @@ -1,27 +0,0 @@ -

{t}Logging database information{/t}

- - - - - - - - - -
{t}Logging DB user{/t}{$must} -{render acl=$goLogAdminACL} - -{/render} -
{t}Password{/t}{$must} -{render acl=$goLogPasswordACL} - -{/render} -
- -

 

-
- -   - -
- diff --git a/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl b/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl deleted file mode 100644 index a7ed661a8..000000000 --- a/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl +++ /dev/null @@ -1,9 +0,0 @@ -

{t}Syslog Service{/t} {t}enabled{/t}

- -

 

-
- -   - -
- diff --git a/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc b/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc deleted file mode 100644 index e832de04c..000000000 --- a/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc +++ /dev/null @@ -1,141 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* This plugin only writes its objectClass */ - var $objectclasses = array("goTerminalServer"); - var $attributes = array("goXdmcpIsEnabled", "goFontPath"); - var $StatusFlag = "goTerminalServerStatus"; - - /* This class can't be assigned twice so it conflicts with itsself */ - var $conflicts = array("goTerminalServer"); - - var $DisplayName = ""; - var $dn = NULL; - var $acl; - var $cn = ""; - var $goTerminalServerStatus = ""; - var $goXdmcpIsEnabled = false; - var $goFontPath = ""; - var $view_logged =FALSE; - - - function goTerminalServer(&$config,$dn) - { - goService::goService($config,$dn); - $this->DisplayName = _("Terminal service"); - } - - - function execute() - { - $smarty = get_smarty(); - - if($this->is_account && !$this->view_logged){ - $this->view_logged = TRUE; - new log("view","server/".get_class($this),$this->dn); - } - - - $tmp = $this->plinfo(); - foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); - } - - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__)))); - } - - - function getListEntry() - { - $fields = goService::getListEntry(); - $fields['Message'] = _("Terminal service"); - $fields['AllowEdit'] = true; - return($fields); - } - - - function save() - { - plugin::save(); - - if(!$this->goXdmcpIsEnabled){ - $this->attrs['goXdmcpIsEnabled'] = "0"; - } - - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn)); - if($this->initially_was_account){ - $this->handle_post_events("modify"); - new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - }else{ - $this->handle_post_events("add"); - new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - } - } - - - function check() - { - $message = plugin::check(); - if(empty($this->goFontPath)){ - $message[]=_("Terminal server, must have fontpath specified."); - } - - return($message); - } - - - function save_object() - { - if(isset($_POST['goTerminalServerPosted'])){ - plugin::save_object(); - if($this->acl_is_writeable("goXdmcpIsEnabled")){ - if(isset($_POST['goXdmcpIsEnabled'])){ - $this->goXdmcpIsEnabled = true; - }else{ - $this->goXdmcpIsEnabled = false; - } - } - } - } - - - /* Return plugin informations for acl handling */ - static function plInfo() - { - return (array( - "plShortName" => _("Terminal service"), - "plDescription" => _("Terminal service")." ("._("Services").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 87, - "plSection" => array("administration"), - "plCategory" => array("server"), - - "plProvidedAcls"=> array( - "goXdmcpIsEnabled" => _("Temporary disable login"), - "goFontPath" => _("Font path")) - )); - } - - -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl b/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl deleted file mode 100644 index 5fca2091f..000000000 --- a/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl +++ /dev/null @@ -1,27 +0,0 @@ -

{t}Terminal service{/t}

- - - - - - - - -
-{render acl=$goXdmcpIsEnabledACL} - -{/render} - {t}Temporary disable login{/t} -
{t}Font path{/t} -{render acl=$goXdmcpIsEnabledACL} - -{/render} -
- -

 

-
- -   - -
- diff --git a/gosa-plugins/goto/admin/systems/services/cups/class_goCupsServer.inc b/gosa-plugins/goto/admin/systems/services/cups/class_goCupsServer.inc new file mode 100644 index 000000000..6fa572b9d --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/cups/class_goCupsServer.inc @@ -0,0 +1,85 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goCupsServer"); + var $attributes = array(); + var $StatusFlag = "goCupsServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goCupsServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $acl; + var $cn = ""; + var $goCupsServerStatus = ""; + var $view_logged =FALSE; + + function goCupsServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Print service"); + } + + + function execute() + { + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + $smarty = get_smarty(); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__)))); + } + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Print service"); + $fields['AllowEdit'] = false; + return($fields); + } + + function check() + { + $message = plugin::check(); + return($message); + } + + function save_object() + { + plugin::save_object(); + } + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Cups"), + "plDescription" => _("Print service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 100, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "start" => _("Start"), + "stop" => _("Stop"), + "restart" => _("Restart"), + + "plProvidedAcls"=> array() + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/cups/goCupsServer.tpl b/gosa-plugins/goto/admin/systems/services/cups/goCupsServer.tpl new file mode 100644 index 000000000..e10bd2f67 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/cups/goCupsServer.tpl @@ -0,0 +1,9 @@ +

{t}Print Service{/t} {t}enabled{/t}

+ +

 

+
+ +   + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc new file mode 100644 index 000000000..287ed9e36 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc @@ -0,0 +1,245 @@ +DisplayName = _("Kiosk profile service"); + $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs')); + $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path); + + /* Load list of profiles and check if they still exists */ + if ($this->baseDir == ""){ + print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!")); + }else{ + $this->gotoKioskProfiles = array(); + if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){ + for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){ + $url = $this->attrs['gotoKioskProfile'][$i]; + $this->server_path = preg_replace("/\/[^\/]*$/","",$url); + $name= preg_replace("/^.*\//","",$url); + $this->gotoKioskProfiles[] = array('url' => $url , + 'name' => $name , + 'initial' =>TRUE, + 'exists' => file_exists($this->baseDir."/".$name)); + } + } + } + } + + + function remove_from_parent() + { + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn")); + $str =""; + $cnt = 3; + while($cnt && $attrs = $ldap->fetch()){ + $str .= $attrs['cn'][0].", "; + $cnt --; + } + $str = preg_replace("/, $/","",$str); + if($cnt != 3){ + print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str)); + }else{ + goService::remove_from_parent(); + } + } + + + function execute() + { + /* log actions */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + /* Fill templating stuff */ + $smarty= get_smarty(); + $display= ""; + + /* Add new kiosk profile + * in profile directory ($this->baseDir); + */ + if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){ + $file = $_FILES['newProfile']; + if(!file_exists($this->baseDir.$file['name'])){ + $tmp = array( + 'url' => "" , + 'name' => $file['name'] , + 'initial' => FALSE, + 'tmp_name'=> $file['tmp_name'], + 'content' => file_get_contents($file['tmp_name']), + 'exists' => TRUE); + $this->gotoKioskProfiles[] = $tmp; + } + if(!is_writeable($this->baseDir)){ + print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir)); + } + } + + $only_once = true; + foreach($_POST as $name => $value){ + + if((preg_match("/^delkiosk_/",$name))&&($only_once)){ + + /* Get id, name and path */ + $only_once = false; + $id = preg_replace("/^delkiosk_/","",$name); + $id = preg_replace("/_.*$/","",$id); + $name = $this->gotoKioskProfiles[$id]['name']; + $filename = $this->baseDir."/".$name; + + /* check if profile is still in use */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile")); + $used_by = ""; + $cnt = 3; + while(($attrs = $ldap->fetch()) && ($cnt)){ + $cnt --; + $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]); + if($check == $name){ + $used_by .= $attrs['cn'][0].", "; + } + } + $used_by = preg_replace("/, $/","",$used_by); + if(!empty($used_by)){ + print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by)); + }else{ + if($this->gotoKioskProfiles[$id]['initial']){ + $res = @unlink($filename); + if(!$res){ + if(!is_writeable($filename)){ + print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename)); + } + if(!file_exists($filename)){ + print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename)); + } + } + unset($this->gotoKioskProfiles[$id]); + } + } + } + } + + /* Display list of profiles */ + $divlist = new divSelectBox("KioskProfiles"); + $divlist -> SetHeight (300); + foreach($this->gotoKioskProfiles as $key => $val ){ + $divlist->AddEntry(array( + array("string"=>"".$val['name'].""), + array("string"=>"" , + "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ") + )); + } + + /* Assign all existing profiles to smarty */ + $smarty->assign("divlist",$divlist->DrawList()); + $smarty = get_smarty(); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + $smarty->assign("server_path",$this->server_path); + return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__)))); + } + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Kiosk profile service"); + $fields['AllowEdit'] = TRUE; + $fields['AllowStart'] = false; + $fields['AllowStop'] = false; + $fields['AllowRestart'] = false; + return($fields); + } + + function check() + { + $message = plugin::check(); + return($message); + } + + function save() + { + goService::save(); + + $method = $this->server_path."/"; + $method = preg_replace("/\/\/*$/","/",$method); + $this->attrs['gotoKioskProfile'] = array(); + foreach($this->gotoKioskProfiles as $profile){ + if(!$profile['initial']){ + + $contents = $profile['content']; + $path = $this->baseDir."/".$profile['name']; + $fp = @fopen($path,"w"); + if(!$fp){ + print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path); + }else{ + fwrite($fp,$contents,strlen($contents)); + $this->attrs['gotoKioskProfile'][] = $method.$profile['name']; + } + @unlink($profile['tmp_name']); + }else{ + $this->attrs['gotoKioskProfile'][] = $method.$profile['name']; + } + } + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error(),_("Wohl kaum")); + } + + + function save_object() + { + if(isset($_POST['goKioskPosted'])){ + goService::save_object(); + if(isset($_POST['server_path'])){ + $this->server_path = get_post("server_path"); + } + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Kiosk"), + "plDescription" => _("Kiosk profile management")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 100, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array() + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/kiosk/goKioskService.tpl b/gosa-plugins/goto/admin/systems/services/kiosk/goKioskService.tpl new file mode 100644 index 000000000..f81230464 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/kiosk/goKioskService.tpl @@ -0,0 +1,24 @@ +

 

+ + + +{t}Server path{/t}  +
+
+{$divlist} + + + +

 

+
+ +   + +
+ + + diff --git a/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc new file mode 100644 index 000000000..c16df0387 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc @@ -0,0 +1,97 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goLdapServer"); + var $attributes = array("goLdapBase"); + var $StatusFlag = "goLdapServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goLdapServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $cn = ""; + var $goLdapServerStatus = ""; + var $goLdapBase = ""; + var $view_logged =FALSE; + + function goLdapServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("LDAP service"); + } + + + function execute() + { + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + $smarty = get_smarty(); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("LDAP Service"); + $fields['AllowEdit'] = true; + return($fields); + } + + + + function check() + { + $message = plugin::check(); + if(empty($this->goLdapBase)){ + $message[] = _("The given base is empty or contains invalid characters."); + } + return($message); + } + + + function save_object() + { + if(isset($_POST['goLdapServerPosted'])){ + plugin::save_object(); + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Ldap"), + "plDescription" => _("Ldap")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 96, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "goLdapBase" => _("Ldap base")) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/ldap/goLdapServer.tpl b/gosa-plugins/goto/admin/systems/services/ldap/goLdapServer.tpl new file mode 100644 index 000000000..24e181771 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/ldap/goLdapServer.tpl @@ -0,0 +1,13 @@ +

{t}LDAP service{/t}

+{t}LDAP URI{/t}{$must} +{render acl=$goLdapBaseACL} + +{/render} + +

 

+
+ +   + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc b/gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc new file mode 100644 index 000000000..575686627 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc @@ -0,0 +1,267 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account = TRUE; + var $attributes = array("description","type","charset","path","option", "volume"); + var $objectclasses = array("whatever"); + var $is_account = true; + + var $name =""; // Name of + var $description =""; // description + var $type =""; // Type FS/Samba/NCP + var $charset =""; // charset + var $host =""; // hostname + var $types =array(); // Array Types NFS/Samba/NCP/netatalk + var $charsets =array(); // Array with charsets + var $path =""; // Path + var $volume =""; // Volume + var $option =""; // Options + var $is_edit =false; + var $create_mount_init = false; //mount entry set for this entry (while editing)? + var $create_mount = false; //save mount entry + + var $parent = NULL; + var $view_logged = FALSE; + + function servnfs (&$config, $parent,$entry= false,$mount =false) + { + $this->parent = $parent; + $dn = $parent->dn; + plugin::plugin ($config, $dn); + + $this->types = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP"); + if($dn){ + $this->host = substr($dn, 3, strpos($dn, ',')-3); + } + + $this->charsets = array(); + + if(!file_exists(CONFIG_DIR."/encodings")){ + print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR)); + }else{ + if(!is_readable(CONFIG_DIR."/encodings")){ + print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR)); + }else{ + $fp = fopen(CONFIG_DIR."/encodings","r"); + $i = 100; + while(!feof($fp)&&$i){ + $i -- ; + $str = trim(fgets($fp,256)); + + /* Skip comments */ + if(!preg_match("/^#/",$str)){ + $arr = split("\=",$str); + if(count($arr)==2){ + $this->charsets[$arr[0]]=$arr[1]; + } + } + } + } + } + + if($entry){ + list($this->name, $this->description, $this->type, $this->charset, + $this->path, $this->option, $this->volume)= split("\|",$entry."|"); + $this->is_edit = true; + + }else{ + $this->attributes[] = "name"; + } + + + $this->create_mount_init = $mount; + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + /* Fill templating stuff */ + $smarty= get_smarty(); + + $smarty->assign("charsets" ,$this->charsets); + $smarty->assign("types" ,$this->types); + + /* attrs to smarty*/ + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + + $tmp = $this->parent->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->parent->getacl($name)); + } + + $smarty->assign("name",$this->name); + if($this->is_edit){ + $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name"))); + } + $smarty->assign("allow_mounts", $this->parent->allow_mounts); + $smarty->assign("mount_checked", ""); + + $smarty->assign("appleMountsACL", $this->getacl("appleMounts")); + + if (($this->type == "netatalk") || ($this->type == "NFS")) { + if ($this->create_mount_init) { + $smarty->assign("mount_checked", "checked"); + } else { + $tmp = split(",", $this->dn); + $clip = $tmp[0] . ",".get_ou('serverou'); + $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip)); + switch ($this->type) { + case "netatalk" : { + $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn; + break; + } + case "NFS" : { + $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn; + break; + } + default : { + continue; + } + } + $ldap = $this->config->get_ldap_link(); + $ldap->cat($mountdn, array('dn')); + $attrs = $ldap->fetch(); + if (count($attrs) > 0) { + $smarty->assign("mount_checked", "checked"); + } + } + } + + $display= $smarty->fetch(get_template_path('servnfs.tpl', TRUE)); + return($display); + } + + function remove_from_parent() + { + /* This cannot be removed... */ + } + + + /* Save data to object */ + function save_object() + { + if(isset($_POST['servnfs_posted'])){ + + foreach($this->attributes as $name){ + if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){ + $this->$name = $_POST[$name]; + } + } + + if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) { + $this->create_mount = true; + } else { + $this->create_mount = false; + } + } + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + // fixme : a check for the path ? ? + if(empty($this->path)){ + $message[]=_("Please specify a valid path for your setup."); + } + + // only 0-9a-z + if(!$this->is_edit){ + if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){ + $message[]=_("Please specify a valid name for your share."); + } + if(empty($this->name)){ + $message[]=_("Please specify a name for your share."); + } + } + + if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){ + $message[]=_("Description contains invalid characters."); + } + + if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){ + $message[]=_("Volume contains invalid characters."); + } + + if(preg_match("/\|/",$this->path)){ + $message[]=_("Path contains invalid characters."); + } + + if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){ + $message[]=_("Option contains invalid characters."); + } + + /* remove a / at the end of the path, we neither need it there nor + * do we want to check for it later. + */ + if(substr($this->path, -1, 1) == '/') { + $this->path=substr($this->path, 0, -1); + } + + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=goShareServer)", array("goExportEntry")); + while($test = $ldap->fetch()){ + if($test['dn']==$this->dn) + continue; + if(isset($test['goExportEntry'])){ + foreach($test['goExportEntry'] as $entry){ + $tmp = split("\|",$entry); + if($tmp[0] == $this->name){ + $message[]="Name already in use"; + } + } + } + } + return ($message); + } + + + /* Save to LDAP */ + function save() + { + /* Everything seems perfect, lets + generate an new export Entry + */ + + $s_return = ""; + + $s_return.= $this->name."|"; + $s_return.= $this->description."|"; + $s_return.= $this->type."|"; + $s_return.= $this->charset."|"; + $s_return.= $this->path."|"; + $s_return.= $this->option."|"; + $s_return.= $this->volume; + + return(array($this->name=>$s_return)); + } + + function should_create_mount() { + return $this->create_mount; + } + + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/nfs/servnfs.tpl b/gosa-plugins/goto/admin/systems/services/nfs/servnfs.tpl new file mode 100644 index 000000000..9fb70a5f4 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/nfs/servnfs.tpl @@ -0,0 +1,144 @@ +

 {t}Edit share{/t}

+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ {t}Name{/t} {$must} + +{render acl=$nameACL} + +{/render} +
+ {t}Description{/t} + +{render acl=$descriptionACL} + +{/render} +
+ {t}Path{/t} / {t}Volume{/t} + +{render acl=$pathACL} + +{/render} +
+
{t}Server{/t}
+
+{render acl=$volumeACL} + +{/render} +
+
+ + + + + + + + + + + + + + + +
+ + {t}Type{/t} + +{render acl=$typeACL} + +{/render} + {if $allow_mounts == TRUE} +

+{render acl=$netatalkmountACL} + +{/render} + +
+
+ {/if} + + {literal} + + {/literal} +
+ {t}Codepage{/t} + +{render acl=$charsetACL} + +{/render} +
+ {t}Option{/t} + +{render acl=$optionACL} + +{/render} +
+
+

 

+
+ + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/ntp/class_goNtpServer.inc b/gosa-plugins/goto/admin/systems/services/ntp/class_goNtpServer.inc new file mode 100644 index 000000000..b179ae95b --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/ntp/class_goNtpServer.inc @@ -0,0 +1,147 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goNtpServer"); + var $attributes = array("goTimeSource"); + var $StatusFlag = "goNtpServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goNtpServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $goTimeSource = array(); + var $goNtpServerStatus= ""; + var $acl; + var $cn = ""; + var $view_logged =FALSE; + + function goNtpServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Time service (NTP)"); + + /* Load arrays */ + $tmp = array(); + if (isset($this->attrs['goTimeSource'])){ + for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){ + $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i]; + } + } + $this->goTimeSource= $tmp; + } + + + function execute() + { + $smarty = get_smarty(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + /* Here we add a new entry */ + if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) { + $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport']; + asort($this->goTimeSource); + } + + /* Deleting an Entry, is a bit more complicated than adding one*/ + if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) { + foreach ($_POST['goTimeSource'] as $entry){ + if (isset($this->goTimeSource[$entry])){ + unset($this->goTimeSource[$entry]); + } + } + } + + $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ; + $smarty->assign("goTimeSource" , $this->goTimeSource); + return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Time service (NTP)"); + $fields['AllowEdit'] = true; + return($fields); + } + + + function save() + { + plugin::save(); + $this->attrs['goTimeSource'] =array(); + foreach($this->goTimeSource as $entry){ + $this->attrs['goTimeSource'][] = $entry; + } + /* Check if this is a new entry ... add/modify */ + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + }else{ + $ldap->cd($this->dn); + $ldap->add($this->attrs); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn)); + if($this->initially_was_account){ + $this->handle_post_events("modify"); + new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + $this->handle_post_events("add"); + new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Time service"), + "plDescription" => _("Time service - NTP")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 91, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "goTimeSource" =>_("Ntp source")) + )); + } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Load arrays */ + $tmp = array(); + if (isset($source['goTimeSource'])){ + for ($i= 0; $i<$source['goTimeSource']['count']; $i++){ + $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i]; + } + } + $this->goTimeSource= $tmp; + + + } + + function check(){ return array();} + + function save_object(){;} +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/ntp/goNtpServer.tpl b/gosa-plugins/goto/admin/systems/services/ntp/goNtpServer.tpl new file mode 100644 index 000000000..25a91d432 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/ntp/goNtpServer.tpl @@ -0,0 +1,32 @@ +
+

{t}Time server{/t}

+
+ + + + +
+{render acl=$goNtpServerACL} + +{/render} +
+{render acl=$goNtpServerACL} + +{/render} +{render acl=$goNtpServerACL} + +{/render} +{render acl=$goNtpServerACL} + +{/render} +
+ +

 

+
+ +   + +
diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_divListRepositories.inc b/gosa-plugins/goto/admin/systems/services/repository/class_divListRepositories.inc new file mode 100644 index 000000000..6e43dc18c --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/repository/class_divListRepositories.inc @@ -0,0 +1,84 @@ +AddCheckBox */ + var $parent ; + var $ui ; + + var $regex ="*"; + + function divListRepository ($config,$parent) + { + MultiSelectWindow::MultiSelectWindow($config,"Repository", "server"); + + $this->parent = $parent; + $this->ui = get_userinfo(); + + $this->SetTitle("repositories"); + $this->SetSummary(_("List of configured repositories.")); + $this->SetInformation(_("This menu allows you to create, delete and edit repository settings.")); + $this->EnableCloseButton(FALSE); + $this->EnableSaveButton(FALSE); + $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'")); + $this->AddHeader(array("string"=>_("Sections"))); + $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'")); + $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE); + $this->EnableAplhabet(TRUE); + } + + function GenHeader() + { + if($this->parent->acl_is_createable()){ + $this->SetListHeader(""); + } + } + + function execute() + { + $this->ClearElementsList(); + $this->GenHeader(); + } + + function setEntries($list) + { + $link = "%s"; + $edit = " "; + + /* Hide delete icon, if delete is not allowed */ + if($this->parent->acl_is_removeable()){ + $delete = ""; + }else{ + $delete = " "; + } + + foreach($list as $name => $reps){ + + $str = " "; + if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){ + foreach($reps['Sections'] as $sec){ + $str.=$sec." "; + } + $this->AddElement(array( + array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"), + array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)), + array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text- align:right;'") + )); + } + } + + } + + function Save() + { + MultiSelectWindow :: Save(); + } + + function save_object() + { + /* Save automatic created POSTs like regex, checkboxes */ + MultiSelectWindow :: save_object(); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc b/gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc new file mode 100644 index 000000000..1c021208b --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc @@ -0,0 +1,366 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + // var $ignore_account = TRUE; + var $attributes = array("FAIrepository"); + var $objectclasses = array("FAIrepositoryServer"); + + /* Repositories */ + var $repositories = array(); + var $FAIrepository = array(); + var $conflicts = array("FAIrepositoryServer"); + var $DisplayName = ""; + var $StatusFlag = ""; + + var $view_logged = FALSE; + var $fai_activated = FALSE; + + var $divlist = NULL; + + function servrepository (&$config, $dn= NULL, $parent= NULL) + { + plugin::plugin ($config, $dn, $parent); + + $this->DisplayName = _("Repository service"); + + /* Skip this if fai is deactivated */ + $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs')); + if(!empty($tmp)){ + $this->fai_activated = TRUE; + }else{ + return; + } + + $this->repositories = array(); + if(isset($this->attrs['FAIrepository'])){ + for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){ + $tmp = split("\|",$this->attrs['FAIrepository'][$i]); + $tmp2 = array(); + $tmp3 = array(); + + if(isset($tmp[1])){ + $tmp2['ParentServer'] = $tmp[1]; + if(empty($tmp[1])){ + $tmp2['ParentServer'] = "none"; + } + }else{ + $tmp2['ParentServer'] = "none"; + } + + if(isset($tmp[0])){ + $tmp2['Url'] = $tmp[0]; + }else{ + $tmp2['Url'] = ""; + } + + if(isset($tmp[2])){ + $tmp2['Release'] = $tmp[2]; + }else{ + $tmp2['Release'] = ""; + } + + if(isset($tmp[3])){ + $tmp3 = split(",",$tmp[3]); + foreach($tmp3 as $sec){ + $tmp2['Sections'][$sec]=$sec; + } + }else{ + $tmp['Section']=array(); + } + + $this->repositories[$tmp[2]]=$tmp2; + } + } + + + /* Create divlist */ + $this->divlist = new divListRepository($this->config,$this); + } + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + if(!$this->fai_activated){ + $str = "

"._("You can't use this plugin until FAI is activated.")."

"; + return $str; + } + + /* Fill templating stuff */ + $smarty= get_smarty(); + $smarty->assign("is_createable",$this->acl_is_createable()); + $display= ""; + + /* Show tab dialog headers */ + /* + ADD / EDIT Repository + Dialog Handling + */ + $once = false; + if(isset($_POST['servRepository'])){ + foreach($_POST as $name => $value){ + + if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){ + $once = true; + $this->dialog = new servRepositorySetup($this->config,$this->dn); + $this->dialog->parent = $this; + } + + if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){ + $once = true; + $value = preg_replace("/delete_/","",$name); + $value = base64_decode(preg_replace("/_.*$/","",$value)); + + $url = $this->repositories[$value]['Url']; + $release = $this->repositories[$value]['Release']; + + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + + $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass")); + + $found = false; + $found_in = " "; + while($attrs = $ldap->fetch()){ + foreach($attrs['FAIclass'] as $class){ + if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){ + $found = true; + $found_in .= $attrs['cn'][0]." "; + } + } + } + + if($found){ + print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in)); + }else{ + if(isset($this->repositories[$value])){ + unset($this->repositories[$value]); + } + } + } + + if((preg_match("/^edit_/",$name))&&(!$once)){ + $value = preg_replace("/edit_/","",$name); + $value = base64_decode(preg_replace("/_.$/","",$value)); + + if(isset($this->repositories[$value])){ + + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + + $url = $this->repositories[$value]['Url']; + $release = $this->repositories[$value]['Release']; + + $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass")); + + $found = false; + $found_in = " "; + while($attrs = $ldap->fetch()){ + foreach($attrs['FAIclass'] as $class){ + if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){ + $found = true; + $found_in .= $attrs['cn'][0]." "; + } + } + } + + if($found){ + print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in)); + } + + if(isset($this->repositories[$value])){ + $once = true; + $obj = $this->repositories[$value]; + + /* to be able to detect if this was renamed */ + $obj['initialy_was'] = $obj['Release']; + $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj); + $this->dialog->parent = $this; + } + } + } + } + } + if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){ + $obj = $this->repositories[base64_decode($_GET['id'])]; + $obj['initialy_was'] = $obj['Release']; + $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj); + $this->dialog->parent = $this; + } + + if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){ + $this->dialog->save_object(); + if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){ + print_red(_("This name is already in use.")); + }else + + if(count($this->dialog->check())!=0){ + foreach($this->dialog->check() as $msg){ + print_red($msg); + } + }else{ + $obj = $this->dialog->save(); + if($this->dialog->is_new_name()){ + $oldname = $this->dialog->initialy_was; + $this->repositories[$obj['Release']]=$obj; + unset($this->repositories[$oldname]); + }else{ + $this->repositories[$obj['Release']]=$obj; + } + $this->dialog = FALSE; + $this->is_dialog= false; + } + } + + if(isset($_POST['repository_setup_cancel'])){ + $this->dialog=FALSE; + $this->is_dialog = false; + } + + if(is_object($this->dialog)){ + $this->dialog->save_object(); + $this->is_dialog = true; + return($this->dialog->execute()); + } + + /* + Repository setup dialog handling /END + */ + + + $link = "%s"; + $edit = " "; + + /* Hide delete icon, if delete is not allowed */ + if($this->acl_is_removeable()){ + $delete = ""; + }else{ + $delete = " "; + } + + $this->divlist->execute(); + $this->divlist->setEntries($this->repositories); + $smarty->assign("Repositories",$this->divlist->Draw()); + $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE,dirname(__FILE__))); + return($display); + } + + + /* Save data to object */ + function save_object() + { + plugin::save_object(); + if(is_object($this->divlist)){ + $this->divlist->save_object(); + } + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); + } + + + /* Save to LDAP */ + function save() + { + if(!$this->fai_activated) return; + + plugin::save(); + + $arr = array(); + foreach($this->repositories as $servername => $conf){ + $str = ""; + foreach($conf['Sections'] as $sec){ + $str.=$sec.","; + } + $str=preg_replace("/,$/","",$str); + + if($conf['ParentServer']=="none"){ + $conf['ParentServer'] =""; + } + + $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str; + } + $this->attrs['FAIrepository'] = $arr; + + $ldap= $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + + $ldap->cat($this->dn, array('dn')); + + if($ldap->count()){ + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); + + $this->handle_post_events("modify"); + }else{ + $ldap->cd ($this->config->current['BASE']); + $ldap->create_missing_trees($this->dn); + $ldap->cd($this->dn); + $ldap->add($this->attrs); + $this->handle_post_events("add"); + } + + if($this->initially_was_account){ + new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Repository service"); + $fields['AllowEdit'] = true; + $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false; + return($fields); + } + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Repository"), + "plDescription" => _("Repository service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 84, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "cn" => _("Name"), + "start" => _("Start"), + "stop" => _("Stop"), + "restart" => _("Restart"), + "Release" => _("Releases"), + "Section" => _("Sections"), + "ParentServer" => _("Parent server"), + "Url" => _("Url")) + )); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-plugins/goto/admin/systems/services/repository/class_servRepositorySetup.inc new file mode 100644 index 000000000..a355b190e --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/repository/class_servRepositorySetup.inc @@ -0,0 +1,225 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account = TRUE; + var $attributes = array("Release","ParentServer","Url","cn"); + var $objectclasses = array("whatever"); + + /* Attributes */ + var $Release = ""; + var $ParentServer = ""; + var $Url = ""; + var $Sections = array(); + var $ParentServers = ""; + var $initialy_was = false; + var $cn = ""; + var $parent = ""; + + function servRepositorySetup (&$config, $dn= NULL,$data = false) + { + plugin::plugin ($config, $dn); + if($data != false){ + foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){ + if(isset($data[$atr])){ + $this->$atr = $data[$atr]; + } + } + } + } + + function GetName() + { + return($this->Release); + } + + function is_new_name() + { + if(!$this->initialy_was){ + return(true); + }else{ + if($this->Release != $this->initialy_was){ + return(true); + } + } + return(false); + } + + + + function execute() + { + /* Call parent execute */ + plugin::execute(); + + /* Fill templating stuff */ + $smarty= get_smarty(); + + if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ + + /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ + $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); + + /* check if there are more than one entry given ( "section1 section2 )*/ + if(preg_match("/ /",$val)){ + + /* Generate list of new section names */ + $vals = split(" ",$val); + + /* Add new entries */ + foreach($vals as $entry){ + $entry = trim($entry); + $this->Sections[$entry]=$entry; + } + }else{ + $this->Sections[$val]=$val; + } + } + + foreach($_POST as $name => $value){ + if(preg_match("/^delete_/",$name)){ + + $val = preg_replace("/^delete_/","",$name); + $val = base64_decode(preg_replace("/_.*$/","",$val)); + + if(isset($this->Sections[$val])){ + unset($this->Sections[$val]); + } + } + } + + $divlist = new divSelectBox("servRepositorySetup"); + $divlist->setHeight("220"); + + $dellink = ""; + + foreach($this->Sections as $sec){ + $divlist->AddEntry(array( + array("string"=>$sec), + array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'") + )); + } + + $smarty->assign("Sections",$divlist->DrawList()); + + /* Get && assign acls */ + $tmp = $this->parent->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->parent->getacl($name)); + } + + /* Assign values */ + foreach($this->attributes as $attr){ + $smarty->assign($attr ,$this->$attr); + } + + $tmp = $this->getParentServers(); + $smarty->assign("ParentServers" ,$tmp); + $smarty->assign("ParentServerKeys",array_flip($tmp)); + + return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE,dirname(__FILE__)))); + } + + /* Save data to object */ + function save_object() + { + if(isset($_POST['servRepositorySetup_Posted'])) { + + foreach($this->attributes as $attr){ + if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){ + $this->$attr = $_POST[$attr]; + } + } + } + } + + + /* Check supplied data */ + function check() + { + /* Call common method to give check the hook */ + $message= plugin::check(); + + if(empty($this->Release)){ + $message[]=_("Please enter a value for 'release'."); + } + + if(empty($this->Url)){ + $message[] = _("Please specify a valid value for 'url'."); + } + + return ($message); + } + + + /* Save to LDAP */ + function save() + { + $tmp = array(); + $tmp['ParentServer'] = $this->ParentServer; + $tmp['Url'] = $this->Url; + $tmp['Release'] = $this->Release; + $tmp['Sections'] = $this->Sections; + return($tmp); + } + + function getParentServers() + { + $ret = array(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=FAIrepositoryServer)",array("*")); + while($attr = $ldap->fetch()){ + if($attr['cn'][0] == $this->cn) continue; + $ret[$attr['cn'][0]]= $attr['cn'][0]; + } + + $ret = array_merge($ret,$this->GetHookElements()); + + $ret['none']= " "; + asort($ret); + return($ret); + } + + /* this funtions calls a defined hook + and parses all additional serverdata + */ + function GetHookElements() + { + $ret = array(); + $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs')); + if(!empty($cmd)){ + $res = shell_exec($cmd); + $res2 = trim($res); + if(!$res){ + print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd)); + }elseif(empty($res2)){ + print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); + }else{ + $tmp = split("\n",$res); + foreach($tmp as $hook){ + /* skip empty */ + if(empty($hook)) continue; + + if(preg_match("/;/",$hook)){ + $hookinfo = split(";",$hook); + $ret[$hookinfo[0]] = $hookinfo[0]; + }else{ + $ret[$hook] = $hook; + } + } + } + } + return($ret); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/repository/servRepository.tpl b/gosa-plugins/goto/admin/systems/services/repository/servRepository.tpl new file mode 100644 index 000000000..ca42710c1 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/repository/servRepository.tpl @@ -0,0 +1,9 @@ +{$Repositories} + + +

 

+
+ +   + +
diff --git a/gosa-plugins/goto/admin/systems/services/repository/servRepositorySetup.tpl b/gosa-plugins/goto/admin/systems/services/repository/servRepositorySetup.tpl new file mode 100644 index 000000000..29691ec44 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/repository/servRepositorySetup.tpl @@ -0,0 +1,58 @@ +

 {t}Repository{/t}

+ + + + + + +
+ + + + + + + + + + + + + +
{t}Parent server{/t} + +{render acl=$ParentServerACL} + +{/render} +
{t}Release{/t} + +{render acl=$ReleaseACL} + +{/render} +
{t}URL{/t} + +{render acl=$UrlACL} + +{/render} +
+
+ {t}Sections{/t}
+{render acl=$SectionACL} + {$Sections} +{/render} +{render acl=$SectionACL} + +{/render} +{render acl=$SectionACL} + +{/render} +
+ +

+ +   + +

+ diff --git a/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc b/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc new file mode 100644 index 000000000..105076c95 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc @@ -0,0 +1,409 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goShareServer"); + var $attributes = array("goExportEntry"); + var $StatusFlag = "goShareServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goShareServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $cn = ""; + var $goShareServerStatus = ""; + var $goExportEntry = array(); + var $allow_mounts = false; + var $mounts_to_remove = array(); + var $mounts_to_add = array(); + var $view_logged =FALSE; + + function goShareServer(&$config,$dn) + { + goService::goService($config,$dn); + + $this->DisplayName = _("File service"); + + $tmp =array(); + if(isset($this->attrs['goExportEntry'])){ + if(isset($this->attrs['goExportEntry']['count'])){ + for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){ + $entry= $this->attrs['goExportEntry'][$i]; + $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry; + } + } + } + $this->goExportEntryList = $tmp; + + $ldap = $this->config->get_ldap_link(); + $avl_objectclasses = $ldap->get_objectclasses(); + if (isset($avl_objectclasses["mount"])) { + $this->allow_mounts = true; + } + } + + + function execute() + { + $smarty = get_smarty(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + + if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){ + if($this->allow_mounts){ + foreach($_POST['goExportEntryList'] as $entry){ + $this->deleteFromMountList($this->goExportEntryList[$entry]); + } + } + foreach($_POST['goExportEntryList'] as $entry){ + $this->deleteFromList($entry); + } + } + + if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){ + $this->oldone = NULL; + $this->o_subWindow = new servnfs($this->config, $this); + $this->o_subWindow->set_acl_category("server"); + $this->o_subWindow->set_acl_base($this->dn); + $this->dialog = true; + } + + if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){ + $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]]; + $add_mount=isset($this->mounts_to_add[$entry]); + $this->oldone=$entry; + $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount); + $this->o_subWindow->set_acl_base($this->dn); + $this->o_subWindow->set_acl_category("server"); + $this->dialog = true; + } + if(isset($this->o_subWindow)){ + $this->o_subWindow->save_object(TRUE); + } + + /* Save NFS setup */ + if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){ + if(count($this->o_subWindow->check())>0){ + foreach($this->o_subWindow->check() as $msg) { + print_red($msg); + } + }else{ + $this->o_subWindow->save_object(); + $newone = $this->o_subWindow->save(); + + $this->addToList($newone); + if($this->allow_mounts){ + if($this->oldone != NULL) { + $this->deleteFromMountList($this->oldone); + } + if ($this->o_subWindow->should_create_mount()) { + $this->addToMountList($newone); + } + } + unset($this->o_subWindow); + $this->dialog = false; + } + } + + /* Cancel NFS setup */ + if(isset($_POST['NFScancel'])){ + $this->oldone = NULL; + unset($this->o_subWindow); + $this->dialog = false; + } + + /* Execute NFS setup dialog*/ + if(isset($this->o_subWindow)){ + return $this->o_subWindow->execute(); + } + + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + + /* Set acls */ + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + $smarty->assign("createable",$this->acl_is_createable()); + $smarty->assign("removeable",$this->acl_is_removeable()); + + $tellSmarty= array(); + ksort($this->goExportEntryList); + foreach($this->goExportEntryList as $name=>$values){ + $tmp = split("\|",$values); + $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")"; + } + $smarty->assign("goExportEntry",array_keys($tellSmarty)); + $smarty->assign("goExportEntryKeys",($tellSmarty)); + return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("File service (Shares)"); + $fields['AllowEdit'] = true; + return($fields); + } + + + function save() + { + plugin::save(); + + /* Arrays */ + foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){ + $this->attrs[$destination]= array(); + foreach ($this->$source as $element){ + $this->attrs[$destination][]= $element; + } + } + + + /* Process netatalk mounts */ + if($this->allow_mounts) { + $this->process_mounts(); + } + + /* Check if this is a new entry ... add/modify */ + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + }else{ + $ldap->cd($this->dn); + $ldap->add($this->attrs); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn)); + if($this->initially_was_account){ + $this->handle_post_events("modify"); + new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + $this->handle_post_events("add"); + new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + } + + + function check() + { + $message = plugin::check(); + return($message); + } + + + function save_object() + { + if(isset($_POST['goShareServerPosted'])){ + plugin::save_object(); + } + } + + function addToList($entry){ + $key = key($entry); + $this->goExportEntryList[$key]=$entry[$key]; + } + + function deleteFromList($id) + { + /* Check if the share is used by someone */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn")); + $cnt= $ldap->count(); + if ($cnt){ + $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt); + $msg.= "

"._("Please correct the share-/profile settings of these users"); + print_red($msg); + + } else { + /* Finally remove it */ + unset($this->goExportEntryList[$id]); + } + } + + function process_mounts() { + + $clip = "cn=" . $this->cn . ",".get_ou('serverou'); + $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip)); + + $mounts = array( + "objectClass" => "container", + "cn" => "mounts" + ); + + # load data from mounts container + $ldap = $this->config->get_ldap_link(); + $ldap->cat($mountsdn, array('dn')); + $attrs = $ldap->fetch(); + + # mounts container not present yet, so we create it + if (count($attrs) == 0) { + $ldap->cd($mountsdn); + $ldap->add($mounts); + show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn)); + new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error()); + } + + # remove deleted mounts from the container + foreach ($this->mounts_to_remove as $entry) { + $mount=$this->returnMountEntry($entry); + $mountdn = "cn=".$mount["cn"].","."$mountsdn"; + + $ldap->cat($mountdn, array('dn')); + $attrs = $ldap->fetch(); + + if (count($attrs) != 0) { + $ldap->rmdir($mountdn); + show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn)); + new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error()); + } + } + + # add new mounts to the container + foreach ($this->mounts_to_add as $entry) { + $mount=$this->returnMountEntry($entry); + $mountdn = "cn=".$mount["cn"].","."$mountsdn"; + $ldap->cd($mountdn); + $ldap->add($mount); + show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn)); + new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error()); + } + } + + function addToMountList($entry) + { + if($this->acl_is_writeable("name")){ + $key = key($entry); + $type = $this->get_share_type($entry[$key]); + if (($type == "netatalk") || ($type == "NFS")) { + $this->mounts_to_add[$entry[$key]] = $entry[$key]; + unset($this->mounts_to_remove[$entry[$key]]); + } + } + } + + function deleteFromMountList($entry) + { + if($this->acl_is_writeable("name")){ + $type = $this->get_share_type($entry); + if (($type == "netatalk") || ($type == "NFS")) { + $this->mounts_to_remove[$entry] = $entry; + unset($this->mounts_to_add[$entry]); + } + } + } + + function get_share_type($share) + { + $tmp = split("\|", $share); + return $tmp[2]; + } + + function returnMountEntry($entry) + { + $item = split("\|", $entry); + $name = $item[0]; + $description = $item[1]; + $type = $item[2]; + $charset = $item[3]; + $path = $item[4]; + $options = $item[5]; + + switch ($type) { + case "netatalk" : { + $mount = array( + "mountDirectory" => "/Network/Servers/", + "mountOption" => array( + "net", + "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/" + ), + "mountType" => "url", + "objectClass" => "mount", + "cn" => $this->cn .":/".$name + ); + break; + } + case "NFS" : { + $mount = array( + "mountDirectory" => "/Network/Servers/", + "mountOption" => "net", + "mountType" => "nfs", + "objectClass" => "mount", + "cn" => $this->cn .":".$path + ); + break; + } + default : { + continue; + } + } + return $mount; + } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + $tmp =array(); + if(isset($source['goExportEntry'])){ + if(isset($source['goExportEntry']['count'])){ + for($i= 0; $i<$source['goExportEntry']['count']; $i++){ + $entry= $source['goExportEntry'][$i]; + $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry; + } + } + } + $this->goExportEntryList = $tmp; + $this->goExportEntry = $tmp; + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("File service (Shares)"), + "plDescription" => _("File service - Shares")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 90, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "name" => _("Name"), + "netatalkmount" => _("Apple mounts"), + "description" => _("Description"), + "type" => _("Type"), + "charset" => _("Charset"), + "path" => _("Path"), + "option" => _("Option"), + "volume" => _("Volume")) + + )); + } + + +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/shares/goShareServer.tpl b/gosa-plugins/goto/admin/systems/services/shares/goShareServer.tpl new file mode 100644 index 000000000..2c645c7f4 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/shares/goShareServer.tpl @@ -0,0 +1,33 @@ +

{t}Shares{/t}

+ + + + +
+{render acl=$nameACL mode=read_active} + +{/render} +
+ +{render acl=$nameACL} + +{/render} +{render acl=$nameACL mode=read_active} + +{/render} +{render acl=$nameACL} + +{/render} +
+ + +

 

+
+ +   + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/syslog/class_goLogDBServer.inc b/gosa-plugins/goto/admin/systems/services/syslog/class_goLogDBServer.inc new file mode 100644 index 000000000..3a193dbf2 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/syslog/class_goLogDBServer.inc @@ -0,0 +1,106 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goLogDBServer"); + var $attributes = array("goLogAdmin", "goLogPassword"); + var $StatusFlag = "goLogDBServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goLogDBServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $acl; + var $cn = ""; + var $goLogDBServerStatus = ""; + var $goLogAdmin = ""; + var $goLogPassword = ""; + var $view_logged =FALSE; + + + function goLogDBServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Syslog service database"); + } + + + function execute() + { + $smarty = get_smarty(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Syslog service database"); + $fields['AllowEdit'] = true; + return($fields); + } + + + function check() + { + $message = plugin::check(); + if (empty($this->goLogAdmin)){ + $message[]= sprintf_("The attribute user is empty or contains invalid characters."); + } + if (empty($this->goLogPassword)){ + $message[]= sprintf_("The attribute password is empty or contains invalid characters."); + } + return($message); + } + + + function save_object() + { + if(isset($_POST['goLogDBServerPosted'])){ + plugin::save_object(); + } + } + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Logging database"), + "plDescription" => _("Logging database")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 97, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "start" => _("Start"), + "stop" => _("Stop"), + "restart" => _("Restart"), + "goLogAdmin" => _("Admin"), + "goLogPassword" => _("Password")) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/syslog/class_goSyslogServer.inc b/gosa-plugins/goto/admin/systems/services/syslog/class_goSyslogServer.inc new file mode 100644 index 000000000..9461977e2 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/syslog/class_goSyslogServer.inc @@ -0,0 +1,83 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goSyslogServer"); + var $attributes = array(); + var $StatusFlag = "goSyslogServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goSyslogServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $acl; + var $cn = ""; + var $goSyslogServerStatus = ""; + var $view_logged =FALSE; + + function goSyslogServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Syslog server"); + } + + + function execute() + { + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + + $smarty = get_smarty(); + return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Syslog server"); + $fields['AllowEdit'] = false; + return($fields); + } + + function check() + { + $message = plugin::check(); + return($message); + } + + + function save_object() + { + plugin::save_object(); + } + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Logging service"), + "plDescription" => _("Logging service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 88, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array() + )); + } + + +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/syslog/goLogDBServer.tpl b/gosa-plugins/goto/admin/systems/services/syslog/goLogDBServer.tpl new file mode 100644 index 000000000..839507029 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/syslog/goLogDBServer.tpl @@ -0,0 +1,27 @@ +

{t}Logging database information{/t}

+ + + + + + + + + +
{t}Logging DB user{/t}{$must} +{render acl=$goLogAdminACL} + +{/render} +
{t}Password{/t}{$must} +{render acl=$goLogPasswordACL} + +{/render} +
+ +

 

+
+ +   + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/syslog/goSyslogServer.tpl b/gosa-plugins/goto/admin/systems/services/syslog/goSyslogServer.tpl new file mode 100644 index 000000000..a7ed661a8 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/syslog/goSyslogServer.tpl @@ -0,0 +1,9 @@ +

{t}Syslog Service{/t} {t}enabled{/t}

+ +

 

+
+ +   + +
+ diff --git a/gosa-plugins/goto/admin/systems/services/terminal/class_goTerminalServer.inc b/gosa-plugins/goto/admin/systems/services/terminal/class_goTerminalServer.inc new file mode 100644 index 000000000..e832de04c --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/terminal/class_goTerminalServer.inc @@ -0,0 +1,141 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* This plugin only writes its objectClass */ + var $objectclasses = array("goTerminalServer"); + var $attributes = array("goXdmcpIsEnabled", "goFontPath"); + var $StatusFlag = "goTerminalServerStatus"; + + /* This class can't be assigned twice so it conflicts with itsself */ + var $conflicts = array("goTerminalServer"); + + var $DisplayName = ""; + var $dn = NULL; + var $acl; + var $cn = ""; + var $goTerminalServerStatus = ""; + var $goXdmcpIsEnabled = false; + var $goFontPath = ""; + var $view_logged =FALSE; + + + function goTerminalServer(&$config,$dn) + { + goService::goService($config,$dn); + $this->DisplayName = _("Terminal service"); + } + + + function execute() + { + $smarty = get_smarty(); + + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + new log("view","server/".get_class($this),$this->dn); + } + + + $tmp = $this->plinfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__)))); + } + + + function getListEntry() + { + $fields = goService::getListEntry(); + $fields['Message'] = _("Terminal service"); + $fields['AllowEdit'] = true; + return($fields); + } + + + function save() + { + plugin::save(); + + if(!$this->goXdmcpIsEnabled){ + $this->attrs['goXdmcpIsEnabled'] = "0"; + } + + /* Check if this is a new entry ... add/modify */ + $ldap = $this->config->get_ldap_link(); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + }else{ + $ldap->cd($this->dn); + $ldap->add($this->attrs); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn)); + if($this->initially_was_account){ + $this->handle_post_events("modify"); + new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + $this->handle_post_events("add"); + new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + } + + + function check() + { + $message = plugin::check(); + if(empty($this->goFontPath)){ + $message[]=_("Terminal server, must have fontpath specified."); + } + + return($message); + } + + + function save_object() + { + if(isset($_POST['goTerminalServerPosted'])){ + plugin::save_object(); + if($this->acl_is_writeable("goXdmcpIsEnabled")){ + if(isset($_POST['goXdmcpIsEnabled'])){ + $this->goXdmcpIsEnabled = true; + }else{ + $this->goXdmcpIsEnabled = false; + } + } + } + } + + + /* Return plugin informations for acl handling */ + static function plInfo() + { + return (array( + "plShortName" => _("Terminal service"), + "plDescription" => _("Terminal service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 87, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "goXdmcpIsEnabled" => _("Temporary disable login"), + "goFontPath" => _("Font path")) + )); + } + + +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/admin/systems/services/terminal/goTerminalServer.tpl b/gosa-plugins/goto/admin/systems/services/terminal/goTerminalServer.tpl new file mode 100644 index 000000000..5fca2091f --- /dev/null +++ b/gosa-plugins/goto/admin/systems/services/terminal/goTerminalServer.tpl @@ -0,0 +1,27 @@ +

{t}Terminal service{/t}

+ + + + + + + + +
+{render acl=$goXdmcpIsEnabledACL} + +{/render} + {t}Temporary disable login{/t} +
{t}Font path{/t} +{render acl=$goXdmcpIsEnabledACL} + +{/render} +
+ +

 

+
+ +   + +
+