diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
index 6df7411c75390f6a503a06bb57e438d86d806400..abc7ca682b5328764ebb7f5f22b0984f745ea2c0 100644 (file)
/* 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.
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? */
/* 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'])){
- 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 */
- 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
}
$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 */
- 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();
+
+ /* 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
/* 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."));
/* 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']]);
}
$smarty->assign("SelectBoxLdapServer",$SelectBoxLdapServer->DrawList());
- $smarty->assign("gotoLdapServerACL", chkacl($this->acl, "gotoLdapServer"));
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);
- $smarty->assign($val."ACL", chkacl($this->acl, $val));
}
$smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
$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'>";
$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__))));
}
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 */
- if (chkacl ($this->acl, "gotoKernelParameters") == "" && isset($_POST["customParameters"])){
+ if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
$this->customParameters= $_POST["customParameters"];
}
/* 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();
}
"gotoLdapServer" => _("Ldap server"),
"gotoBootKernel" => _("Boot kernel"),
"gotoKernelParameters" => _("Kernel parameter"),
- "FAIclass" => _("FAI classes"),
- "FAIstatus" => _("FAI status flag"),
+
+ "gotoModules" => _("Kernel modules"),
"gotoShare" => _("Shares"),
+
+ "FAIclass" => _("FAI classes"),
"FAIdebianMirror" => _("Debian mirror"),
- "FAIrelease" => _("Debian release"))
+ "FAIrelease" => _("Debian release"),
+
+ "FAIstatus" => _("FAI status flag")) // #FIXME is this acl realy necessary ?
));
}
}