diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc
index ced638067314d75935daf0ae0f90306f8cac3d95..df051b4733936b8b2bb21eee776e581dc8eb9ed5 100644 (file)
// Post for new
}elseif(preg_match("/^group_new.*/",$key)){
$s_action="new";
- }elseif(preg_match("/^group_tplnew.*/i",$key)){
- $s_action="new_tpl";
- }elseif(preg_match("/^group_chgpw.*/i",$key)){
- $s_action="change_pw";
- $s_entry = preg_replace("/group_chgpw_/i","",$key);
}elseif(preg_match("/^editPaste.*/i",$key)){
$s_action="editPaste";
}elseif(preg_match("/^copy_.*/",$key)){
Copy & Paste handling
****************/
- /* Only perform copy / paste if it is enabled
- */
- if($this->CopyPasteHandler){
-
- /* Paste copied/cutted object in here
- */
- if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
- $this->CopyPasteHandler->save_object();
- $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
- return($this->CopyPasteHandler->execute());
- }
-
- /* Copy current object to CopyHandler
- */
- if($s_action == "copy"){
- $this->CopyPasteHandler->Clear();
- $dn = $this->ogrouplist[$s_entry]['dn'];
- $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
- $objNew = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
- $this->CopyPasteHandler->Copy($obj,$objNew);
- }
-
- /* Copy current object to CopyHandler
- */
- if($s_action == "cut"){
- $this->CopyPasteHandler->Clear();
- $dn = $this->ogrouplist[$s_entry]['dn'];
- $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
- $this->CopyPasteHandler->Cut($obj);
- }
+ /* Display the copy & paste dialog, if it is currently open */
+ $ret = $this->copyPasteHandling($s_action,$s_entry);
+ if($ret){
+ return($ret);
}
-
/****************
Create a new object group
****************/
$this->dn= "new";
/* Create new usertab object */
- $this->ogroup= new ogrouptabs($this->config,
- $this->config->data['TABS']['OGROUPTABS'], $this->dn);
+ $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
+ $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
}
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $this->acl= get_module_permission($acl, "ogroup", $this->dn);
- if (chkacl($this->acl, "delete") == ""){
+ $acl = $this->ui->get_permissions($this->dn,"ogroups");
+ if(preg_match("/d/",$acl)){
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
/* Some nice guy may send this as POST, so we've to check
for the permissions again. */
- if (chkacl($this->acl, "delete") == ""){
+ $acl = $this->ui->get_permissions($this->dn,"ogroups");
+ if(preg_match("/d/",$acl)){
/* Delete request is permitted, perform LDAP action */
$this->ogroup= new ogrouptabs($this->config,
$this->config->data['TABS']['OGROUPTABS'], $this->dn);
- $this->ogroup->set_acl(array($this->acl));
$this->ogroup->delete ();
gosa_log ("Object group'".$this->dn."' has been removed");
unset ($this->ogroup);
above dialog */
add_lock ($this->dn, $this->ui->dn);
- /* Set up the users ACL's for this 'dn' */
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-
/* Register grouptab to trigger edit dialog */
- $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'],
- $this->dn);
- $this->ogroup->set_acl($acl);
+ $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
+ $this->ogroup->set_acl_base($this->dn);
$_SESSION['objectinfo']= $this->dn;
}
****************/
/* Cancel dialogs */
- if (isset($_POST['edit_cancel'])){
+ if ((isset($_POST['edit_cancel'])) && (isset($this->ogroup->dn))){
del_lock ($this->ogroup->dn);
unset ($this->ogroup);
$this->ogroup= NULL;
Display list
****************/
+ /* Check if there is a snapshot dialog open */
+ $base = $this->DivListOGroup->selectedBase;
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+ return($str);
+ }
+
/* Display dialog with group list */
$this->DivListOGroup->parent = $this;
$this->DivListOGroup->execute();
}
+ /* Return departments, that will be included within snapshot detection */
+ function get_used_snapshot_bases()
+ {
+ return(array(get_groups_ou().$this->DivListOGroup->selectedBase));
+ }
+
+
+
function convert_list($input)
{
$temp= "";
$p1['tit']= $conv[$type[0]][1];
$p1['alt']= $type[0];
$p1['lnk']= $conv[$type[0]][2];
+ $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
} else {
$p1['pic']= "empty.png";
$p1['tit']= "";
$p1['alt']= "";
$p1['lnk']= "";//$conv[$type[0]][2];
+ $html_object_1 = "<img ";
}
if (isset($type[1])){
$p2['alt']= $type[1];
$p2['tit']= $conv[$type[1]][1];
$p2['lnk']= $conv[$type[1]][2];
+ $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
} else {
$p2['pic']= "empty.png";
$p2['alt']= "";
$p2['tit']= "";
$p2['lnk']= ""; //$conv[$type[0]][2];
+ $html_object_2 = "<img ";
}
- $temp = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' class='center'
+
+ $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."'
src='images/".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
- $temp.= "<input type='image' name='".$p2['lnk']."_group_edit_%KEY'class='center'
+ $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."'
src='images/".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
return ($temp);
}
function reload()
{
/* Set base for all searches && initialise some vars */
- $this->oogrouplist= array();
+ $this->ogrouplist= array();
$base = $this->DivListOGroup->selectedBase;
$filter = "(gosaGroupObjects=[])";
$Regex = $this->DivListOGroup->Regex;
$filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
if($this->DivListOGroup->SubSearch){
- $res= get_list($filter, $this->ui->subtreeACL, $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
+ $res= get_list($filter, "ogroups", $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
}else{
- $res= get_list($filter, $this->ui->subtreeACL, get_groups_ou().$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
+ $res= get_list($filter, "ogroups", get_groups_ou().$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
}
$this->ogrouplist= $res;
reset ($this->ogrouplist);
}
+
+ function copyPasteHandling($s_action,$s_entry)
+ {
+ if($this->CopyPasteHandler){
+
+ /* Paste copied/cutted object in here
+ */
+ if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+ $this->CopyPasteHandler->save_object();
+ $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
+ return($this->CopyPasteHandler->execute());
+ }
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "copy"){
+
+
+ $this->CopyPasteHandler->Clear();
+ $dn = $this->ogrouplist[$s_entry]['dn'];
+
+ /* Check acls */
+ $acl_all= $this->ui->has_complete_category_acls($dn,"ogroups");
+ if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+ $objNew = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
+
+ $types_of_tabs = $obj->by_object['ogroup']->gosaGroupObjects;
+ $objNew->by_object['ogroup']->gosaGroupObjects = $types_of_tabs;
+ $objNew->reload($types_of_tabs);
+
+ $this->CopyPasteHandler->Copy($obj,$objNew);
+ }
+ }
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "cut"){
+ $this->CopyPasteHandler->Clear();
+ $dn = $this->ogrouplist[$s_entry]['dn'];
+
+ /* Check acls */
+ $acl_all= $this->ui->has_complete_category_acls($dn,"ogroups");
+ if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+ $this->CopyPasteHandler->Cut($obj);
+ }
+ }
+ }
+ }
+
+
function save_object()
{
$this->DivListOGroup->save_object();