Code

Updated headers
[gosa.git] / gosa-core / plugins / admin / groups / class_groupManagement.inc
index 868c1e7aaebcc6e58cfb8ec458d0cf2b4d8f287c..7a764e80ebc9dcc6c8429ce55fb56b14697fce52 100644 (file)
@@ -1,28 +1,30 @@
 <?php
 /*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 class groupManagement extends plugin
 {
   /* Definitions */
   var $plHeadline= "Groups";
-  var $plDescription= "This does something";
+  var $plDescription= "Manage POSIX groups";
 
   /* Dialog attributes */
   var $grouptab           = NULL;
@@ -146,9 +148,56 @@ class groupManagement extends plugin
       $s_action = "multiple_edit";
     }
 
+    if(isset($_POST['menu_action']) && preg_match("/^trigger_event_DaemonEvent_notify/",$_POST['menu_action'])){
+      $s_action = "notify";
+    }
 
     $smarty= get_smarty();
 
+
+
+    /********************
+      Create notification event
+     ********************/
+
+    if($s_action == "notify"){
+
+      $ids = $this->list_get_selected_items();
+      $uids = array();
+      foreach($ids as $id){
+        $uids[] = $this->grouplist[$id]['cn'][0];
+      }
+      if(count($uids)){
+        $this->grouptab = new DaemonEvent_notify($this->config);
+        $this->grouptab->add_targets($uids);
+      }
+    }
+
+    /* Abort event dialog */
+    if(isset($_POST['abort_event_dialog'])){
+      $this->grouptab = FALSE;
+    }
+
+    /* Save event */
+    if(isset($_POST['save_event_dialog'])){
+      $o_queue = new gosaSupportDaemon();
+      $o_queue->append($this->grouptab);
+      if($o_queue->is_error()){
+        msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
+              $o_queue->get_error()),ERROR_DIALOG);
+      }else{
+        $this->grouptab = FALSE;
+      }
+    }
+
+    /* Display event */
+    if($this->grouptab instanceof DaemonEvent){
+      $this->grouptab->save_object();
+      return($this->grouptab->execute());
+    }
+
+
+
     /********************
       Copy & Paste Handling  ...
      ********************/
@@ -175,7 +224,7 @@ class groupManagement extends plugin
            react on this. */
         $this->dn= "new";
 
-        /* Create new usertab object */
+        /* Create new grouptab object */
         $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
 
         /* Set up the group ACL's for this 'dn' */
@@ -331,7 +380,7 @@ class groupManagement extends plugin
 
             /* Normally this shouldn't be reached, send some extra
                logs to notify the administrator */
-            print_red (_("You are not allowed to delete this group!"));
+            msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
             new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
           }
           /* Remove lock file after successfull deletion */
@@ -384,7 +433,7 @@ class groupManagement extends plugin
       } else {
         
         /* Obviously the user isn't allowed to delete. Show message and clean session. */
-        print_red (_("You are not allowed to delete this group!"));
+        msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
       }
     }
 
@@ -415,7 +464,7 @@ class groupManagement extends plugin
 
         /* Normally this shouldn't be reached, send some extra
            logs to notify the administrator */
-        print_red (_("You are not allowed to delete this group!"));
+        msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
         new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
       }
 
@@ -591,17 +640,16 @@ class groupManagement extends plugin
        Only perfrom this search if  ShowFunctionalGroups  is unchecked, else leave arre empty  */ 
     $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
     if ($SubSearch){
-      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
+      $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
     } else {
-      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_NONE);
+      $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
     }
     foreach($res as $attrs){
       if (!isset($primaries[$attrs['gidNumber'][0]])){
         $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
       }
     }
-   
-
     /********************
       Search for the prepared filter 
      ********************/
@@ -687,12 +735,9 @@ class groupManagement extends plugin
     /* Return C&P dialog */
     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
 
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
-
       /* Get dialog */
       $data = $this->CopyPasteHandler->execute();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
 
       /* Return dialog data */
       if(!empty($data)){