Ticket #4245: groupprovider_fix.diff_against_prev_impl.patch
| File groupprovider_fix.diff_against_prev_impl.patch, 1.4 KB (added by ants.aasma@…, 5 years ago) |
|---|
-
trac/perm.py
155 155 cursor = db.cursor() 156 156 groups = permissions 157 157 users = set([u[0] for u in self.env.get_known_users()]) 158 159 # Collect the implicit groups and their members. This too could use a 160 # more efficient API 161 implicit_groups = {} 162 for provider in self.group_providers: 163 for username in users: 164 for groupname in provider.get_permission_groups(username): 165 try: 166 implicit_groups[groupname].add(username) 167 except KeyError: 168 implicit_groups[groupname] = set(username) 169 158 170 result = set() 159 171 160 172 # First iteration finds all users and groups that have any of the … … 168 180 % (', '.join(['%s'] * len(groups))), groups) 169 181 groups = [] 170 182 for username, nummembers in cursor: 183 if username in implicit_groups: 184 # A group with members provided by group_providers has 185 # the necessary permissions set so add all its members. 186 result.update(implicit_groups[username]) 171 187 if username in users: 172 188 result.add(username) 173 189 elif nummembers:
