diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
index 5c1bb1d1ca0c7004e861086bfffc037033a08577..abc7ca682b5328764ebb7f5f22b0984f745ea2c0 100644 (file)
/* Generic terminal attributes */
var $bootmode = "G";
var $goLdapServerList = array();
/* Generic terminal attributes */
var $bootmode = "G";
var $goLdapServerList = array();
- var $gotoBootKernel = "default";
+ var $gotoBootKernel = "default-inherited";
var $gotoKernelParameters = "";
var $gotoKernelParameters = "";
- var $gotoLdapServer = "default";
+ var $gotoLdapServer = "default-inherited";
var $gotoModules = array();
var $gotoAutoFs = array();
var $gotoFilesystem = array();
var $gotoModules = array();
var $gotoAutoFs = array();
var $gotoFilesystem = array();
/* Contains all possible server/release/class settings */
var $FAIServRepConfig = array();
/* Contains all possible server/release/class settings */
var $FAIServRepConfig = array();
- function workstartup ($config, $dn= NULL)
+ function workstartup ($config, $dn= NULL, $parent= NULL)
{
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
/* Creating a list of valid Mirrors
* none will not be saved to ldap.
/* Creating a list of valid Mirrors
* none will not be saved to ldap.
$this->orig_dn= $this->dn;
/* Handle inheritance value "default" */
$this->orig_dn= $this->dn;
/* Handle inheritance value "default" */
- $this->gotoBootKernels= array("%default%" => '['._("inherited").']');
+ $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']');
/* Load hardware list */
/* Load hardware list */
switch ($name){
case 'gotoLdapServer':
switch ($name){
case 'gotoLdapServer':
- $this->goLdapServerList= array_merge(array('default' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
+ $this->goLdapServerList= array_merge(array('default-inherited' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
break;
case 'gotoBootKernel':
break;
case 'gotoBootKernel':
- $this->gotoBootKernels['%default%']= _("inherited").' ['.$attrs[$name][0].']' ;
+ $this->gotoBootKernels['default-inherited']= _("inherited").' ['.$attrs[$name][0].']' ;
break;
case 'FAIclass':
break;
case 'FAIclass':
$message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
get_class($this));
} else {
$message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
get_class($this));
} else {
-
$fh= popen($command, "r");
while (!feof($fh)) {
$buffer= trim(fgets($fh, 256));
$fh= popen($command, "r");
while (!feof($fh)) {
$buffer= trim(fgets($fh, 256));
- if ($buffer != ""){
- $this->gotoBootKernels[preg_replace('/:.*$/', '', $buffer)]= $buffer;
+
+ if(!empty($buffer)){
+
+ $name=$value = $buffer;
+
+ if(preg_match("/:/",$buffer)){
+ $name = preg_replace("/:.*$/","",$buffer);
+ $value= preg_replace("/^.*:/","",$buffer);
+ $this->gotoBootKernels[$name]= $name.":".$value;
+ }else{
+ $this->gotoBootKernels[$name]= $value;
+ }
}
}
+
}
pclose($fh);
}
}
pclose($fh);
}
plugin::execute();
/* Do we need to flip is_account state? */
plugin::execute();
/* Do we need to flip is_account state? */
- if (isset($_POST['modify_state'])){
- $this->is_account= !$this->is_account;
+ if(isset($_POST['modify_state'])){
+ if($this->is_account && $this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }elseif(!$this->is_account && $this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
}
/* Do we represent a valid terminal? */
}
/* Do we represent a valid terminal? */
/* Add module */
if (isset ($_POST['add_module'])){
/* Add module */
if (isset ($_POST['add_module'])){
- if ($_POST['module'] != "" && chkacl ($this->acl, "gotoModule") == ""){
+ if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){
$this->add_list ($this->gotoModules, $_POST['module']);
}
}
/* Delete module */
if (isset ($_POST['delete_module'])){
$this->add_list ($this->gotoModules, $_POST['module']);
}
}
/* Delete module */
if (isset ($_POST['delete_module'])){
- if (count($_POST['modules_list']) && chkacl ($this->acl, "gotoModule") == ""){
+ if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){
$this->del_list ($this->gotoModules, $_POST['modules_list']);
}
}
/* FAI class management */
$this->del_list ($this->gotoModules, $_POST['modules_list']);
}
}
/* FAI class management */
- if((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))){
+ if(((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))) && ($this->acl_is_writeable("FAIclass"))){
$found = 0 ;
/* If this new class/profile will attach a second partition table
$found = 0 ;
/* If this new class/profile will attach a second partition table
}
$sort = false;
}
$sort = false;
- foreach($_POST as $name => $val){
-
- $sort_type = false;
- if((preg_match("/sort_up/",$name))&&(!$sort)){
- $sort_type = "sort_up_";
- }
- if((preg_match("/sort_down/",$name))&&(!$sort)){
- $sort_type = "sort_down_";
- }
-
- if(($sort_type)&&(!$sort)){
- $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
- $sort = true;
-
- $last = -1;
- $change_down = -1;
-
- /* Create array with numeric index */
- $tmp = array();
- foreach($this->FAIclass as $class){
- $tmp [] = $class;
+
+ /* Move one used class class one position up or down */
+ if($this->acl_is_writeable("FAIclass")){
+ foreach($_POST as $name => $val){
+
+ $sort_type = false;
+ if((preg_match("/sort_up/",$name))&&(!$sort)){
+ $sort_type = "sort_up_";
+ }
+ if((preg_match("/sort_down/",$name))&&(!$sort)){
+ $sort_type = "sort_down_";
}
}
- /* Walk trough array */
- foreach($tmp as $key => $faiName){
- if($faiName == $value){
- if($sort_type == "sort_up_"){
- if($last != -1){
- $change_down= $last;
- }
- }else{
- if(isset($tmp[$key+1])){
- $change_down = $key;
+ if(($sort_type)&&(!$sort)){
+ $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
+ $sort = true;
+
+ $last = -1;
+ $change_down = -1;
+
+ /* Create array with numeric index */
+ $tmp = array();
+ foreach($this->FAIclass as $class){
+ $tmp [] = $class;
+ }
+
+ /* Walk trough array */
+ foreach($tmp as $key => $faiName){
+ if($faiName == $value){
+ if($sort_type == "sort_up_"){
+ if($last != -1){
+ $change_down= $last;
+ }
+ }else{
+ if(isset($tmp[$key+1])){
+ $change_down = $key;
+ }
}
}
}
}
+ $last = $key;
}
}
- $last = $key;
+
+ $tmp2 = array();
+ $skip = false;
+
+ foreach($tmp as $ky => $vl){
+
+ if($ky == $change_down){
+ $skip = $vl;
+ }else{
+ $tmp2[$vl] = $vl;
+ }
+ if(($skip != false)&&($ky != $change_down)){
+ $tmp2[$skip] = $skip;
+ $skip =false;
+ }
+ }
+ $this->FAIclass = $tmp2;
}
}
-
- $tmp2 = array();
- $skip = false;
-
- foreach($tmp as $ky => $vl){
- if($ky == $change_down){
- $skip = $vl;
- }else{
- $tmp2[$vl] = $vl;
- }
- if(($skip != false)&&($ky != $change_down)){
- $tmp2[$skip] = $skip;
- $skip =false;
- }
- }
- $this->FAIclass = $tmp2;
- }
-
- if(preg_match("/fai_remove/i",$name)){
- $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
- unset($this->FAIclass[$value]);
+ if(preg_match("/fai_remove/i",$name)){
+ $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
+ unset($this->FAIclass[$value]);
+ }
}
}
/* Delete selected class from our list */
}
}
/* Delete selected class from our list */
- if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
- if(isset($this->FAIclass[$_POST['FAIclassSel']])){
- unset($this->FAIclass[$_POST['FAIclassSel']]);
+ if($this->acl_is_writeable("FAIclass")){
+ if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
+ if(isset($this->FAIclass[$_POST['FAIclassSel']])){
+ unset($this->FAIclass[$_POST['FAIclassSel']]);
+ }
}
}
/* Show main page */
$smarty= get_smarty();
}
}
/* Show main page */
$smarty= get_smarty();
+
+ /* Assign ACLs to smarty */
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
$smarty->assign("SelectBoxLdapServer","");
/* In this section server shares will be defined
$smarty->assign("SelectBoxLdapServer","");
/* In this section server shares will be defined
/* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
* This entry will be, a combination of mountPoint and sharedefinitions
*/
/* 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'])){
+ if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) {
/* 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['gotoShareMountPoint']))){
print_red(_("You must specify a valid mount point."));
/* 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['gotoShareMountPoint']))){
print_red(_("You must specify a valid mount point."));
/* 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 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']))){
+ if(($this->acl_is_writeable("gotoShare"))&& (isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
unset($this->gotoShares[$_POST['gotoShare']]);
}
unset($this->gotoShares[$_POST['gotoShare']]);
}
$smarty->assign("SelectBoxLdapServer",$SelectBoxLdapServer->DrawList());
$smarty->assign("SelectBoxLdapServer",$SelectBoxLdapServer->DrawList());
- $smarty->assign("gotoLdapServerACL", chkacl($this->acl, "gotoLdapServer"));
foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
$smarty->assign("$val", $this->$val);
}
foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
$smarty->assign("$val", $this->$val);
}
/* Values */
foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
$smarty->assign($val, $this->$val);
/* Values */
foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
$smarty->assign($val, $this->$val);
- $smarty->assign($val."ACL", chkacl($this->acl, $val));
}
$smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
}
$smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
$smarty->assign("FAIclasses",$this->selectFriendlyClasses());
$smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
$smarty->assign("FAIclassKeys",$this->FAIclass);
$smarty->assign("FAIclasses",$this->selectFriendlyClasses());
$smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
$smarty->assign("FAIclassKeys",$this->FAIclass);
- $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
-
+
+ $inheritedRelease = array();
+ if(!empty($this->InheritedFAIrelease)){
+ $inheritedRelease[$this->InheritedFAIrelease]= $this->InheritedFAIrelease;
+ }
+ $smarty->assign("InheritedFAIrelease",$inheritedRelease);
+
$div = new divSelectBox("WSFAIscriptClasses");
$div -> SetHeight("110");
$str_up = " <input type='image' src='images/sort_up.png' name='sort_up_%s' value='%s'>";
$div = new divSelectBox("WSFAIscriptClasses");
$div -> SetHeight("110");
$str_up = " <input type='image' src='images/sort_up.png' name='sort_up_%s' value='%s'>";
$smarty->assign("debugbootup", "");
}
$smarty->assign("debugbootup", "");
}
- /* ACL's */
- foreach (array("gotoKernelParameters", "gotoModules", "gotoFilesystem","FAIclass") as $value){
- $smarty->assign($value."ACL", chkacl($this->acl, "$value"));
- }
-
/* Show main page */
return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
}
/* Show main page */
return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
}
plugin::save_object();
/* Save group radio buttons */
plugin::save_object();
/* Save group radio buttons */
- if (chkacl ($this->acl, "bootmode") == "" && isset($_POST["bootmode"])){
+ if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
$this->bootmode= $_POST["bootmode"];
}
/* Save kernel parameters */
$this->bootmode= $_POST["bootmode"];
}
/* Save kernel parameters */
- if (chkacl ($this->acl, "gotoKernelParameters") == "" && isset($_POST["customParameters"])){
+ if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
$this->customParameters= $_POST["customParameters"];
}
$this->customParameters= $_POST["customParameters"];
}
}
/* Strip out 'default' values */
}
/* Strip out 'default' values */
- if ($this->attrs['gotoLdapServer'] == "default"){
+ if ($this->attrs['gotoLdapServer'] == "default-inherited"){
$this->attrs['gotoLdapServer']= array();
}
$this->attrs['gotoLdapServer']= array();
}
- if (($this->attrs['gotoBootKernel'] == "default") || ($this->attrs['gotoBootKernel'] == "%default%")){
+ if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){
$this->attrs['gotoBootKernel']= array();
}
$this->attrs['gotoBootKernel']= array();
}
/* Remove FAI objects if no FAI class is selected */
if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
/* Remove FAI objects if no FAI class is selected */
if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
- $tmp = array();
- foreach($this->attrs['objectClass'] as $class){
- if($class != "FAIobject"){
- $tmp[] = $class;
- }
- }
- $this->attrs['objectClass'] = $tmp;
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}
"plDepends" => array(),
"plPriority" => 0,
"plSection" => array("administration"),
"plDepends" => array(),
"plPriority" => 0,
"plSection" => array("administration"),
- "plCategory" => array("workstation","server"),
+ "plCategory" => array("workstation","server","ogroups"),
"plProvidedAcls"=> array(
"gotoLdapServer" => _("Ldap server"),
"gotoBootKernel" => _("Boot kernel"),
"gotoKernelParameters" => _("Kernel parameter"),
"plProvidedAcls"=> array(
"gotoLdapServer" => _("Ldap server"),
"gotoBootKernel" => _("Boot kernel"),
"gotoKernelParameters" => _("Kernel parameter"),
- "FAIclass" => _("FAI classes"),
- "FAIstatus" => _("FAI status flag"),
+
+ "gotoModules" => _("Kernel modules"),
"gotoShare" => _("Shares"),
"gotoShare" => _("Shares"),
+
+ "FAIclass" => _("FAI classes"),
"FAIdebianMirror" => _("Debian mirror"),
"FAIdebianMirror" => _("Debian mirror"),
- "FAIrelease" => _("Debian release"))
+ "FAIrelease" => _("Debian release"),
+
+ "FAIstatus" => _("FAI status flag")) // #FIXME is this acl realy necessary ?
));
}
}
));
}
}