Changeset 2418
- Timestamp:
- 09/03/05 14:20:30 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykotadmin.conf.sample
r2303 r2418 51 51 52 52 # 53 # THIS FILE CAN ONLY CONTAIN A [global] SECTION AND TWO FIELDS 54 # NAMED storageadmin AND storageadminpw 53 # THIS FILE CAN ONLY CONTAIN A [global] SECTION AND ONE MANDATORY 54 # FIELD NAMED storageadmin, ALONG WITH THE FOLLOWING FOUR OPTIONAL 55 # FIELDS : storageadminpw, storagebackend, storageserver, storagename. 55 56 # 56 57 … … 61 62 # storageadminpw: Comment out if unused, or set to Quota Storage admin password 62 63 64 # storagebackend: ldapstorage 65 # storageserver: ldap://ldapmaster.example.com:389 66 # storagename: dc=example,dc=com 67 -
pykota/trunk/NEWS
r2414 r2418 22 22 PyKota NEWS : 23 23 24 - 1.23alpha24 : 25 26 - Allows different databases to be used depending on the 27 user's rights. This allows PyKota admins to directly 28 use a master LDAP server for read+write, while letting 29 normal users using the replicas for readonly access. 30 NB : using different storage backends is also possible, 31 but you're on your own there. 32 24 33 - 1.23alpha23 : 25 34 -
pykota/trunk/pykota/config.py
r2405 r2418 43 43 self.directory = directory 44 44 self.filename = os.path.join(directory, "pykota.conf") 45 self.adminfilename = os.path.join(directory, "pykotadmin.conf") 45 46 if not os.path.isfile(self.filename) : 46 47 raise PyKotaConfigError, _("Configuration file %s not found.") % self.filename 48 if not os.path.isfile(self.adminfilename) : 49 raise PyKotaConfigError, _("Configuration file %s not found.") % self.adminfilename 50 if os.access(self.adminfilename, os.R_OK) : 51 self.isAdmin = 1 47 52 self.config = ConfigParser.ConfigParser() 48 53 self.config.read([self.filename]) … … 97 102 backendinfo["storageadmin"] = None 98 103 backendinfo["storageadminpw"] = None 99 adminconf = ConfigParser.ConfigParser() 100 filename = os.path.join(self.directory, "pykotadmin.conf") 101 adminconf.read([filename]) 102 if adminconf.sections() : # were we able to read the file ? 103 try : 104 backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1) 105 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : 106 raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", filename) 107 else : 108 self.isAdmin = 1 # We are a PyKota administrator 109 try : 110 backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1) 111 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : 112 pass # Password is optional 104 if self.isAdmin : 105 adminconf = ConfigParser.ConfigParser() 106 adminconf.read([self.adminfilename]) 107 if adminconf.sections() : # were we able to read the file ? 108 try : 109 backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1) 110 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : 111 raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", self.adminfilename) 112 try : 113 backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1) 114 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : 115 pass # Password is optional 116 # Now try to overwrite the storagebackend, storageserver 117 # and storagename. This allows admins to use the master LDAP 118 # server directly and users to use the replicas transparently. 119 try : 120 backendinfo["storagebackend"] = adminconf.get("global", "storagebackend", raw=1) 121 except ConfigParser.NoOptionError : 122 pass 123 try : 124 backendinfo["storageserver"] = adminconf.get("global", "storageserver", raw=1) 125 except ConfigParser.NoOptionError : 126 pass 127 try : 128 backendinfo["storagename"] = adminconf.get("global", "storagename", raw=1) 129 except ConfigParser.NoOptionError : 130 pass 113 131 return backendinfo 114 132 -
pykota/trunk/pykota/storages/ldapstorage.py
r2388 r2418 72 72 for tryit in range(3) : 73 73 try : 74 self.tool.logdebug("Trying to open database (host=%s, dbname=%s, user=%s)..." % (self.savedhost, self.saveddbname, self.saveduser)) 74 75 self.database = ldap.initialize(self.savedhost) 75 76 if self.info["ldaptls"] : -
pykota/trunk/pykota/storages/pgstorage.py
r2302 r2418 48 48 port = -1 # Use PostgreSQL's default tcp/ip port (5432). 49 49 50 self.tool.logdebug("Trying to open database (host=%s, port=%s, dbname=%s, user=%s)..." % (host, port, dbname, user)) 50 51 self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd) 51 52 self.closed = 0 -
pykota/trunk/pykota/version.py
r2413 r2418 22 22 # 23 23 24 __version__ = "1.23alpha2 3_unofficial"24 __version__ = "1.23alpha24_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS and LPRng."