Changeset 1105 for pykota/trunk
- Timestamp:
- 07/28/03 11:11:12 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r1089 r1105 23 23 # 24 24 # $Log$ 25 # Revision 1.55 2003/07/28 09:11:12 jalet 26 # PyKota now tries to add its attributes intelligently in existing LDAP 27 # directories. 28 # 25 29 # Revision 1.54 2003/07/21 06:32:42 jalet 26 30 # Prevents email messages to be sent at modification/creation time for … … 445 449 else : 446 450 self.logger.log_message(_("Prototype object %s not found in Quota Storage.") % protoentry.Name) 451 447 452 if not options["noquota"] : 448 453 if hardlimit is None : … … 469 474 if not options["groups"] : 470 475 changed[entry.Name]["ingroups"] = [] 471 if not entrypquota.Exists : 476 477 if not entry.Exists : 472 478 # not found 473 479 if options["add"] : … … 477 483 # only remotely 478 484 if self.isValidName(entry.Name) : 479 if not entry.Exists : 480 entry = getattr(self.storage, "add%s" % suffix)(entry) 481 entrypquota = getattr(self.storage, "add%sPQuota" % suffix)(entry, printer) 485 entry = getattr(self.storage, "add%s" % suffix)(entry) 482 486 else : 483 487 if options["groups"] : … … 485 489 else : 486 490 self.logger.log_message(_("Invalid user name %s") % entry.Name) 491 492 if not entrypquota.Exists : 493 # not found 494 if options["add"] : 495 entrypquota = getattr(self.storage, "add%sPQuota" % suffix)(entry, printer) 496 487 497 if not entrypquota.Exists : 488 498 self.logger.log_message(_("Quota not found for object %s on printer %s.") % (entry.Name, printer.Name)) -
pykota/trunk/conf/pykota.conf.sample
r1095 r1105 73 73 #groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com 74 74 #lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com 75 # 76 # How to create new accounts and groups 77 # authorized values are "below" and "attach(objectclass name)" 78 # 79 # "below" creates the new accounts/groups as standalone entries 80 # below the above defined 'userbase' ou 81 # 82 # attach(objectclass name) tries to find some existing user/group 83 # using the above defined 'userrdn' or 'grouprdn' and 'userbase' 84 # 'groupbase', and attach the PyKota specific entries to it. 85 # 86 # a possible value: newuser: attach(posixAccount) 87 newuser : below 88 newgroup : below 89 75 90 # 76 91 # Choose what attribute contains the list of group members -
pykota/trunk/NEWS
r1099 r1105 22 22 PyKota NEWS : 23 23 24 - 1.14beta : 25 26 - Two new LDAP-specific configuration fields were introduced, 27 newuser and newgroup. Use them to specify if you want to add 28 quota information to existing entries or elsewhere. 29 See sample configuration file for details. 30 24 31 - 1.14alpha9 : 25 32 -
pykota/trunk/pykota/config.py
r1087 r1105 21 21 # 22 22 # $Log$ 23 # Revision 1.34 2003/07/28 09:11:12 jalet 24 # PyKota now tries to add its attributes intelligently in existing LDAP 25 # directories. 26 # 23 27 # Revision 1.33 2003/07/16 21:53:07 jalet 24 28 # Really big modifications wrt new configuration file's location and content. … … 231 235 "userquotabase", "groupquotabase", \ 232 236 "jobbase", "lastjobbase", \ 237 "newuser", "newgroup", \ 233 238 ] : 234 ldapinfo[option] = self.getGlobalOption(option) 239 ldapinfo[option] = self.getGlobalOption(option).strip() 240 for field in ["newuser", "newgroup"] : 241 if ldapinfo[field].lower().startswith('attach(') : 242 ldapinfo[field] = ldapinfo[field][7:-1] 235 243 return ldapinfo 236 244 -
pykota/trunk/pykota/storages/ldapstorage.py
r1099 r1105 21 21 # 22 22 # $Log$ 23 # Revision 1.21 2003/07/28 09:11:12 jalet 24 # PyKota now tries to add its attributes intelligently in existing LDAP 25 # directories. 26 # 23 27 # Revision 1.20 2003/07/25 10:41:30 jalet 24 28 # Better documentation. … … 468 472 def addUser(self, user) : 469 473 """Adds a user to the quota storage, returns it.""" 470 fields = { self.info["userrdn"] : user.Name, 471 "objectClass" : ["pykotaObject", "pykotaAccount", "pykotaAccountBalance"], 472 "cn" : user.Name, 473 "pykotaUserName" : user.Name, 474 "pykotaLimitBY" : (user.LimitBy or "quota"), 475 "pykotaBalance" : str(user.AccountBalance or 0.0), 476 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), 477 } 478 dn = "%s=%s,%s" % (self.info["userrdn"], user.Name, self.info["userbase"]) 479 self.doAdd(dn, fields) 474 newfields = { 475 "pykotaUserName" : user.Name, 476 "pykotaLimitBY" : (user.LimitBy or "quota"), 477 "pykotaBalance" : str(user.AccountBalance or 0.0), 478 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), 479 } 480 mustadd = 1 481 if self.info["newuser"].lower() != 'below' : 482 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (self.info["newuser"], self.info["userrdn"], user.Name), None, base=self.info["userbase"]) 483 if result : 484 (dn, fields) = result[0] 485 fields["objectClass"].extend(["pykotaAccount", "pykotaAccountBalance"]) 486 fields.update(newfields) 487 self.doModify(dn, fields) 488 mustadd = 0 489 490 if mustadd : 491 fields = { self.info["userrdn"] : user.Name, 492 "objectClass" : ["pykotaObject", "pykotaAccount", "pykotaAccountBalance"], 493 "cn" : user.Name, 494 } 495 fields.update(newfields) 496 dn = "%s=%s,%s" % (self.info["userrdn"], user.Name, self.info["userbase"]) 497 self.doAdd(dn, fields) 480 498 return self.getUser(user.Name) 481 499 482 500 def addGroup(self, group) : 483 501 """Adds a group to the quota storage, returns it.""" 484 fields = { self.info["grouprdn"] : group.Name, 485 "objectClass" : ["pykotaObject", "pykotaGroup"], 486 "cn" : group.Name, 487 "pykotaGroupName" : group.Name, 488 "pykotaLimitBY" : (group.LimitBy or "quota"), 489 } 490 dn = "%s=%s,%s" % (self.info["grouprdn"], group.Name, self.info["groupbase"]) 491 self.doAdd(dn, fields) 502 newfields = { 503 "pykotaGroupName" : group.Name, 504 "pykotaLimitBY" : (group.LimitBy or "quota"), 505 } 506 mustadd = 1 507 if self.info["newgroup"].lower() != 'below' : 508 result = self.doSearch("(&(objectClass=%s)(%s=%s))" % (self.info["newgroup"], self.info["grouprdn"], group.Name), None, base=self.info["groupbase"]) 509 if result : 510 (dn, fields) = result[0] 511 fields["objectClass"].extend(["pykotaGroup"]) 512 fields.update(newfields) 513 self.doModify(dn, fields) 514 mustadd = 0 515 516 if mustadd : 517 fields = { self.info["grouprdn"] : group.Name, 518 "objectClass" : ["pykotaObject", "pykotaGroup"], 519 "cn" : group.Name, 520 } 521 fields.update(newfields) 522 dn = "%s=%s,%s" % (self.info["grouprdn"], group.Name, self.info["groupbase"]) 523 self.doAdd(dn, fields) 492 524 return self.getGroup(group.Name) 493 525 -
pykota/trunk/pykota/version.py
r1099 r1105 21 21 # 22 22 23 __version__ = "1.14 alpha9_unofficial"23 __version__ = "1.14beta_unofficial" 24 24 25 25 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng.""" -
pykota/trunk/setup.py
r1095 r1105 23 23 # 24 24 # $Log$ 25 # Revision 1.21 2003/07/28 09:11:12 jalet 26 # PyKota now tries to add its attributes intelligently in existing LDAP 27 # directories. 28 # 25 29 # Revision 1.20 2003/07/23 16:51:32 jalet 26 30 # waitprinter.sh is now included to prevent PyKota from asking the … … 241 245 sys.stderr.write("INSTALLATION ABORTED FOR SECURITY REASONS.\n") 242 246 sys.exit(-1) 247 248 # warns for new LDAP fields 249 if sb.get("storagebackend") == "ldapstorage" : 250 newuser = conf.getGlobalOption("newuser", ignore=1) 251 newgroup = conf.getGlobalOption("newgroup", ignore=1) 252 if not (newuser and newgroup) : 253 sys.stderr.write("From version 1.14 on, PyKota LDAP Support needs two additional configuration fields.\n") 254 sys.stderr.write("Please put the 'newuser' and 'newgroup' configuration fields in a [global] section in /etc/pykota/pykota.conf\n") 255 sys.stderr.write("You can look at the conf/pykota.conf.sample file for examples.\n") 256 sys.stderr.write("YOU HAVE TO DO THESE MODIFICATIONS MANUALLY, AND RESTART THE INSTALLATION.\n") 257 sys.stderr.write("INSTALLATION ABORTED BECAUSE CONFIGURATION INCOMPLETE.\n") 258 sys.exit(-1) 243 259 244 260 # change files permissions