Changeset 1021
- Timestamp:
- 06/10/03 18:37:54 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 1 added
- 2 removed
- 11 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/repykota
r1017 r1021 23 23 # 24 24 # $Log$ 25 # Revision 1.37 2003/06/10 16:37:54 jalet 26 # Deletion of the second user which is not needed anymore. 27 # Added a debug configuration field in /etc/pykota.conf 28 # All queries can now be sent to the logger in debug mode, this will 29 # greatly help improve performance when time for this will come. 30 # 25 31 # Revision 1.36 2003/06/06 14:21:08 jalet 26 32 # New LDAP schema. … … 291 297 292 298 # Initializes the command line tool 293 reporter = RePyKota( asadmin=0,doc=__doc__)299 reporter = RePyKota(doc=__doc__) 294 300 295 301 # parse and checks the command line -
pykota/trunk/conf/pykota.conf.sample
r1016 r1021 26 26 [global] 27 27 # Storage backend for quotas 28 # only P ostgreSQLis supported28 # only PGStorage (PostgreSQL) is supported 29 29 # Ldap, MySQL, Berkeley are planned 30 storagebackend: postgresql 30 31 # the 'postgresql' value is deprecated, use 'pgstorage' instead. 32 storagebackend: pgstorage 31 33 32 34 # Quota Storage Server hostname (and optional port) … … 40 42 # Quota Storage administrator's and normal user's names and passwords 41 43 storageadmin: pykotaadmin 42 storageuser: pykotauser43 44 # storageadminpw: Comment out if unused, or set to Quota Storage admin password 44 # storageuserpw: Comment out if unused, or set to Quota Storage user password 45 46 # NB : storageuser and storageuserpw are not used anymore 45 47 46 48 # LDAP example : … … 57 59 # if the value is not set then the default SYSTEM applies. 58 60 logger: system 61 62 # Enable debugging ? Put YES instead here. 63 debug : No 59 64 60 65 # Mail server to use to warn users -
pykota/trunk/docs/installation.sgml
r1015 r1021 131 131 To do so, you'll have to feed <application>PostgreSQL</application> with the 132 132 <filename>pykota-x.xx/initscripts/postgresql/pykota-postgresql.sql</filename> file. 133 This file will create a Quota DataBase administrator and a Quota DataBase user 134 in the <application>PostgreSQL</application> system, then create an empty 133 This file will create a Quota DataBase administrator in the <application>PostgreSQL</application> system, then create an empty 135 134 Quota DataBase and set some permissions on it. The Quota DataBase administrator 136 will be able to add printers, users and groups to the Quota DataBase, while 137 the Quota DataBase user will be used to update the print quota usage 138 in the Quota DataBase. None of these two users is present in the Quota Database 139 itself, they are only defined in <application>PostgreSQL</application> and don't 140 have to exist on any system, nor in the Quota DataBase. Their default names 141 are <literal>pykotaadmin</literal> for the administrator and <literal>pykotauser</literal> 142 for the user. The database which will be created will be named <literal>pykota</literal>. 135 is the <application>PostgreSQL</application>'s user used to manage the Quota database. 136 The Quota DataBase Administrator is not present in the Quota Database 137 itself, he is only defined in <application>PostgreSQL</application> and don't 138 have to exist on any system, nor in the Quota DataBase. His default names 139 is <literal>pykotaadmin</literal>. 140 The database which will be created will be named <literal>pykota</literal> by default. 143 141 <note> 144 142 <title>Note</title> … … 179 177 For security reasons, you may want to set passwords in 180 178 <application>PostgreSQL</application> for the 181 <literal>pykotaadmin</literal> and <literal>pykotauser</literal>182 users.Otherwise any user able to connect to179 <literal>pykotaadmin</literal> user. 180 Otherwise any user able to connect to 183 181 <application>PostgreSQL</application> on your Quota Storage Server 184 could connect to the quota database as one of themand modify it without problem.182 could connect to the quota database as this user, and modify it without problem. 185 183 </para> 186 184 187 185 <para> 188 186 To do so, just type the following lines while still being at the <application>psql</application> 189 prompt (replace the password svalues by your own) :187 prompt (replace the password values by your own) : 190 188 <screen> 191 189 pykota=# ALTER USER pykotaadmin PASSWORD 'somepassword'; 192 ALTER USER193 pykota=# ALTER USER pykotauser PASSWORD 'anotherpassword';194 190 ALTER USER 195 191 pykota=# \q … … 253 249 254 250 <para> 255 An <application>LDAP</application> Storage Backend is planned, but it actually 256 doesn't exist. Some people may already be working on this, though. 251 An <application>LDAP</application> Storage Backend is currently under heavy work. 252 You can already give a look at the LDAP schema which was defined for PyKota. 253 Full support for LDAP in PyKota should be OK by the end of July 2003, if all 254 continues to go well. 257 255 </para> 258 256 </sect2> … … 374 372 375 373 $Log$ 374 Revision 1.15 2003/06/10 16:37:54 jalet 375 Deletion of the second user which is not needed anymore. 376 Added a debug configuration field in /etc/pykota.conf 377 All queries can now be sent to the logger in debug mode, this will 378 greatly help improve performance when time for this will come. 379 376 380 Revision 1.14 2003/06/05 07:12:29 jalet 377 381 Reorganization of directories -
pykota/trunk/initscripts/postgresql/pykota-postgresql.sql
r1015 r1021 20 20 -- 21 21 -- $Log$ 22 -- Revision 1.2 2003/06/10 16:37:54 jalet 23 -- Deletion of the second user which is not needed anymore. 24 -- Added a debug configuration field in /etc/pykota.conf 25 -- All queries can now be sent to the logger in debug mode, this will 26 -- greatly help improve performance when time for this will come. 27 -- 22 28 -- Revision 1.1 2003/06/05 07:12:31 jalet 23 29 -- Reorganization of directories … … 41 47 -- Create the print quota database users 42 48 -- 43 CREATE USER pykotauser;44 49 CREATE USER pykotaadmin; 45 50 … … 120 125 GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON users, groups, printers, userpquota, grouppquota, groupsmembers, jobhistory TO pykotaadmin; 121 126 GRANT SELECT, UPDATE ON users_id_seq, groups_id_seq, printers_id_seq, userpquota_id_seq, grouppquota_id_seq, jobhistory_id_seq TO pykotaadmin; 122 GRANT SELECT, UPDATE ON printers, userpquota, grouppquota TO pykotauser;123 GRANT SELECT ON users, groups, groupsmembers TO pykotauser;124 GRANT SELECT, INSERT, UPDATE ON jobhistory TO pykotauser;125 GRANT SELECT, UPDATE ON jobhistory_id_seq TO pykotauser;126 127 -
pykota/trunk/NEWS
r1019 r1021 22 22 PyKota NEWS : 23 23 24 - 1.08alpha8 : 25 26 - Code refactoring. 27 - A single user/password pair is used to connect 28 to the database backend. The storageuser configuration 29 field, and its associated passwords storageuserpw, are 30 not used anymore. 31 24 32 - 1.08alpha7 : 25 33 -
pykota/trunk/pykota/config.py
r1000 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.28 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.27 2003/05/27 23:00:21 jalet 24 30 # Big rewrite of external accounting methods. … … 183 189 for option in [ "storagebackend", "storageserver", \ 184 190 "storagename", "storageadmin", \ 185 "storageuser", \186 191 ] : 187 192 backendinfo[option] = self.getGlobalOption(option) 188 for option in [ "storageadminpw", "storageuserpw" ] : 189 backendinfo[option] = self.getGlobalOption(option, ignore=1) 193 backendinfo["storageadminpw"] = self.getGlobalOption("storageadminpw", ignore=1) 190 194 return backendinfo 191 195 … … 304 308 except ValueError : 305 309 raise PyKotaConfigError, _("Invalid grace delay %s") % gd 310 311 def getDebug(self) : 312 """Returns 1 if debugging is activated, else 0.""" 313 debug = self.getGlobalOption("debug", ignore=1) 314 if (debug is not None) and (debug.upper().strip() in ['Y', 'YES', '1', 'ON', 'O']) : 315 return 1 316 else : 317 return 0 -
pykota/trunk/pykota/logger.py
r952 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.7 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.6 2003/04/23 22:13:57 jalet 24 30 # Preliminary support for LPRng added BUT STILL UNTESTED. … … 55 61 __str__ = __repr__ 56 62 57 def openLogger( config) :63 def openLogger(pykotatool) : 58 64 """Returns the appropriate logger subsystem object.""" 59 backend = config.getLoggingBackend()65 backend = pykotatool.config.getLoggingBackend() 60 66 try : 61 67 if not backend.isalpha() : -
pykota/trunk/pykota/storage.py
r952 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.13 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.12 2003/04/23 22:13:57 jalet 24 30 # Preliminary support for LPRng added BUT STILL UNTESTED. … … 78 84 __str__ = __repr__ 79 85 80 def openConnection( config, asadmin=0) :86 def openConnection(pykotatool) : 81 87 """Returns a connection handle to the appropriate Quota Storage Database.""" 82 backendinfo = config.getStorageBackend()88 backendinfo = pykotatool.config.getStorageBackend() 83 89 backend = backendinfo["storagebackend"] 84 90 try : … … 86 92 # don't trust user input 87 93 raise ImportError 94 # 95 # TODO : descending compatibility 96 # 97 if backend == "postgresql" : 98 backend = "pgstorage" # TODO : delete, this is for descending compatibility only 88 99 exec "from pykota.storages import %s as storagebackend" % backend.lower() 89 100 except ImportError : … … 93 104 database = backendinfo["storagename"] 94 105 admin = backendinfo["storageadmin"] 95 user = backendinfo["storageuser"]96 106 adminpw = backendinfo["storageadminpw"] 97 userpw = backendinfo["storageuserpw"] 98 if asadmin : 99 return getattr(storagebackend, "Storage")(host, database, admin, adminpw) 100 else : 101 return getattr(storagebackend, "Storage")(host, database, user, userpw) 107 return getattr(storagebackend, "Storage")(pykotatool, host, database, admin, adminpw) 102 108 -
pykota/trunk/pykota/storages/ldapstorage.py
r1020 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.5 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.4 2003/06/10 10:45:32 jalet 24 30 # Not implemented methods now raise an exception when called. … … 55 61 56 62 class Storage : 57 def __init__(self, host, dbname, user, passwd) :63 def __init__(self, pykotatool, host, dbname, user, passwd) : 58 64 """Opens the LDAP connection.""" 59 65 # raise PyKotaStorageError, "Sorry, the LDAP backend for PyKota is not yet implemented !" 66 self.tool = pykotatool 67 self.debug = pykotatool.config.getDebug() 60 68 self.closed = 1 61 69 try : … … 67 75 else : 68 76 self.closed = 0 77 if self.debug : 78 self.tool.logger.log_message("Database opened (host=%s, dbname=%s, user=%s)" % (host, dbname, user), "debug") 69 79 70 80 def __del__(self) : … … 73 83 del self.database 74 84 self.closed = 1 85 if self.debug : 86 self.tool.logger.log_message("Database closed.", "debug") 75 87 76 88 def doSearch(self, key, fields, base="", scope=ldap.SCOPE_SUBTREE) : … … 78 90 try : 79 91 # prepends something more restrictive at the beginning of the base dn 92 if self.debug : 93 self.tool.logger.log_message("QUERY : BaseDN : %s, Scope : %s, Filter : %s, Attributes : %s" % ((base or self.basedn), scope, key, fields), "debug") 80 94 result = self.database.search_s(base or self.basedn, scope, key, fields) 81 95 except ldap.NO_SUCH_OBJECT : -
pykota/trunk/pykota/tool.py
r973 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.40 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.39 2003/04/29 18:37:54 jalet 24 30 # Pluggable accounting methods (actually doesn't support external scripts) … … 188 194 class PyKotaTool : 189 195 """Base class for all PyKota command line tools.""" 190 def __init__(self, asadmin=1,doc="PyKota %s (c) 2003 %s" % (version.__version__, version.__author__)) :196 def __init__(self, doc="PyKota %s (c) 2003 %s" % (version.__version__, version.__author__)) : 191 197 """Initializes the command line tool.""" 192 198 # locale stuff … … 200 206 self.documentation = doc 201 207 self.config = config.PyKotaConfig("/etc") 202 self.logger = logger.openLogger(self .config)203 self.storage = storage.openConnection(self .config, asadmin=asadmin)208 self.logger = logger.openLogger(self) 209 self.storage = storage.openConnection(self) 204 210 self.smtpserver = self.config.getSMTPServer() 205 211 -
pykota/trunk/pykota/version.py
r1018 r1021 21 21 # 22 22 23 __version__ = "1.08alpha 7_unofficial"23 __version__ = "1.08alpha8_unofficial" 24 24 25 25 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""