File: 1011_Revert-bugfix-for-users-group-membership-after-group.patch

package info (click to toggle)
gosa 2.8~git20230203.10abe45%2Bdfsg-1%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,364 kB
  • sloc: php: 32,085; javascript: 10,836; pascal: 3,775; xml: 3,135; sh: 852; python: 162; makefile: 45; perl: 2
file content (135 lines) | stat: -rw-r--r-- 5,128 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From 74bd0bb635138c0f3269dd773734060f2eef8694 Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Sun, 13 Aug 2023 17:54:18 +0200
Subject: [PATCH 1/9] Revert "bugfix for users group membership after groups
 extensions."

This reverts commit e2f756f23cc9477c2d91820c1f083347e8fa4b60.

Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
 plugins/admin/groups/class_group.inc          | 22 ++++++++-----------
 plugins/personal/posix/class_posixAccount.inc | 17 +++++---------
 2 files changed, 15 insertions(+), 24 deletions(-)

--- a/plugins/admin/groups/class_group.inc
+++ b/plugins/admin/groups/class_group.inc
@@ -244,8 +244,8 @@
                 $action = $this->$list->getAction();
                 if($action['action'] == 'delete' && preg_match("/w/",$this->getacl("member"))){
                     foreach ($action['targets'] as $id){
-                        $value = $this->$list->getData($id);
-                        $this->removeMember($value['dn']);
+                        $value = $this->$list->getKey($id);
+                        $this->removeMember($value);
                     }
                 }
             }
@@ -547,12 +547,10 @@
     }
 
     // remove the member using the array id
-    function removeMember($dn)
+    function removeMember($id)
     {
-        foreach ($this->members as $key => $member) {
-            if ($dn == $member['dn']) {
-                unset($this->members[$key]);
-            }
+        if(isset($this->members[$id])){
+            unset($this->members[$id]);
         }
 
         /** 
@@ -562,10 +560,8 @@
          * So we have to remove the specified member from both arrays.
         */ 
         if($this->multiple_support_active){
-            foreach ($this->members_used_by_some as $key => $member) {
-                if ($dn == $member) {
-                    unset($this->members_used_by_some[$key]);
-                }
+            if(isset($this->members_used_by_some[$id])){
+                unset($this->members_used_by_some[$id]);
             }
         }
     }
@@ -822,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, 
@@ -831,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();
--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -3,7 +3,7 @@
  * This code is part of GOsa (http://www.gosa-project.org)
  * Copyright (C) 2003-2008 GONICUS GmbH
  *
- * ID: $$Id: class_posixAccount.inc 21142 2012-05-02 12:24:10Z hickert $$
+ * 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
@@ -178,7 +178,7 @@
       /* Get group membership */
       $this->groupListData = array();
       $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=posixGroup)(member=".$dn."))", array("cn", "description"));
+      $ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("cn", "description"));
 
       while ($attrs= $ldap->fetch()){
         if (!isset($attrs["description"][0])){
@@ -485,11 +485,7 @@
       $smarty->assign("groupMembership_some", set_post($this->groupMembership_some));
     }
 
-    if (count($this->groupMembership) > 16){
-      $smarty->assign("groups", "too_many_for_nfs");
-    } else {
-      $smarty->assign("groups", "");
-    }
+    $smarty->assign("groups", "");
 
     /* Avoid "Undefined index: forceMode" */
     $smarty->assign("forceMode", "");
@@ -884,7 +880,7 @@
       if (!isset($this->savedGroupMembership[$key])){
         $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
         $g->set_acl_base($key);
-        $g->by_object['group']->addMember($this->dn);
+        $g->by_object['group']->addUser($this->uid);
         $g->save();
       }
     }
@@ -894,7 +890,7 @@
       if (!isset($this->groupMembership[$key])){
         $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
         $g->set_acl_base($key);
-        $g->by_object['group']->removeMember($this->dn);
+        $g->by_object['group']->removeUser ($this->uid);
         $g->save();
       }
     }
@@ -1178,8 +1174,7 @@
     }
 
     /* Adjust shadow checkboxes */
-    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
-          "shadowExpire") as $val){
+    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive") as $val){
       if ($this->$val != 0){
         $oval= "activate_".$val;
         $this->$oval= "1";