Changeset 1147
- Timestamp:
- 10/07/03 16:23:25 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykota.conf.sample
r1130 r1147 55 55 # If unset, caching is disabled. Possible values Y/N/YES/NO 56 56 # caching mechanism works with both PostgreSQL and OpenLDAP backends 57 # but may be interesting only with OpenLDAP. 57 # but may be really interesting only with OpenLDAP. 58 # 59 # ACTIVATING CACHE IS HEAVILY RECOMMANDED WITH THE LDAP BACKEND ! 60 # 58 61 storagecaching: No 59 62 -
pykota/trunk/pykota/storages/ldapstorage.py
r1144 r1147 22 22 # 23 23 # $Log$ 24 # Revision 1.32 2003/10/07 14:23:25 jalet 25 # More work on cache 26 # 24 27 # Revision 1.31 2003/10/07 09:07:30 jalet 25 28 # Character encoding added to please latest version of Python … … 405 408 """Returns the user's groups list.""" 406 409 groups = [] 407 result = self.doSearch("(&(objectClass=pykotaGroup)(%s=%s))" % (self.info["groupmembers"], user.Name), [self.info["grouprdn"] ], base=self.info["groupbase"])410 result = self.doSearch("(&(objectClass=pykotaGroup)(%s=%s))" % (self.info["groupmembers"], user.Name), [self.info["grouprdn"], "pykotaGroupName", "pykotaLimitBy"], base=self.info["groupbase"]) 408 411 if result : 409 412 for (groupid, fields) in result : 410 groups.append(self.getGroup(fields.get(self.info["grouprdn"])[0])) 413 groupname = (fields.get("pykotaGroupName", [None]) or fields.get(self.info["grouprdn"], [None]))[0] 414 group = self.getFromCache("GROUPS", groupname) 415 if group is None : 416 group = StorageGroup(self, groupname) 417 group.ident = groupid 418 group.LimitBy = fields.get("pykotaLimitBy") 419 if group.LimitBy is not None : 420 group.LimitBy = group.LimitBy[0] 421 group.AccountBalance = 0.0 422 group.LifeTimePaid = 0.0 423 for member in self.getGroupMembers(group) : 424 if member.Exists : 425 group.AccountBalance += member.AccountBalance 426 group.LifeTimePaid += member.LifeTimePaid 427 group.Exists = 1 428 self.cacheEntry("GROUPS", group.Name, group) 429 groups.append(group) 411 430 return groups 412 431