From 31f5c6913649a183107e45126b93e3c953ec0efc Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 16 Oct 2005 16:24:33 +0000 Subject: [PATCH] Updated workstation and environment plugins to handle shares correctly git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1575 594d385d-05f5-0310-b6e9-bd551577e9d8 --- TODO | 3 + contrib/openldap/goto.schema | 4 +- include/class_config.inc | 48 +++++++++ .../systems/class_workstationStartup.inc | 97 +++++++++++++------ plugins/admin/systems/workstationStartup.tpl | 68 ++++++------- .../environment/class_environment.inc | 56 +---------- 6 files changed, 154 insertions(+), 122 deletions(-) diff --git a/TODO b/TODO index 303c121c7..1dc21ea03 100644 --- a/TODO +++ b/TODO @@ -44,6 +44,9 @@ Things to fix before 2.4: * FAI package lists behave strange +* Add shares to terminal tabs + +* Shares are not removable! Target for 2.5: =============== diff --git a/contrib/openldap/goto.schema b/contrib/openldap/goto.schema index 485a70c91..c5a799cad 100644 --- a/contrib/openldap/goto.schema +++ b/contrib/openldap/goto.schema @@ -408,8 +408,8 @@ objectclass (1.3.6.1.4.1.10098.1.2.1.18 NAME 'gotoInstallProfile' SUP top STRUCT objectclass (1.3.6.1.4.1.10098.1.2.1.30 NAME 'gotoWorkstation' DESC 'GOto - Gonicus Terminal Concept, objectclass (v2.3)' SUP top STRUCTURAL MUST ( cn ) - MAY ( gotoNtpServer $ gotoSwapServer $ gotoLpdServer $ - gotoFontPath $ gotoFilesystem $ gotoFloppyEnable $ gotoCdromEnable $ + MAY ( gotoNtpServer $ gotoSwapServer $ gotoLpdServer $ gotoShare $ + gotoFontPath $ gotoFloppyEnable $ gotoCdromEnable $ gotoLpdEnable $ gotoScannerEnable $ gotoScannerClients $ l $ gotoRootPasswd $ gotoXdmcpServer $ gotoXMethod $ gotoSndModule $ gotoLastUser $ gotoXMonitor $ gotoXHsync $ gotoXVsync $ gotoXResolution $ diff --git a/include/class_config.inc b/include/class_config.inc index d0c9f76e5..a5eecb263 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -456,6 +456,54 @@ class config { asort($this->idepartments); } + /* This function returns all available Shares defined in this ldap + * There are two ways to call this function, if listboxEntry is true + * only name and path are attached to the array, in it is false, the whole + * entry will be parsed an atached to the result. + */ + function getShareList($listboxEntry = false) + { + $ldap= $this->get_ldap_link(); + $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn")); + $return= array(); + while($entry = $ldap->fetch($a_res)){ + unset($entry['goExportEntry']['count']); + foreach($entry['goExportEntry'] as $export){ + $shareAttrs = split("\|",$export); + if($listboxEntry) { + $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0]; + }else{ + $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5]; + } + } + } + return($return); + } + + /* This function returns all available ShareServer + */ + function getShareServerList() + { + $ldap= $this->get_ldap_link(); + $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn")); + $return= array(); + while($entry = $ldap->fetch($a_res)){ + unset($entry['goExportEntry']['count']); + foreach($entry['goExportEntry'] as $share){ + $a_share = split("\|",$share); + $sharename = $a_share[0]; + $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]"; + } + } + return($return); + } + } ?> diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index 7cd13c476..a748f40ce 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -16,10 +16,18 @@ class workstartup extends plugin var $gotoAutoFs= array(); var $gotoFilesystem= array(); var $gotoTerminalPath= ""; + var $FAIstatus= ""; + var $FAIclass= ""; /* attribute list for save action */ - var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters"); - var $objectclasses= array("GOhard"); + var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare"); + var $objectclasses= array("GOhard", "FAIobject"); + + /* Share */ + var $gotoShares = array();// Currently Share Option + var $gotoShare = ""; // currently selected Share Option + var $gotoShareSelections= array();// Available Shares for this account in Listbox format + var $gotoAvailableShares= array();// Available Shares for this account /* Helper */ var $customParameters= ""; @@ -59,6 +67,22 @@ class workstartup extends plugin $this->customParameters= ""; } + /* Prepare Shares */ + if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){ + unset($this->attrs['gotoShare']['count']); + foreach($this->attrs['gotoShare'] as $share){ + $tmp = $tmp2 = array(); + $tmp = split("\|",$share); + $tmp2['server'] =$tmp[0]; + $tmp2['name'] =$tmp[1]; + $tmp2['mountPoint'] =$tmp[2]; + $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2; + } + } + + $this->gotoShareSelections= $config->getShareList(true); + $this->gotoAvailableShares= $config->getShareList(false); + $this->orig_dn= $this->dn; } @@ -90,36 +114,42 @@ class workstartup extends plugin } } - /* Add autofs */ - if (isset ($_POST['add_autofs'])){ - if ($_POST['autofs'] != "" && chkacl ($this->acl, "gotoAutoFs") == ""){ - $this->add_list ($this->gotoAutoFs, $_POST['autofs']); - } - } - - /* Delete autofs */ - if (isset ($_POST['delete_autofs'])){ - if (count($_POST['autofs_list']) && chkacl ($this->acl, "gotoAutoFs") == ""){ - $this->del_list ($this->gotoAutoFs, $_POST['autofs_list']); - } - } + /* Show main page */ + $smarty= get_smarty(); - /* Add filesystem */ - if (isset ($_POST['add_fs'])){ - if ($_POST['fstab'] != "" && chkacl ($this->acl, "gotoFilesystem") == ""){ - $this->add_list ($this->gotoFilesystem, $_POST['fstab']); + /* In this section server shares will be defined + * A user can select one of the given shares and a mount point + * and attach this combination to his setup. + */ + $smarty->assign("gotoShareSelections", $this->gotoShareSelections); + $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); + + /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry + * This entry will be, a combination of mountPoint and sharedefinitions + */ + if(isset($_POST['gotoShareAdd'])){ + /* We assign a share to this user, if we don't know where to mount the share */ + if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoi +nt']))){ + print_red(_("You must specify a valid mount point.")); + }else{ + $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']]; + $s_mount = $_POST['gotoShareMountPoint']; + /* Preparing the new assignment */ + $this->gotoShares[$a_share['name']]=$a_share; + $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount; } } - /* Delete filesystem */ - if (isset ($_POST['delete_fs'])){ - if (count($_POST['fstab_list']) && chkacl ($this->acl, "gotoFilesystem") == ""){ - $this->del_list ($this->gotoFilesystem, $_POST['fstab_list']); - } + /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected) + * If there is no defined share selected, we will abort the deletion without any message + */ + if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){ + unset($this->gotoShares[$_POST['gotoShare']]); } - /* Show main page */ - $smarty= get_smarty(); + $smarty->assign("gotoShares",$this->printOutAssignedShares()); + $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares())); /* Arrays */ $smarty->assign("ldapservers", $this->config->data['SERVERS']['LDAP']); @@ -130,7 +160,7 @@ class workstartup extends plugin } /* Values */ - foreach(array("gotoBootKernel", "customParameters") as $val){ + foreach(array("gotoBootKernel", "customParameters", "gotoShare") as $val){ $smarty->assign($val, $this->$val); $smarty->assign($val."ACL", chkacl($this->acl, $val)); } @@ -286,6 +316,19 @@ class workstartup extends plugin $array= $tmp; } + /* Generate ListBox frindly output for the defined shares + * Possibly Add or remove an attribute here, + */ + function printOutAssignedShares() + { + $a_return = array(); + if(is_array($this->gotoShares)){ + foreach($this->gotoShares as $share){ + $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]"; + } + } + return($a_return); + } } diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl index 12321d0c1..48c75bb36 100644 --- a/plugins/admin/systems/workstationStartup.tpl +++ b/plugins/admin/systems/workstationStartup.tpl @@ -32,14 +32,14 @@ - - {t}use graphical bootup{/t} + {t}Installation server{/t} [.........]

- - {t}use standard linux textual bootup{/t} -
- - {t}use debug mode for startup{/t} + {t}Assigned FAI classes{/t}
+ [..........................]
+ [..........................]
+ [..........................]
+ [..........................]
+ [Add] [Remove] @@ -48,11 +48,11 @@

- +

{t}Kernel modules (format: name parameters){/t}

- {html_options values=$gotoModules output=$gotoModules} @@ -63,37 +63,25 @@ -

- {t}Automount devices (format: complete autofs entry){/t} -

- -
- -   - - - - - - - - - -

-

- {t}Additional fstab entries{/t} -

- -
- -   - +

 

+ + + + +
+ +
+ + + + +
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index b179c431d..f4f9b0429 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -164,6 +164,9 @@ class environment extends plugin $this->is_group = true; } + $this->gotoProfileServers= $config->getShareServerList() ; + $this->gotoShareSelections= $config->getShareList(true); + $this->gotoAvailableShares= $config->getShareList(false); } @@ -309,7 +312,6 @@ class environment extends plugin } $this->gotoXResolutions = array("640x480","800x600","1024x768","1280x768","1280x1024"); - $this->gotoProfileServers =$this->getShareServerList() ; $smarty->assign("gotoXResolutions",$this->gotoXResolutions); $smarty->assign("gotoProfileServers",$this->gotoProfileServers); @@ -406,9 +408,6 @@ class environment extends plugin * and attach this combination to his setup. */ - $this->gotoShareSelections = $this->getShareList(true); - $this->gotoAvailableShares = $this->getShareList(false); - $smarty->assign("gotoShareSelections", $this->gotoShareSelections); $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections)); @@ -893,55 +892,6 @@ class environment extends plugin $this->handle_post_events($mode); } -/* This function returns all available Shares defined in this ldap - * There are two ways to call this function, if listboxEntry is true - * only name and path are attached to the array, in it is false, the whole - * entry will be parsed an atached to the result. - */ - function getShareList($listboxEntry = false) - { - $ldap= $this->config->get_ldap_link(); - $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn")); - $return= array(); - while($entry = $ldap->fetch($a_res)){ - unset($entry['goExportEntry']['count']); - foreach($entry['goExportEntry'] as $export){ - $shareAttrs = split("\|",$export); - if($listboxEntry) { - $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0]; - }else{ - $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5]; - } - } - } - return($return); - } - - -/* This function returns all available ShareServer - */ - function getShareServerList() - { - $ldap= $this->config->get_ldap_link(); - $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn")); - $return= array(); - while($entry = $ldap->fetch($a_res)){ - unset($entry['goExportEntry']['count']); - foreach($entry['goExportEntry'] as $share){ - $a_share = split("\|",$share); - $sharename = $a_share[0]; - $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]"; - } - } - return($return); - } - /* Generate ListBox frindly output for the defined shares * Possibly Add or remove an attribute here, */ -- 2.30.2