Code

Updated Winstation save:
[gosa.git] / plugins / admin / users / class_userManagement.inc
index c03c089377109af6b4ecd6b18980996bec495736..b1c2c1b2b519ec1cef8151cc422d19733a23ea76 100644 (file)
@@ -52,8 +52,6 @@ class userManagement extends plugin
     /* Creat dialog object */
     $this->DivListUsers = new divListUsers($this->config,$this);
 
-    /* LOCK MESSAGE Vars */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
   }
 
 
@@ -62,6 +60,9 @@ class userManagement extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    /* LOCK MESSAGE Vars */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/");
+
     $smarty       = get_smarty();                 // Smarty instance
     $s_action     = "";                           // Contains the action to be taken
     $s_entry      = "";                           // The value for s_action
@@ -79,6 +80,7 @@ class userManagement extends plugin
       foreach(array("del"       => "user_del",    "edit"      => "user_edit",
                     "new"       => "user_new",
                     "new_tpl"   => "user_tplnew",
+                    "create_user_from_tpl"          => "userfrom_tpl",
                     "change_pw" => "user_chgpw", 
                     "editPaste" => "editPaste",   "copy"      => "copy",
                     "cut"       => "cut") as $act => $name){
@@ -103,12 +105,34 @@ class userManagement extends plugin
       $s_tab= "user";
     }
 
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling($s_action,$s_entry);
-    if($ret){
-      return($ret);
+    /* Some may be active but diabled in gosa.conf. */
+    if(!search_config($this->config->data['TABS'], $s_tab , "CLASS")){
+      $s_tab = "user";
     }
 
+    /* Get 'dn' from posted 'uid' */
+    if(in_array_ics($s_action,array("editPaste","cut","copy"))){
+
+      if(isset($this->list[trim($s_entry)]['dn'])){
+        $dn= $this->list[trim($s_entry)]['dn'];
+      }else{
+        $dn = $this->DivListUsers->selectedBase;
+      }
+
+      $acl= get_permissions ($dn, $this->ui->subtreeACL);
+      $acl= get_module_permission($acl, "user", $dn);
+
+      if($acl != "#all#"){
+        print_red (_("You are not allowed to execute this method!")); 
+      }else{
+        /* Display the copy & paste dialog, if it is currently open */
+        $ret = $this->copyPasteHandling($s_action,$s_entry);
+        if($ret){
+          return($ret);
+        }
+      }
+    }
+  
 
     /********************
       Edit existing entry 
@@ -507,7 +531,7 @@ class userManagement extends plugin
      ********************/
 
     /* Continue template editing */
-    if ((isset($_POST['template_continue']) && $_POST['template'] != 'none' && !isset($_POST['uid']))){
+    if ((isset($_POST['template_continue'])) && ($_POST['template'] != 'none') && (!isset($_POST['uid']))){
       $this->sn             = $_POST['sn'];
       $this->givenName      = $_POST['givenName'];
 
@@ -756,6 +780,9 @@ class userManagement extends plugin
 
         /* Use the last dn to search for it's ID in the newly generated list. */
         $dn= $this->CopyPasteHandler->lastdn;
+
+        /* Get new user list */
+        $this->reload();
         foreach($this->list as $id => $entry){
           if($entry['dn'] == $dn){
             $s_entry= $id;
@@ -799,7 +826,9 @@ class userManagement extends plugin
   function save_object()
   {
     /* Handle divlist filter && department selection*/
-    $this->DivListUsers->save_object();
+    if(!is_object($this->usertab)){
+      $this->DivListUsers->save_object();
+    }
   }
 
   /* A set of disabled and therefore overloaded functions. They are