Code

Fixed self edit mode
[gosa.git] / plugins / personal / posix / class_posixAccount.inc
index 6111b840555af05aaa95da4ad65847087d8f1bc2..a67d03b95f1afda74da42c4534294c8c1963d733 100644 (file)
@@ -226,6 +226,8 @@ class posixAccount extends plugin
   /* execute generates the html output for this node */
   function execute($isCopyPaste = false)
   {
+    echo "Fix get_list for group add";
+
     /* Call parent execute */
     plugin::execute();
     $display= "";
@@ -236,9 +238,14 @@ class posixAccount extends plugin
     }
 
     if(!$isCopyPaste){
+
       /* 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 posixAccount? */
@@ -294,7 +301,7 @@ class posixAccount extends plugin
     if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) &&
         count($_POST['groups'])){
 
-      /* FIX ME  put the acl check into addGroup function*/
+      echo "FIXME, 302,  put the acl check into addGroup function ";
       #if (chk acl ($this->acl, "memberUid") == ""){
       #  $this->addGroup ($_POST['groups']);
       #  $this->is_modified= TRUE;
@@ -305,7 +312,7 @@ class posixAccount extends plugin
     if (isset($_POST['delete_groupmembership']) && 
         isset($_POST['group_list']) && count($_POST['group_list'])){
 
-      /* FIX ME  put the acl check into addGroup function*/
+      echo "FIXME, 302,  put the acl check into addGroup function ";
       #if (chk acl ($this->acl, "memberUid") == ""){
       #  $this->delGroup ($_POST['group_list']);
       #  $this->is_modified= TRUE;
@@ -591,7 +598,7 @@ class posixAccount extends plugin
   function remove_from_parent()
   {
     /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
       return;
     }
 
@@ -640,17 +647,19 @@ class posixAccount extends plugin
       /* Save values to object */
       plugin::save_object();
 
+
       /* Save force GID checkbox */
-      if (isset ($_POST['force_ids'])){
-        $data= 1;
-      } else {
-        $data= 0;
-      }
-      if ($this->force_ids != $data){
-        $this->is_modified= TRUE;
+      if($this->acl_is_writeable("gidNumber") || $this->acl_is_writeable("uidNumber")){
+        if (isset ($_POST['force_ids'])){
+          $data= 1;
+        } else {
+          $data= 0;
+        }
+        if ($this->force_ids != $data){
+          $this->is_modified= TRUE;
+        }
+        $this->force_ids= $data;
       }
-      $this->force_ids= $data;
-
 
       /*Save primary group settings */
       if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){