summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6ef8011)
raw | patch | inline | side by side (parent: 6ef8011)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 5 Sep 2006 06:34:56 +0000 (06:34 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 5 Sep 2006 06:34:56 +0000 (06:34 +0000) |
- Remove a printer and add the same printer again, failed.
- Add a printer and remove the same printer failed.
- It was possible to set the gosaDefaultPrinter Falg in group environemnt.
- Fixed acls.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4589 594d385d-05f5-0310-b6e9-bd551577e9d8
- Add a printer and remove the same printer failed.
- It was possible to set the gosaDefaultPrinter Falg in group environemnt.
- Fixed acls.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4589 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/environment/class_environment.inc | patch | blob | history | |
plugins/personal/environment/environment.tpl | patch | blob | history |
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
index f0cee0e46106c67082dd7364c5c7cedea32d567d..aa7a42562a4a523a13868c93065101b0963d9b35 100644 (file)
var $gotoHotplugDevice = array(); // Selected hotplug
var $gotoHotplugDevices = array();// Already configured hotplug devices
+ var $NewAddedPrinters = array();
+ var $NewDeletedPrinters = array();
/* general settings */
// Sets the attributes which will kept on page reload, which will be saved, ...
$smarty= get_smarty();
$display= "";
+ $smarty->assign("is_group",$this->is_group);
+
/* Are we editing from MyAccount and not editing a user */
$WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
$tmp2= $this->dialog->getPrinter(true);
foreach($tmp as $pname){
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
- $printerObj->set_acl_base($tmp2[$pname]['dn']);
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
+ $printerObj->set_acl_base($tmp2[$pname]['dn']);
- if($this->is_group){
- if($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
- $this->gotoPrinter[$pname]=$tmp2[$pname];
- $this->gotoPrinter[$pname]['mode']="user";
- $this->add_del_printer_member_was_called = true;
+ $type = false;
+
+ if($this->is_group){
+
+ if(isset($this->NewDeletedPrinters[$pname])){
+ $type = "AddGroup";
+ }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
+ $type = "AddGroup";
+ }
+ }else{
+ if(isset($this->NewDeletedPrinters[$pname])){
+ $type = "AddUser";
+ }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
+ $type = "AddUser";
+ }
}
- }else{
- if($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
+
+ if($type){
$this->gotoPrinter[$pname]=$tmp2[$pname];
$this->gotoPrinter[$pname]['mode']="user";
$this->add_del_printer_member_was_called = true;
- }
- }
+ $this->NewAddedPrinters[$pname] = $pname;
+ if(isset($this->NewDeletedPrinters[$pname])){
+ unset($this->NewDeletedPrinters[$pname]);
+ }
+ }
}
$this->is_dialog=false;
$printer = $_POST['gotoPrinterSel'];
foreach($printer as $pname){
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn']);
- if($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->dn)){
- unset($this->gotoPrinter[$pname]);
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
+ $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
+
+ $type = false;
+ if($this->is_group){
+ if(isset($this->NewAddedPrinters[$pname])){
+ $type = "Group";
+ }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
+ $type = "Group";
+ }
+ }else{
+ if(isset($this->NewAddedPrinters[$pname])){
+ $type = "User";
+ }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->cn)){
+ $type = "User";
+ }
+ }
+ if($type){
$this->add_del_printer_member_was_called = true;
+ unset($this->gotoPrinter[$pname]);
+
+ $this->NewDeletedPrinters[$pname] = $pname;
+ if(isset($this->NewAddedPrinters[$pname])){
+ UNSET($this->NewAddedPrinters[$pname]);
+ }
}
}
}
}
if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
- if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
- $this->gosaDefaultPrinter= "";
- } else {
- $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
+ if($this->is_group){
+ print_red(_("GOsa default printer flag is not allowed within groups."));
+ }else{
+ if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
+ $this->gosaDefaultPrinter= "";
+ } else {
+ $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
+ }
}
}
$ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->uid."))",array("*"));
while($attr = $ldap->fetch()){
$printerObj = NULL;
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn']);
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+ $printerObj->set_acl_base($attr['dn']);
$printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->uid);
$printerObj->by_object['printgeneric']->save();
}
$ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->uid."))",array("*"));
while($attr = $ldap->fetch()){
$printerObj = NULL;
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn']);
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+ $printerObj->set_acl_base($attr['dn']);
$printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->uid);
$printerObj->by_object['printgeneric']->save();
}
foreach($this->gotoPrinter as $printer){
$printerObj = NULL;
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn']);
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
+ $printerObj->set_acl_base($printer['dn']);
+
if($printer['mode'] == "admin") {
$attribute = "goto".$s_suffix."AdminPrinter";
diff --git a/plugins/personal/environment/environment.tpl b/plugins/personal/environment/environment.tpl
index e5f70c1b2edc3f2f06571e9d1ce327a8ac8acb44..d5f729b01c9f4a9d78ca2d001aa539e44c514cfc 100644 (file)
<input type="submit" name="gotoPrinterEdit" value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
{/render}
{render acl=$gosaDefaultPrinterACL}
- <input type="submit" name="gotoPrinterDefault" value="{t}Toggle default{/t}" {if !$gotoPrinter } disabled {/if}>
+ <input type="submit" name="gotoPrinterDefault" value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
{/render}
</td>
</tr>