File: 1012_Revert-fix-member-array-if-no-member-is-present.patch

package info (click to toggle)
gosa 2.8~git20230203.10abe45%2Bdfsg-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,108 kB
  • sloc: php: 32,102; javascript: 10,836; pascal: 3,776; xml: 3,135; sh: 852; python: 162; makefile: 45; perl: 2
file content (46 lines) | stat: -rw-r--r-- 1,874 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 4502d2867808ccaef37fd98dfc7a7b9b7c6a8a9c Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Sun, 13 Aug 2023 17:54:20 +0200
Subject: [PATCH 2/9] Revert "fix member array if no member is present"

This reverts commit 8e5da7d93fc7a5864a5378d2f2466c6f3d03bd47.

Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
 plugins/admin/groups/class_group.inc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/plugins/admin/groups/class_group.inc
+++ b/plugins/admin/groups/class_group.inc
@@ -818,7 +818,7 @@
             }
             $this->attrs['member']= $temp;
         }else {
-            $this->attrs['member'][]= $this->dn;
+            $this->attrs['member']= $this->dn;
         }
 
         // Save data. Using 'modify' implies that the entry is already present, 
@@ -827,7 +827,7 @@
         if ($ldap->fetch()){
             // Modify needs array() to remove values :-( 
             if (!count($this->members)){
-                $this->attrs['member'][]= $this->dn;;
+                $this->attrs['member']= $this->dn;;
             }
             if (!$this->smbgroup){
                 $this->attrs['sambaGroupType']= array();
@@ -853,9 +853,11 @@
                 msg_dialog::display(_("Warning"),sprintf(_("The gidNumber '%s' is already in use by %s!"),$this->gidNumber,$cns) , WARNING_DIALOG );
             }
         }
-
+        
         // check if members are added to the group and delete redundancies
-        $this->attrs['member'] = array_unique($this->attrs['member']);
+        if ($this->dn !== $this->attrs['member'] && !in_array($this->dn, $this->attrs['member'])) {
+            $this->attrs['member'] = array_unique($this->attrs['member']);
+        }
 
         // if the member array is empty nothing is saved or updated
         if (count($this->attrs['member'])) {