Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Location:
pykota/trunk/initscripts
Files:
20 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/initscripts/ldap/pykota-sample.ldif

    r3280 r3413  
    33# 
    44# YOU CAN USE IT TO CREATE AN INITIAL LDAP TREE WITH PYKOTA SUPPORT. 
    5 #  
     5# 
    66# ITS STRUCTURE IS AN EXAMPLE : YOU CAN USE WHATEVER STRUCTURE YOU WANT, 
    77# PROVIDED YOU PUT CORRECT CONFIGURATION PARAMETERS IN /etc/pykota/pykota.conf 
    8 #  
     8# 
    99# 
    1010# (c) 2003, 2004, 2005, 2006, 2007, 2008 Jerome Alet <alet@librelogiciel.com> 
     
    1313# the Free Software Foundation, either version 3 of the License, or 
    1414# (at your option) any later version. 
    15 #  
     15# 
    1616# This program is distributed in the hope that it will be useful, 
    1717# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1818# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1919# GNU General Public License for more details. 
    20 #  
     20# 
    2121# You should have received a copy of the GNU General Public License 
    2222# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2424# $Id$ 
    2525# 
    26   
     26 
    2727# The encrypted password below in clear text is : BlfUPg7t 
    2828dn: cn=pykotaadmin,dc=example,dc=com 
  • pykota/trunk/initscripts/ldap/pykota.schema

    r3280 r3413  
    1010# the Free Software Foundation, either version 3 of the License, or 
    1111# (at your option) any later version. 
    12 #  
     12# 
    1313# This program is distributed in the hope that it will be useful, 
    1414# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1515# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1616# GNU General Public License for more details. 
    17 #  
     17# 
    1818# You should have received a copy of the GNU General Public License 
    1919# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3131# 16868.1.2.x   => classes 
    3232# 
    33 # Contributors : Leif Johansson - Stockholm University  
    34 # 
    35  
    36 #         
     33# Contributors : Leif Johansson - Stockholm University 
     34# 
     35 
     36# 
    3737# PyKota Attributes Types 
    3838# 
     
    7373        EQUALITY caseIgnoreIA5Match 
    7474        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    75          
    76 # pykotaHardLimit         
     75 
     76# pykotaHardLimit 
    7777attributetype ( 1.3.6.1.4.1.16868.1.1.7 NAME 'pykotaHardLimit' 
    7878        DESC 'Hard limit in maximal number of pages' 
     
    121121        EQUALITY caseExactIA5Match 
    122122        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    123          
    124 # pykotaPrinterName         
     123 
     124# pykotaPrinterName 
    125125attributetype ( 1.3.6.1.4.1.16868.1.1.15 NAME 'pykotaPrinterName' 
    126126        DESC 'PyKota printer name as received from the printing subsystem' 
     
    128128        SUBSTR caseExactIA5SubstringsMatch 
    129129        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    130          
    131 # pykotaUserName         
     130 
     131# pykotaUserName 
    132132attributetype ( 1.3.6.1.4.1.16868.1.1.16 NAME 'pykotaUserName' 
    133133        DESC 'PyKota user name' 
     
    135135        SUBSTR caseExactIA5SubstringsMatch 
    136136        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    137          
    138 # pykotaGroupName         
     137 
     138# pykotaGroupName 
    139139attributetype ( 1.3.6.1.4.1.16868.1.1.17 NAME 'pykotaGroupName' 
    140140        DESC 'PyKota group name' 
     
    142142        SUBSTR caseExactIA5SubstringsMatch 
    143143        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    144          
    145 # pykotaLastJobIdent         
     144 
     145# pykotaLastJobIdent 
    146146attributetype ( 1.3.6.1.4.1.16868.1.1.18 NAME 'pykotaLastJobIdent' 
    147147        DESC 'Identifies the last job in the history' 
    148148        EQUALITY caseExactIA5Match 
    149149        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    150          
    151 # pykotaFileName         
     150 
     151# pykotaFileName 
    152152attributetype ( 1.3.6.1.4.1.16868.1.1.19 NAME 'pykotaFileName' 
    153153        DESC 'Print job filename' 
     
    155155        SUBSTR caseExactSubstringsMatch 
    156156        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 
    157          
    158 # pykotaTitle         
     157 
     158# pykotaTitle 
    159159attributetype ( 1.3.6.1.4.1.16868.1.1.20 NAME 'pykotaTitle' 
    160160        DESC 'Print job title' 
     
    162162        SUBSTR caseIgnoreSubstringsMatch 
    163163        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 
    164          
     164 
    165165# pykotaCopies 
    166166attributetype ( 1.3.6.1.4.1.16868.1.1.21 NAME 'pykotaCopies' 
     
    168168        EQUALITY integerMatch 
    169169        SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 
    170          
    171 # pykotaOptions         
     170 
     171# pykotaOptions 
    172172attributetype ( 1.3.6.1.4.1.16868.1.1.22 NAME 'pykotaOptions' 
    173173        DESC 'Print job options' 
     
    175175        SUBSTR caseIgnoreSubstringsMatch 
    176176        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 
    177          
     177 
    178178# pykotaJobPrice 
    179179attributetype ( 1.3.6.1.4.1.16868.1.1.23 NAME 'pykotaJobPrice' 
     
    188188        SUBSTR caseIgnoreSubstringsMatch 
    189189        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} ) 
    190          
     190 
    191191# pykotaJobSizeBytes 
    192192attributetype ( 1.3.6.1.4.1.16868.1.1.25 NAME 'pykotaJobSizeBytes' 
     
    200200        EQUALITY caseExactIA5Match 
    201201        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 
    202          
     202 
    203203# pykotaOverCharge 
    204204attributetype ( 1.3.6.1.4.1.16868.1.1.27 NAME 'pykotaOverCharge' 
     
    206206        EQUALITY caseIgnoreIA5Match 
    207207        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    208          
     208 
    209209# pykotaWarnCount 
    210210attributetype ( 1.3.6.1.4.1.16868.1.1.28 NAME 'pykotaWarnCount' 
     
    212212        EQUALITY integerMatch 
    213213        SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 
    214          
    215 # pykotaMD5Sum         
     214 
     215# pykotaMD5Sum 
    216216attributetype ( 1.3.6.1.4.1.16868.1.1.29 NAME 'pykotaMD5Sum' 
    217217        DESC 'MD5 Sum of the job datas' 
     
    219219        SUBSTR caseExactIA5SubstringsMatch 
    220220        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    221          
    222 # pykotaPages         
     221 
     222# pykotaPages 
    223223attributetype ( 1.3.6.1.4.1.16868.1.1.30 NAME 'pykotaPages' 
    224224        DESC 'Descriptor for each page settings in the history' 
     
    226226        SUBSTR caseExactIA5SubstringsMatch 
    227227        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26) 
    228          
     228 
    229229# pykotaPrinterCoefficient 
    230230attributetype ( 1.3.6.1.4.1.16868.1.1.31 NAME 'pykotaPrinterCoefficient' 
     
    239239        SUBSTR caseIgnoreSubstringsMatch 
    240240        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 
    241          
     241 
    242242# pykotaPrecomputedJobSize 
    243243attributetype ( 1.3.6.1.4.1.16868.1.1.33 NAME 'pykotaPrecomputedJobSize' 
     
    251251        EQUALITY caseIgnoreIA5Match 
    252252        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    253          
     253 
    254254# pykotaMaxJobSize 
    255255attributetype ( 1.3.6.1.4.1.16868.1.1.35 NAME 'pykotaMaxJobSize' 
     
    264264        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 
    265265 
    266 #         
     266# 
    267267# PyKota Object Classes 
    268268# 
     
    273273        MUST ( uid ) 
    274274        MAY  ( pykotaUserName $ pykotaLimitBy $ mail $ description ) ) 
    275          
    276 # pykotaGroup         
     275 
     276# pykotaGroup 
    277277objectclass ( 1.3.6.1.4.1.16868.1.2.2 NAME 'pykotaGroup' SUP top AUXILIARY 
    278278        DESC 'PyKota Auxiliary Group' 
    279279        MUST ( cn ) 
    280280        MAY  ( pykotaGroupName $ pykotaLimitBy $ memberUid $ uniqueMember $ member $ description ) ) 
    281          
    282 # pykotaPrinter         
     281 
     282# pykotaPrinter 
    283283objectclass ( 1.3.6.1.4.1.16868.1.2.3 NAME 'pykotaPrinter' SUP top AUXILIARY 
    284284        DESC 'PyKota Printer' 
    285285        MUST ( cn ) 
    286286        MAY  ( pykotaMaxJobSize $ pykotaPassThrough $ description $ pykotaPrinterName $ pykotaPricePerPage $ pykotaPricePerJob $ pykotaPrinterCoefficient $ uniqueMember ) ) 
    287          
    288 # pykotaUserPQuota         
     287 
     288# pykotaUserPQuota 
    289289objectclass ( 1.3.6.1.4.1.16868.1.2.4 NAME 'pykotaUserPQuota' SUP top AUXILIARY 
    290290        DESC 'PyKota User Quota on a Printer' 
    291291        MUST ( cn $ pykotaUserName $ pykotaPrinterName ) 
    292292        MAY  ( pykotaMaxJobSize $ pykotaPageCounter $ pykotaLifePageCounter $ pykotaSoftLimit $ pykotaHardLimit $ pykotaDateLimit $ pykotaWarnCount ) ) 
    293          
    294 # pykotaGroupPQuota         
     293 
     294# pykotaGroupPQuota 
    295295objectclass ( 1.3.6.1.4.1.16868.1.2.5 NAME 'pykotaGroupPQuota' SUP top AUXILIARY 
    296296        DESC 'PyKota Group Quota on a Printer' 
    297297        MUST ( cn $ pykotaGroupName $ pykotaPrinterName ) 
    298298        MAY  ( pykotaMaxJobSize $ pykotaSoftLimit $ pykotaHardLimit $ pykotaDateLimit ) ) 
    299          
    300 # pykotaJob         
     299 
     300# pykotaJob 
    301301objectclass ( 1.3.6.1.4.1.16868.1.2.6 NAME 'pykotaJob' SUP top AUXILIARY 
    302302        DESC 'An entry in the job history for a printer' 
    303303        MUST ( cn $ pykotaUserName $ pykotaPrinterName $ pykotaJobId ) 
    304304        MAY  ( pykotaPrecomputedJobPrice $ pykotaPrecomputedJobSize $ pykotaBillingCode $ pykotaPrinterPageCounter $ pykotaJobSize $ pykotaAction $ pykotaJobPrice $ pykotaFileName $ pykotaTitle $ pykotaCopies $ pykotaOptions $ pykotaHostName $ pykotaJobSizeBytes $ pykotaMD5Sum $ pykotaPages ) ) 
    305          
     305 
    306306# pykotaAccountBalance 
    307307objectclass ( 1.3.6.1.4.1.16868.1.2.7 NAME 'pykotaAccountBalance' SUP top AUXILIARY 
    308308        DESC 'PyKota User account balance' 
    309309        MAY  ( pykotaUserName $ pykotaBalance $ pykotaLifeTimePaid $ pykotaOverCharge $ pykotaPayments ) ) 
    310          
    311 # pykotaLastJob         
     310 
     311# pykotaLastJob 
    312312objectclass ( 1.3.6.1.4.1.16868.1.2.8 NAME 'pykotaLastJob' SUP top AUXILIARY 
    313313        DESC 'Last job information for a printer' 
    314314        MUST ( pykotaLastJobIdent ) 
    315         MAY ( pykotaPrinterName ) )  
    316          
     315        MAY ( pykotaPrinterName ) ) 
     316 
    317317# pykotaBilling 
    318318objectclass ( 1.3.6.1.4.1.16868.1.2.10 NAME 'pykotaBilling' SUP top AUXILIARY 
     
    320320        MUST ( cn $ pykotaBillingCode ) 
    321321        MAY ( pykotaPageCounter $ pykotaBalance $ description ) ) 
    322          
    323 # pykotaObject - Use it if you have to  
     322 
     323# pykotaObject - Use it if you have to 
    324324objectclass ( 1.3.6.1.4.1.16868.1.2.9 NAME 'pykotaObject' SUP top STRUCTURAL 
    325325        DESC 'PyKota Object' 
    326326        MUST ( cn ) ) 
    327          
    328          
     327 
     328 
  • pykota/trunk/initscripts/ldap/pykota-schema-sunds.ldif

    r3351 r3413  
    2020# 16868.1.2.x   => classes 
    2121# 
    22 # Contributors : Leif Johansson - Stockholm University  
     22# Contributors : Leif Johansson - Stockholm University 
    2323# 
    2424dn: cn=schema 
     
    295295        DESC 'Last job information for a printer' 
    296296        MUST ( pykotaLastJobIdent ) 
    297         MAY ( pykotaPrinterName ) )  
     297        MAY ( pykotaPrinterName ) ) 
    298298- 
    299299add: objectClasses 
  • pykota/trunk/initscripts/ldap/pykota-sunds-indexes.ldif

    r3351 r3413  
    77# the Free Software Foundation, either version 3 of the License, or 
    88# (at your option) any later version. 
    9 #  
     9# 
    1010# This program is distributed in the hope that it will be useful, 
    1111# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313# GNU General Public License for more details. 
    14 #  
     14# 
    1515# You should have received a copy of the GNU General Public License 
    1616# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
  • pykota/trunk/initscripts/ldap/README.ldap

    r3343 r3413  
    2222=============== 
    2323 
    24 OpenLDAP :  
     24OpenLDAP : 
    2525---------- 
    2626 
    27     The pykota.schema file can be used to modify an existing OpenLDAP  
    28     directory to add the necessary object classes and attributes for  
     27    The pykota.schema file can be used to modify an existing OpenLDAP 
     28    directory to add the necessary object classes and attributes for 
    2929    use with PyKota. 
    30      
     30 
    3131    Include it in your LDAP server's configuration. 
    3232    For example, with OpenLDAP under Debian : 
    33      
     33 
    3434        $ cp pykota.schema /etc/ldap/schema 
    3535        (no need to do this if you install from PyKota's Debian package) 
    3636 
    37     NB: With OpenLDAP under Red Hat-based distros, where /etc/ldap is  
    38         referenced, substitute /etc/openldap. e.g.  
     37    NB: With OpenLDAP under Red Hat-based distros, where /etc/ldap is 
     38        referenced, substitute /etc/openldap. e.g. 
    3939 
    4040        $ cp pykota.schema /etc/openldap/schema 
    41          
    42     Then edit /etc/ldap/slapd.conf and add a line to     
     41 
     42    Then edit /etc/ldap/slapd.conf and add a line to 
    4343    include the PyKota schema. You should have something 
    4444    like : 
    45      
     45 
    4646        # Schema and objectClass definitions 
    4747        include         /etc/ldap/schema/core.schema 
     
    5050        include         /etc/ldap/schema/inetorgperson.schema 
    5151        include         /etc/ldap/schema/pykota.schema 
    52          
    53     While this is not mandatory, you may want to create     
     52 
     53    While this is not mandatory, you may want to create 
    5454    some indexes to speed things up a bit : 
    55      
     55 
    5656      You should already have these : 
    57        
     57 
    5858        index objectClass eq 
    5959        index cn pres,eq,sub 
    6060        index uid pres,eq,sub 
    61          
    62       But we recommend that you add these :   
    63        
     61 
     62      But we recommend that you add these : 
     63 
    6464        index pykotaUserName pres,eq,sub 
    6565        index pykotaGroupName pres,eq,sub 
     
    6767        index pykotaBillingCode pres,eq,sub 
    6868        index pykotaLastJobIdent eq 
    69          
     69 
    7070    Now you must ensure that the DNs PyKota will use to bind to 
    7171    your OpenLDAP server don't have search queries size limits, 
    7272    which gives for example (OpenLDAP 2.1.x or above) : 
    73      
     73 
    7474        limits dn="cn=pykotaadmin,dc=example,dc=com" size.soft=-1 size.hard=soft 
    7575        limits dn="cn=pykotauser,dc=example,dc=com" size.soft=-1 size.hard=soft 
    76      
     76 
    7777    Where pykotaadmin and pykotauser are the usernames used to bind to your 
    78     OpenLDAP server within PyKota, respectively in complete ReadWrite mode  
     78    OpenLDAP server within PyKota, respectively in complete ReadWrite mode 
    7979    (as set in pykotadmin.conf) and in ReadOnly mode (pykota.conf). 
    80      
     80 
    8181    NB : YOU have to define the ACLs necessary for user pykotaadmin to 
    8282    have unlimited Read+Write access to your LDAP tree, and for user 
     
    8787    this is up to you to decide. An example giving full write access 
    8888    to the pykotaadmin user is : 
    89      
    90         access to dn.subtree="ou=PyKota,dc=example,dc=com"  
    91                by dn="cn=pykotaadmin,dc=example,dc=com" write    
    92                 
    93         access to dn.subtree="ou=People,dc=example,dc=com"  
    94                by dn="cn=pykotaadmin,dc=example,dc=com" write    
    95                 
    96         access to dn.subtree="ou=Groups,dc=example,dc=com"  
    97                by dn="cn=pykotaadmin,dc=example,dc=com" write    
    98                 
     89 
     90        access to dn.subtree="ou=PyKota,dc=example,dc=com" 
     91               by dn="cn=pykotaadmin,dc=example,dc=com" write 
     92 
     93        access to dn.subtree="ou=People,dc=example,dc=com" 
     94               by dn="cn=pykotaadmin,dc=example,dc=com" write 
     95 
     96        access to dn.subtree="ou=Groups,dc=example,dc=com" 
     97               by dn="cn=pykotaadmin,dc=example,dc=com" write 
     98 
    9999    Please adapt this to your own needs and configuration. 
    100      
    101     Now, stop the OpenLDAP server :     
    102      
     100 
     101    Now, stop the OpenLDAP server : 
     102 
    103103        $ /etc/init.d/slapd stop 
    104      
    105     Generate the index files :     
    106      
     104 
     105    Generate the index files : 
     106 
    107107        $ slapindex 
    108          
    109     And finally restart the OpenLDAP server :     
    110      
     108 
     109    And finally restart the OpenLDAP server : 
     110 
    111111        $ /etc/init.d/slapd start 
    112112 
    113     NB: On Red Hat-based distros, use '/sbin/service ldap stop' and  
     113    NB: On Red Hat-based distros, use '/sbin/service ldap stop' and 
    114114        '/sbin/service ldap start' instead. 
    115          
    116 Sun Directory Server :         
     115 
     116Sun Directory Server : 
    117117---------------------- 
    118118 
    119119    See README.sunds 
    120      
    121 Initial datas :    
     120 
     121Initial datas : 
    122122=============== 
    123      
    124     You can use the pykota-sample.ldif file to initialize an LDAP tree  
     123 
     124    You can use the pykota-sample.ldif file to initialize an LDAP tree 
    125125    for PyKota, if you want. 
    126      
     126 
    127127    The structure used in this file is NOT mandatory ! 
    128128    Provided you put correct parameters into /etc/pykota/pykota.conf, 
    129129    you can structure your LDAP directory the way you want. 
    130      
    131 To use an LDAP directory as the Quota Storage, just modify   
     130 
     131To use an LDAP directory as the Quota Storage, just modify 
    132132~pykota/pykota.conf to make it contain lines similar to the LDAP 
    133133related ones in conf/pykota.conf.sample, but adapted to your 
    134134own configuration. Also de-activate the PostgreSQL-related lines. 
    135 Don't forget to adapt ~pykota/pykotadmin.conf as well.     
     135Don't forget to adapt ~pykota/pykotadmin.conf as well. 
    136136============================================================ 
  • pykota/trunk/initscripts/ldap/README.sunds

    r3351 r3413  
    77# the Free Software Foundation, either version 3 of the License, or 
    88# (at your option) any later version. 
    9 #  
     9# 
    1010# This program is distributed in the hope that it will be useful, 
    1111# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313# GNU General Public License for more details. 
    14 #  
     14# 
    1515# You should have received a copy of the GNU General Public License 
    1616# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    5454 
    5555        % ldapmodify -a -h ldap.domain.com -D "cn=Directory Manager" -f pykota-sunds-indexes.ldif 
    56          
     56 
    5757        By default configuration settings are NOT replicated in a 
    5858        replication environment so the following indexes must be 
     
    9595        will encrypt the userPassword entry so you may wish to leave it as 
    9696        plain text when creating the pykotaadmin and pykotauser entries. 
    97          
     97 
    9898        If a Password Policy is being enforced it would be advisable exclude 
    9999        both the pykotauser and pykotaadmin from that policy. This is especially 
     
    106106Access Control Instructions (ACI) : 
    107107----------------------------------- 
    108   
     108 
    109109        The provided ACI's must not be blindly added using ldapmodify or 
    110110        ldapadd, if you do so you will clobber any existing ACI's for a 
  • pykota/trunk/initscripts/mysql/pykota-mysql.sql

    r3279 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3535-- Create the print quota database users 
    3636-- NOTE: Change the "IDENTIFIED BY" strings to the passwords you would like. 
    37 --  
     37-- 
    3838GRANT USAGE ON *.* TO 'pykotauser'@'localhost' IDENTIFIED BY 'readonlypw'; 
    3939GRANT USAGE ON *.* TO 'pykotaadmin'@'localhost' IDENTIFIED BY 'readwritepw'; 
    4040 
    41 --  
     41-- 
    4242-- If necessary activate the lines below (and keep the preceding ones 
    4343-- activated at the same time) 
     
    4646-- GRANT USAGE ON *.* TO 'pykotaadmin'@'%' IDENTIFIED BY 'readwritepw'; 
    4747 
    48 --  
     48-- 
    4949-- Now connect to the new database 
    50 --  
     50-- 
    5151USE pykota; 
    5252 
     
    5656CREATE TABLE users (id INT4 PRIMARY KEY NOT NULL AUTO_INCREMENT, 
    5757                   username VARCHAR(255) UNIQUE NOT NULL, 
    58                    email TEXT,  
     58                   email TEXT, 
    5959                   balance FLOAT DEFAULT 0.0, 
    6060                   lifetimepaid FLOAT DEFAULT 0.0, 
     
    6262                   description TEXT, 
    6363                   overcharge FLOAT NOT NULL DEFAULT 1.0) TYPE=INNODB; 
    64                     
     64 
    6565-- 
    6666-- Create the groups table 
     
    7070                    description TEXT, 
    7171                    limitby VARCHAR(30) DEFAULT 'quota') TYPE=INNODB; 
    72                      
     72 
    7373-- 
    7474-- Create the printers table 
     
    8181                      passthrough ENUM('t','f') DEFAULT 'f', 
    8282                      maxjobsize INT4) TYPE=INNODB; 
    83                      
     83 
    8484-- 
    8585-- Create the print quota table for users 
    8686-- 
    8787CREATE TABLE userpquota (id INT8 PRIMARY KEY NOT NULL AUTO_INCREMENT, 
    88                         userid INT4,  
    89                         printerid INT4,  
     88                        userid INT4, 
     89                        printerid INT4, 
    9090                        lifepagecounter INT4 DEFAULT 0, 
    9191                        pagecounter INT4 DEFAULT 0, 
     
    9494                        datelimit DATETIME, 
    9595                        maxjobsize INT4, 
    96                         warncount INT4 DEFAULT 0,  
     96                        warncount INT4 DEFAULT 0, 
    9797                        INDEX (userid), 
    9898                        FOREIGN KEY (userid) REFERENCES users(id), 
    9999                        INDEX (printerid), 
    100                         FOREIGN KEY (printerid) REFERENCES printers(id))  
     100                        FOREIGN KEY (printerid) REFERENCES printers(id)) 
    101101                        TYPE=INNODB; 
    102102CREATE UNIQUE INDEX userpquota_up_id_ix ON userpquota (userid, printerid); 
    103                          
     103 
    104104-- 
    105105-- Create the job history table 
     
    132132CREATE INDEX jobhistory_pd_id_ix ON jobhistory (printerid, jobdate); 
    133133CREATE INDEX jobhistory_hostname_ix ON jobhistory (hostname); 
    134                          
     134 
    135135-- 
    136136-- Create the print quota table for groups 
    137137-- 
    138138CREATE TABLE grouppquota(id INT8 PRIMARY KEY NOT NULL AUTO_INCREMENT, 
    139                          groupid INT4,  
     139                         groupid INT4, 
    140140                         printerid INT4, 
    141141                         softlimit INT4, 
     
    149149                         TYPE=INNODB; 
    150150CREATE UNIQUE INDEX grouppquota_up_id_ix ON grouppquota (groupid, printerid); 
    151                          
    152 --                          
     151 
     152-- 
    153153-- Create the groups/members relationship 
    154154-- 
     
    160160                           FOREIGN KEY (userid) REFERENCES users(id), 
    161161                           PRIMARY KEY (groupid, userid)) TYPE=INNODB; 
    162                             
    163 --                          
     162 
     163-- 
    164164-- Create the printer groups relationship 
    165165-- 
     
    173173-- 
    174174-- Create the table for payments 
    175 --  
     175-- 
    176176CREATE TABLE payments (id INT4 PRIMARY KEY NOT NULL AUTO_INCREMENT, 
    177177                       userid INT4, 
     
    195195                           ) TYPE=INNODB; 
    196196 
    197 --  
     197-- 
    198198-- Create the table for the billing codes 
    199199-- 
     
    203203                           balance FLOAT DEFAULT 0.0, 
    204204                           pagecounter INT4 DEFAULT 0) TYPE=INNODB; 
    205 --                         
    206 -- Set some ACLs                         
     205-- 
     206-- Set some ACLs 
    207207-- 
    208208GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON `pykota`.* TO 'pykotaadmin'@'localhost'; 
    209209GRANT SELECT ON `pykota`.* TO 'pykotauser'@'localhost'; 
    210210 
    211 --  
     211-- 
    212212-- If necessary activate the lines below (and keep the preceding ones 
    213213-- activated at the same time) 
  • pykota/trunk/initscripts/mysql/README.mysql

    r3279 r3413  
    2525DataBase using MySQL as a backend. 
    2626 
    27         - edit the pykota-mysql.sql file and modify the passwords at  
     27        - edit the pykota-mysql.sql file and modify the passwords at 
    2828          the end of the 'GRANT USAGE' lines. 
    29            
     29 
    3030        - As MySQL's administrative user, usually root, 
    3131          do the following : 
    32            
     32 
    3333            # mysql <pykota-mysql.sql 
    34              
     34 
    3535        - If no error message appear, your MySQL PyKota storage 
    3636          is now ready for use. 
    37            
     37 
    3838        - In ~pykota/pykota.conf, ensure that the following lines 
    3939          are present and unique inside the [global] section : 
    40          
     40 
    4141            storagebackend : mysqlstorage 
    4242            storageserver : localhost 
     
    4444            storageuser : pykotauser 
    4545            storageuserpw : readonlypw 
    46              
     46 
    4747            NB : replace 'readonlypw' with the password you chose 
    4848            for user 'pykotauser' when you modified pykota-mysql.sql 
    49              
     49 
    5050        - In ~pykota/pykotadmin.conf ensure that the following lines 
    5151          are present and unique inside the [global] section : 
    52          
     52 
    5353            storageadmin : pykotaadmin 
    5454            storageadminpw : readwritepw 
    55              
     55 
    5656            NB : replace 'readwritepw' with the password you chose 
    5757            for user 'pykotaadmin' when you modified pykota-mysql.sql 
    58              
    59         - IMPORTANT : if your database is not located on the print server,  
    60           replace 'localhost' in the lines above with your database server's  
     58 
     59        - IMPORTANT : if your database is not located on the print server, 
     60          replace 'localhost' in the lines above with your database server's 
    6161          hostname or IP address. If your database server doesn't listen on 
    6262          its standard port, add the port number at the end of the hostname 
    6363          with a colon to separate the hostname from the port. 
    6464          See pykota/conf/pykota.conf.sample for examples. 
    65          
     65 
    6666============================================================ 
  • pykota/trunk/initscripts/postgresql/pykota-postgresql.sql

    r3279 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3535-- Create the print quota database users 
    3636-- NOTE: Change the password values to the passwords you would like. 
    37 --  
     37-- 
    3838CREATE USER pykotauser WITH UNENCRYPTED PASSWORD 'readonlypw' NOCREATEDB NOCREATEUSER; 
    3939CREATE USER pykotaadmin WITH UNENCRYPTED PASSWORD 'readwritepw' NOCREATEDB NOCREATEUSER; 
    4040 
    41 --  
     41-- 
    4242-- Now connect to the new database 
    43 --  
     43-- 
    4444\connect pykota 
    4545 
     
    4949CREATE TABLE users(id SERIAL PRIMARY KEY NOT NULL, 
    5050                   username TEXT UNIQUE NOT NULL, 
    51                    email TEXT,  
     51                   email TEXT, 
    5252                   balance FLOAT DEFAULT 0.0, 
    5353                   lifetimepaid FLOAT DEFAULT 0.0, 
     
    5555                   description TEXT, 
    5656                   overcharge FLOAT NOT NULL DEFAULT 1.0); 
    57                     
     57 
    5858-- 
    5959-- Create the groups table 
     
    6363                    description TEXT, 
    6464                    limitby TEXT DEFAULT 'quota'); 
    65                      
     65 
    6666-- 
    6767-- Create the printers table 
     
    7474                      passthrough BOOLEAN DEFAULT FALSE, 
    7575                      maxjobsize INT4); 
    76                      
     76 
    7777-- 
    7878-- Create the print quota table for users 
     
    8787                        datelimit TIMESTAMP, 
    8888                        maxjobsize INT4, 
    89                         warncount INT4 DEFAULT 0);  
     89                        warncount INT4 DEFAULT 0); 
    9090CREATE INDEX userpquota_u_id_ix ON userpquota (userid); 
    9191CREATE INDEX userpquota_p_id_ix ON userpquota (printerid); 
    9292CREATE UNIQUE INDEX userpquota_up_id_ix ON userpquota (userid, printerid); 
    93                          
     93 
    9494-- 
    9595-- Create the job history table 
     
    120120CREATE INDEX jobhistory_pd_id_ix ON jobhistory (printerid, jobdate); 
    121121CREATE INDEX jobhistory_hostname_ix ON jobhistory (hostname); 
    122                          
     122 
    123123-- 
    124124-- Create the print quota table for groups 
     
    134134CREATE INDEX grouppquota_p_id_ix ON grouppquota (printerid); 
    135135CREATE UNIQUE INDEX grouppquota_up_id_ix ON grouppquota (groupid, printerid); 
    136                          
    137 --                          
     136 
     137-- 
    138138-- Create the groups/members relationship 
    139139-- 
     
    141141                           userid INT4 REFERENCES users(id), 
    142142                           PRIMARY KEY (groupid, userid)); 
    143                             
    144 --                          
     143 
     144-- 
    145145-- Create the printer groups relationship 
    146146-- 
     
    150150-- 
    151151-- Create the table for payments 
    152 --  
     152-- 
    153153CREATE TABLE payments (id SERIAL PRIMARY KEY NOT NULL, 
    154154                       userid INT4 REFERENCES users(id), 
     
    158158CREATE INDEX payments_date_ix ON payments (date); 
    159159 
    160 --  
     160-- 
    161161-- Create the table for coefficients wrt paper sizes and the like 
    162162-- 
    163 CREATE TABLE coefficients (id SERIAL PRIMARY KEY NOT NULL,  
    164                            printerid INTEGER NOT NULL REFERENCES printers(id),  
    165                            label TEXT NOT NULL,  
    166                            coefficient FLOAT DEFAULT 1.0,  
     163CREATE TABLE coefficients (id SERIAL PRIMARY KEY NOT NULL, 
     164                           printerid INTEGER NOT NULL REFERENCES printers(id), 
     165                           label TEXT NOT NULL, 
     166                           coefficient FLOAT DEFAULT 1.0, 
    167167                           CONSTRAINT coeffconstraint UNIQUE (printerid, label)); 
    168168 
    169 --  
     169-- 
    170170-- Create the table for the billing codes 
    171171-- 
     
    176176                           pagecounter INT4 DEFAULT 0); 
    177177 
    178 --                         
    179 -- Set some ACLs                         
     178-- 
     179-- Set some ACLs 
    180180-- 
    181181REVOKE ALL ON users, groups, printers, userpquota, grouppquota, groupsmembers, printergroupsmembers, jobhistory, payments, coefficients, billingcodes FROM public; 
  • pykota/trunk/initscripts/postgresql/README.postgresql

    r3279 r3413  
    3131        - edit the pykota-postgresql.sql file and modify the passwords on 
    3232          the 'CREATE USER' lines. 
    33            
     33 
    3434        - Launch the psql frontend and connect to the 
    3535          database template1 as a PostgreSQL administrator 
    3636          (i.e. the postgres user) : 
    37            
     37 
    3838          as user 'root' : 
    39            
     39 
    4040            # su - postgres 
    41              
    42           you're now user 'postgres', then continue with :    
    43            
     41 
     42          you're now user 'postgres', then continue with : 
     43 
    4444            $ psql -f pykota-postgresql.sql template1 
    45              
    46           or depending on your settings you may prefer :   
    47            
     45 
     46          or depending on your settings you may prefer : 
     47 
    4848            $ psql -h localhost -U postgres -f pykota-postgresql.sql template1 
    49            
    50         - If no error message appears, your PostgreSQL PyKota storage  
     49 
     50        - If no error message appears, your PostgreSQL PyKota storage 
    5151          is now ready for use. NB : a lot of NOTICE messages might appear, 
    5252          this is perfectly normal. 
    53            
     53 
    5454        - In ~pykota/pykota.conf, ensure that the following lines 
    5555          are present and unique inside the [global] section : 
    56          
     56 
    5757            storagebackend : pgstorage 
    5858            storageserver : localhost 
     
    6060            storageuser : pykotauser 
    6161            storageuserpw : readonlypw 
    62              
     62 
    6363            NB : replace 'readonlypw' with the password you chose 
    6464            for user 'pykotauser' when you modified pykota-postgresql.sql 
    65              
     65 
    6666        - In ~pykota/pykotadmin.conf ensure that the following lines 
    6767          are present and unique inside the [global] section : 
    68          
     68 
    6969            storageadmin : pykotaadmin 
    7070            storageadminpw : readwritepw 
    71              
     71 
    7272            NB : replace 'readwritepw' with the password you chose 
    7373            for user 'pykotaadmin' when you modified pykota-postgresql.sql 
    74          
    75         - IMPORTANT : if your database is not located on the print server,  
    76           replace 'localhost' in the lines above with your database server's  
     74 
     75        - IMPORTANT : if your database is not located on the print server, 
     76          replace 'localhost' in the lines above with your database server's 
    7777          hostname or IP address. If your database server doesn't listen on 
    7878          its standard port, add the port number at the end of the hostname 
    7979          with a colon to separate the hostname from the port. 
    8080          See pykota/conf/pykota.conf.sample for examples. 
    81            
     81 
    8282============================================================ 
    8383 
     
    8989  Some scripts to upgrade old PyKota databases to the new 
    9090  database schema are included. You may have to run all 
    91   of them or only some of them, depending on your  
     91  of them or only some of them, depending on your 
    9292  version of PyKota. Usually running them several times, for 
    9393  example if you used several different development versions 
    9494  of PyKota, won't do any harm. 
    95    
     95 
    9696  If you're connected as user 'root', you have to be user 'postgres' 
    9797  instead : 
    98            
     98 
    9999            # su - postgres 
    100              
     100 
    101101  You're now user 'postgres', then continue the upgrade by following 
    102102  the instructions below, depending on the version you actually use : 
    103    
     103 
    104104  * An SQL script to upgrade a 1.22 PyKota Storage DataBase to 
    105105    1.23 is included. Launch it this way on the Quota Storage Server : 
    106      
     106 
    107107        $ psql -U postgres pykota 
    108108        pykota=# \i upgrade-to-1.23.sql 
    109109        pykota=# \q 
    110110        $ 
    111          
     111 
    112112    This script adds many fields to existing tables, and a table to 
    113113    manage billing codes. 
    114      
     114 
    115115  * An SQL script to upgrade a 1.20 PyKota Storage DataBase to 
    116116    1.21 is included. Launch it this way on the Quota Storage Server : 
    117      
     117 
    118118        $ psql -U postgres pykota 
    119119        pykota=# \i upgrade-to-1.21.sql 
    120120        pykota=# \q 
    121121        $ 
    122          
     122 
    123123    This script adds many fields to existing tables, and also adds 
    124124    some tables in indexes. 
    125      
     125 
    126126  * An SQL script to upgrade a 1.18 PyKota Storage DataBase to 
    127127    1.19 is included. Launch it this way on the Quota Storage Server : 
    128      
     128 
    129129        $ psql -U postgres pykota 
    130130        pykota=# \i upgrade-to-1.19.sql 
    131131        pykota=# \q 
    132132        $ 
    133          
     133 
    134134    This script adds a field to the print job history. The field that 
    135135    is added is : hostname 
    136      
     136 
    137137  * An SQL script to upgrade a pre-1.16 PyKota Storage DataBase to 
    138138    1.16 is included. Launch it this way on the Quota Storage Server : 
    139      
     139 
    140140        $ psql -U postgres pykota 
    141141        pykota=# \i upgrade-to-1.16.sql 
    142142        pykota=# \q 
    143143        $ 
    144          
     144 
    145145    This script adds some fields to the print job history, so that 
    146146    more complete information will be known. The fields that 
    147     are added are : jobprice, filename, title, copies and print  
     147    are added are : jobprice, filename, title, copies and print 
    148148    command options. Also some indexes are created to speed things up. 
    149    
    150 What is below is for historical reasons only, real people don't use   
     149 
     150What is below is for historical reasons only, real people don't use 
    151151such old beasts, and YOU SHOULDN'T EITHER ! 
    152152 
    153153  * An SQL script to upgrade a pre-1.14 PyKota Storage DataBase to 
    154154    1.14 is included. Launch it this way on the Quota Storage Server : 
    155      
     155 
    156156        $ psql -U postgres pykota 
    157157        pykota=# \i upgrade-to-1.14.sql 
    158158        pykota=# \q 
    159159        $ 
    160          
    161     This script adds an "email" field for each user. This field, if not     
     160 
     161    This script adds an "email" field for each user. This field, if not 
    162162    NULL, is used as the email address of the user when sending warning 
    163163    messages in case he is over quota. 
    164      
    165   * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to  
    166     1.01 is still included for historical reasons. PLEASE DON'T USE IT !  
    167    
    168   * If you are already running an old version of PyKota (<1.03) and  
    169     want to upgrade to 1.03, YOU HAVE TO RUN the  
    170     upgrade-from-before-1.03.py shell script. NOT LAUNCHING THIS SCRIPT  
    171     WILL CAUSE PYKOTA TO STOP WORKING ! PLEASE NEVER RUN THIS SCRIPT IF  
    172     YOUR EXISTING VERSION OF PYKOTA IS ALREADY 1.03 OR HIGHER.  
     164 
     165  * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to 
     166    1.01 is still included for historical reasons. PLEASE DON'T USE IT ! 
     167 
     168  * If you are already running an old version of PyKota (<1.03) and 
     169    want to upgrade to 1.03, YOU HAVE TO RUN the 
     170    upgrade-from-before-1.03.py shell script. NOT LAUNCHING THIS SCRIPT 
     171    WILL CAUSE PYKOTA TO STOP WORKING ! PLEASE NEVER RUN THIS SCRIPT IF 
     172    YOUR EXISTING VERSION OF PYKOTA IS ALREADY 1.03 OR HIGHER. 
  • pykota/trunk/initscripts/postgresql/upgrade-from-before-1.03.py

    r3259 r3413  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2626try : 
    2727    import pg 
    28 except ImportError :     
     28except ImportError : 
    2929    sys.stderr.write("The PyGreSQL Python module doesn't seem to be available. ABORTED.\n") 
    3030    sys.exit(-1) 
     
    3232def dump_old_database() : 
    3333    """Dumps the existing PyKota database to a file, to avoir loosing data. 
    34      
     34 
    3535       Returns 1 if dump is successfull, 0 if it isn't. 
    36     """    
     36    """ 
    3737    pipeinput = os.popen("pg_dump -C -D -N -U postgres -f pykota-dump.sql pykota") 
    3838    dummy = pipeinput.read() 
     
    4444    dummy = pipeinput.read() 
    4545    return (pipeinput.close() is None) or 0 
    46      
     46 
    4747def restore_original_database() : 
    4848    """Creates the empty database.""" 
     
    5050    dummy = pipeinput.read() 
    5151    return (pipeinput.close() is None) or 0 
    52      
     52 
    5353def open_database(dbname="pykota") : 
    5454    """Returns the database object or None if we can't connect to it.""" 
    5555    try : 
    5656        pykotadb = pg.connect(host="localhost", port=5432, dbname=dbname, user="postgres") 
    57     except pg.error, msg :      
     57    except pg.error, msg : 
    5858        sys.stderr.write("%s\n" % msg) 
    5959        sys.stderr.write("Unable to connect to the local PostgreSQL server.\nPlease modify the open_database() method in %s\nto connect to the correct PostgreSQL server\nand relaunch the script.\n" % sys.argv[0]) 
    60         return  
    61     else :     
     60        return 
     61    else : 
    6262        return pykotadb 
    63          
    64          
     63 
     64 
    6565def doQuote(field) : 
    6666    """Quotes a field for use as a string in SQL queries.""" 
    6767    if type(field) == type(0) : # TODO : do something safer 
    6868        typ = "decimal" 
    69     else :     
     69    else : 
    7070        typ = "text" 
    7171    return pg._quote(field, typ) 
    72          
     72 
    7373def main() : 
    7474    """Does the work.""" 
    75      
     75 
    7676    # First we make a dump of the old database 
    7777    print "Dumping old database for safety...", 
     
    8080        return -1 
    8181    print "Done." 
    82          
    83     # Second we try to connect to it     
    84     print "Extracting datas from old database...",  
     82 
     83    # Second we try to connect to it 
     84    print "Extracting datas from old database...", 
    8585    db = open_database() 
    8686    if db is None : 
    8787        sys.stderr.write("Impossible to connect to old PyKota database. ABORTED.\nAre you sure you are upgrading an existing installation ?\n") 
    8888        return -1 
    89      
     89 
    9090    # Third we extract datas 
    9191    oldprinters = db.query("SELECT * FROM printers ORDER BY id;") 
    9292    oldusers = db.query("SELECT * FROM users ORDER BY id;") 
    9393    oldquotas = db.query("SELECT * FROM userpquota ORDER BY printerid, userid;") 
    94      
     94 
    9595    # Fourth close the database 
    9696    db.close() 
    9797    print "Done." 
    98      
     98 
    9999    # Fifth we delete the old database ! 
    100100    answer = raw_input("The old database will be deleted for the upgrade to take place.\nAre you sure you want to continue (y/N) ? ") 
     
    112112        db.close() 
    113113        return -1 
    114     else :     
     114    else : 
    115115        db.close() 
    116          
     116 
    117117    # Sixth we create the new database 
    118118    print "Creating the new database...", 
     
    121121        return -1 
    122122    print "Done." 
    123      
     123 
    124124    # Seventh we restore old data 
    125125    print "Restoring old datas..." 
     
    131131            sys.stderr.write("Shit ! A double-error occured !!!\nPlease report problem to your database administrator.\n") 
    132132            sys.stderr.write("And file a bug report to alet@librelogiciel.com\n") 
    133         else :     
     133        else : 
    134134            print "Done." 
    135135        return -1 
    136     db.query("BEGIN;")     
     136    db.query("BEGIN;") 
    137137    try : 
    138138        newprinters = {} 
     
    141141            newid = db.query("SELECT id FROM printers WHERE printername='%s';" % oldprinter["printername"]).dictresult()[0]["id"] 
    142142            newprinters[oldprinter["id"]] = newid 
    143         newusers = {}     
    144         for olduser in oldusers.dictresult() :     
     143        newusers = {} 
     144        for olduser in oldusers.dictresult() : 
    145145            db.query("INSERT INTO users (username) VALUES (%s);" % doQuote(olduser["username"])) 
    146146            newid = db.query("SELECT id FROM users WHERE username='%s';" % olduser["username"]).dictresult()[0]["id"] 
    147147            newusers[olduser["id"]] = newid 
    148         for oldquota in oldquotas.dictresult() :    
    149             db.query("INSERT INTO userpquota (userid, printerid, pagecounter, lifepagecounter, softlimit, hardlimit, datelimit) VALUES (%s, %s, %s, %s, %s, %s, %s);" %  
     148        for oldquota in oldquotas.dictresult() : 
     149            db.query("INSERT INTO userpquota (userid, printerid, pagecounter, lifepagecounter, softlimit, hardlimit, datelimit) VALUES (%s, %s, %s, %s, %s, %s, %s);" % 
    150150                                              (doQuote(newusers[oldquota["userid"]]) , doQuote(newprinters[oldquota["printerid"]]), doQuote(oldquota["pagecounter"]), doQuote(oldquota["lifepagecounter"]), doQuote(oldquota["softlimit"]), doQuote(oldquota["hardlimit"]), doQuote(oldquota["datelimit"]))) 
    151     except pg.error, msg :     
     151    except pg.error, msg : 
    152152        sys.stderr.write("ERROR : %s\nABORTED.\n" % msg) 
    153153        db.query("ROLLBACK;") 
    154         db.close()     
     154        db.close() 
    155155        return -1 
    156     except :     
     156    except : 
    157157        sys.stderr.write("Unknown error ! ABORTED.\n") 
    158158        db.query("ROLLBACK;") 
    159         db.close()     
     159        db.close() 
    160160        return -1 
    161     else :     
     161    else : 
    162162        db.query("COMMIT;") 
    163163        db.close() 
     
    165165    print "NB : Last job on each printer was lost. This is normal !" 
    166166    return 0 
    167      
     167 
    168168if __name__ == "__main__" : 
    169169    sys.exit(main()) 
  • pykota/trunk/initscripts/postgresql/upgrade-to-1.14.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    1919-- 
    2020-- 
    21                          
    22 --                          
     21 
     22-- 
    2323-- WARNING : YOU NEED A RECENT VERSION OF POSTGRESQL FOR THE ALTER COLUMN STATEMENT TO WORK ! 
    2424-- 
    2525 
    26 --                          
     26-- 
    2727-- Modify the old database schema 
    2828-- 
  • pykota/trunk/initscripts/postgresql/upgrade-to-1.16.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
    17 --  
     17-- 
    1818-- $Id$ 
    1919-- 
     
    2222-- This script has to be used if you already 
    2323-- have a pre-1.16 version of PyKota to upgrade 
    24 -- your database schema.  
     24-- your database schema. 
    2525-- 
    2626-- YOU DON'T NEED TO USE IT IF YOU'VE JUST INSTALLED PYKOTA 
    2727-- 
    28                          
    29 --                          
     28 
     29-- 
    3030-- WARNING : YOU NEED A RECENT VERSION OF POSTGRESQL FOR THE ALTER COLUMN STATEMENT TO WORK ! 
    3131-- 
    3232 
    33 --                          
     33-- 
    3434-- Modify the old database schema 
    3535-- 
     
    4848ALTER TABLE jobhistory ADD CONSTRAINT checkUserPQuota FOREIGN KEY (userid, printerid) REFERENCES userpquota (userid, printerid); 
    4949 
    50 --  
     50-- 
    5151-- Add new tables 
    5252-- 
    53 --                          
     53-- 
    5454-- Create the printer groups relationship 
    5555-- 
     
    5858                           PRIMARY KEY (groupid, printerid)); 
    5959 
    60 --                          
     60-- 
    6161-- Now add some indexes 
    6262-- 
     
    6666CREATE UNIQUE INDEX grouppquota_up_id_ix ON grouppquota (groupid, printerid); 
    6767 
    68 --  
     68-- 
    6969-- And now sets some ACLs 
    70 --  
    71 REVOKE ALL ON printergroupsmembers FROM public;                         
     70-- 
     71REVOKE ALL ON printergroupsmembers FROM public; 
    7272GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON printergroupsmembers TO pykotaadmin; 
    7373GRANT SELECT ON printergroupsmembers TO pykotauser; 
  • pykota/trunk/initscripts/postgresql/upgrade-to-1.19.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2222-- This script has to be used if you already 
    2323-- have a pre-1.19 version of PyKota to upgrade 
    24 -- your database schema.  
     24-- your database schema. 
    2525-- 
    2626-- YOU DON'T NEED TO USE IT IF YOU'VE JUST INSTALLED PYKOTA 
    2727-- 
    28                          
    29 --                          
     28 
     29-- 
    3030-- WARNING : YOU NEED A RECENT VERSION OF POSTGRESQL FOR THE ALTER COLUMN STATEMENT TO WORK ! 
    3131-- 
    3232 
    33 --                          
     33-- 
    3434-- Modify the old database schema 
    3535-- 
     
    4545CREATE INDEX payments_date_ix ON payments (date); 
    4646 
    47 REVOKE ALL ON payments FROM public;                         
     47REVOKE ALL ON payments FROM public; 
    4848REVOKE ALL ON payments_id_seq FROM public; 
    4949GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON payments TO pykotaadmin; 
  • pykota/trunk/initscripts/postgresql/upgrade-to-1.21.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2222-- This script has to be used if you already 
    2323-- have a pre-1.21 version of PyKota to upgrade 
    24 -- your database schema.  
     24-- your database schema. 
    2525-- 
    2626-- YOU DON'T NEED TO USE IT IF YOU'VE JUST INSTALLED PYKOTA 
    2727-- 
    28                          
    29 --                          
     28 
     29-- 
    3030-- Modify the old database schema 
    3131-- 
     
    5151CREATE INDEX jobhistory_u_id_ix ON jobhistory (userid); 
    5252 
    53 --  
     53-- 
    5454-- Create the table for coefficients wrt paper sizes and the like 
    5555-- 
    56 CREATE TABLE coefficients (id SERIAL PRIMARY KEY NOT NULL,  
    57                            printerid INTEGER NOT NULL REFERENCES printers(id),  
    58                            label TEXT NOT NULL,  
    59                            coefficient FLOAT DEFAULT 1.0,  
     56CREATE TABLE coefficients (id SERIAL PRIMARY KEY NOT NULL, 
     57                           printerid INTEGER NOT NULL REFERENCES printers(id), 
     58                           label TEXT NOT NULL, 
     59                           coefficient FLOAT DEFAULT 1.0, 
    6060                           CONSTRAINT coeffconstraint UNIQUE (printerid, label)); 
    61                             
    62 REVOKE ALL ON coefficients FROM public;                         
     61 
     62REVOKE ALL ON coefficients FROM public; 
    6363REVOKE ALL ON coefficients_id_seq FROM public; 
    6464GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON coefficients TO pykotaadmin; 
  • pykota/trunk/initscripts/postgresql/upgrade-to-1.23.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2222-- This script has to be used if you already 
    2323-- have a pre-1.23alpha30 version of PyKota to upgrade 
    24 -- your database schema.  
     24-- your database schema. 
    2525-- 
    2626-- YOU DON'T NEED TO USE IT IF YOU'VE JUST INSTALLED PYKOTA 
    2727-- 
    28                          
    29 --                          
     28 
     29-- 
    3030-- Modify the old database schema 
    3131-- 
     
    4949UPDATE printers SET passthrough=FALSE; 
    5050 
    51 --  
     51-- 
    5252-- Create the table for the billing codes 
    5353-- 
     
    5959ALTER TABLE billingcodes RENAME COLUMN label TO billingcode; 
    6060 
    61 REVOKE ALL ON billingcodes FROM public;                         
     61REVOKE ALL ON billingcodes FROM public; 
    6262REVOKE ALL ON billingcodes_id_seq FROM public; 
    6363GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON billingcodes TO pykotaadmin; 
  • pykota/trunk/initscripts/postgresql/VERYOLDpykota-upgrade-postgresql.sql

    r3259 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2626-- the normal script instead. 
    2727-- 
    28                          
    29 --                          
     28 
     29-- 
    3030-- WARNING : YOU NEED A RECENT VERSION OF POSTGRESQL FOR THE DROP COLUMN STATEMENT TO WORK ! 
    3131-- 
    3232 
    33 --                          
     33-- 
    3434-- Modify the old database schema 
    3535-- 
     
    3737ALTER TABLE grouppquota DROP COLUMN pagecounter; 
    3838 
    39 --                          
     39-- 
    4040-- Create the groups/members relationship 
    4141-- 
     
    4343                           userid INT4 REFERENCES users(id), 
    4444                           PRIMARY KEY (groupid, userid)); 
    45                             
    46 --                         
    47 -- Set some ACLs                         
     45 
    4846-- 
    49 REVOKE ALL ON groupsmembers FROM public;                         
     47-- Set some ACLs 
     48-- 
     49REVOKE ALL ON groupsmembers FROM public; 
    5050GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES ON groupsmembers TO pykotaadmin; 
  • pykota/trunk/initscripts/README

    r3279 r3413  
    2929 
    3030  * postgresql/pykota-postgresql.sql : 
    31    
     31 
    3232    This file creates an empty Quota Storage Database, using PostgreSQL 
    3333    as a backend. You have to use it the first time you install PyKota 
    3434    if you want to use PostgreSQL as the Quota Storage Backend. 
    35      
    36   * ldap/pykota.schema :   
    37    
     35 
     36  * ldap/pykota.schema : 
     37 
    3838    This file adds the necessary classes and attributes to an existing 
    39     LDAP directory for use with PyKota. Read this file and the  
     39    LDAP directory for use with PyKota. Read this file and the 
    4040    associated ldap/README.ldap files for details. 
    41      
    42      
    43 Old files, kept to allow people to upgrade from very old versions of PyKota :    
     41 
     42 
     43Old files, kept to allow people to upgrade from very old versions of PyKota : 
    4444============================================================================= 
    45      
    46   * upgrade-to-1.19.sql :   
    47    
     45 
     46  * upgrade-to-1.19.sql : 
     47 
    4848    This file upgrades the PostgreSQL Quota Storage Database schema 
    4949    from versions before 1.19alpha7 to version 1.19alpha7 and above. 
    5050    NEVER USE IT IF YOU ALREADY RUN 1.19alpha7 OR ABOVE ! 
    51      
    52   * upgrade-to-1.16.sql :   
    53    
     51 
     52  * upgrade-to-1.16.sql : 
     53 
    5454    This file upgrades the PostgreSQL Quota Storage Database schema 
    5555    from versions before 1.16 to version 1.16. 
    5656    NEVER USE IT IF YOU ALREADY RUN 1.16 OR ABOVE ! 
    57      
    58   * upgrade-to-1.14.sql :   
    59    
     57 
     58  * upgrade-to-1.14.sql : 
     59 
    6060    This file upgrades the PostgreSQL Quota Storage Database schema 
    6161    from versions before 1.14 to version 1.14. 
    6262    NEVER USE IT IF YOU ALREADY RUN 1.14 OR ABOVE ! 
    63      
     63 
    6464  * VERYOLDpykota-upgrade-postgresql.sql : 
    65    
     65 
    6666    This file upgrades the PostgreSQL Quota Storage Database schema 
    6767    from versions before 1.01 to version 1.01. 
    68      
     68 
    6969    IT'S THERE FOR HISTORICAL REASONS ONLY : DON'T USE IT, USE 
    7070    THE SCRIPT DESCRIBED BELOW INSTEAD ! 
    71      
     71 
    7272  * upgrade-from-before-1.03.py : 
    73    
     73 
    7474    This shell script upgrades the PostgreSQL Quota Storage Database schema 
    7575    from versions 1.01 or 1.02 to version 1.03. 
    7676    PLEASE DO A BACKUP OF YOUR PYKOTA DATABASE BEFORE RUNNING THIS SCRIPT ! 
    7777    Also this script will try to connect to PostgreSQL as the postgres user 
    78     (i.e. PostgreSQL's administrator), on the local machine (PyKota Storage  
    79     Server), without prompting for a password. Please read this script and  
     78    (i.e. PostgreSQL's administrator), on the local machine (PyKota Storage 
     79    Server), without prompting for a password. Please read this script and 
    8080    adapt it to your own configuration before running it. THIS IS IMPORTANT. 
    81      
    82     THIS SCRIPT MAKES ANY REASONABLE CHECK TO ENSURE THAT YOUR DATAS WON'T  
     81 
     82    THIS SCRIPT MAKES ANY REASONABLE CHECK TO ENSURE THAT YOUR DATAS WON'T 
    8383    BE LOST, AND ALSO DUMPS YOUR OLD DATABASE TO A TEXT FILE BEFORE DOING 
    8484    ANYTHING. IT WAS TESTED SEVERAL TIMES AND SHOULDN'T PRODUCE ANY ERROR 
    85     EXCEPT ABOUT THE pykotaadmin and pykotauser POSTGRESQL USERS WHO  
     85    EXCEPT ABOUT THE pykotaadmin and pykotauser POSTGRESQL USERS WHO 
    8686    ALREADY EXIST WHEN THE DATABASE SCHEMA IS UPGRADED. THIS IS NORMAL ! 
    87    
     87 
  • pykota/trunk/initscripts/sqlite/pykota-sqlite.sql

    r3279 r3413  
    77-- the Free Software Foundation, either version 3 of the License, or 
    88-- (at your option) any later version. 
    9 --  
     9-- 
    1010-- This program is distributed in the hope that it will be useful, 
    1111-- but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313-- GNU General Public License for more details. 
    14 --  
     14-- 
    1515-- You should have received a copy of the GNU General Public License 
    1616-- along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3232CREATE TABLE users(id INTEGER PRIMARY KEY NOT NULL, 
    3333                   username TEXT UNIQUE NOT NULL, 
    34                    email TEXT,  
     34                   email TEXT, 
    3535                   balance FLOAT DEFAULT 0.0, 
    3636                   lifetimepaid FLOAT DEFAULT 0.0, 
     
    3838                   description TEXT, 
    3939                   overcharge FLOAT NOT NULL DEFAULT 1.0); 
    40                     
     40 
    4141-- 
    4242-- Create the groups table 
     
    4646                    description TEXT, 
    4747                    limitby TEXT DEFAULT 'quota'); 
    48                      
     48 
    4949-- 
    5050-- Create the printers table 
     
    5757                      passthrough BOOLEAN DEFAULT FALSE, 
    5858                      maxjobsize INT4); 
    59                      
     59 
    6060-- 
    6161-- Create the print quota table for users 
     
    7070                        datelimit TEXT, 
    7171                        maxjobsize INT4, 
    72                         warncount INT4 DEFAULT 0);  
     72                        warncount INT4 DEFAULT 0); 
    7373CREATE INDEX userpquota_u_id_ix ON userpquota (userid); 
    7474CREATE INDEX userpquota_p_id_ix ON userpquota (printerid); 
    7575CREATE UNIQUE INDEX userpquota_up_id_ix ON userpquota (userid, printerid); 
    76                          
     76 
    7777-- 
    7878-- Create the job history table 
     
    103103CREATE INDEX jobhistory_pd_id_ix ON jobhistory (printerid, jobdate); 
    104104CREATE INDEX jobhistory_hostname_ix ON jobhistory (hostname); 
    105                          
     105 
    106106-- 
    107107-- Create the print quota table for groups 
     
    117117CREATE INDEX grouppquota_p_id_ix ON grouppquota (printerid); 
    118118CREATE UNIQUE INDEX grouppquota_up_id_ix ON grouppquota (groupid, printerid); 
    119                          
    120 --                          
     119 
     120-- 
    121121-- Create the groups/members relationship 
    122122-- 
     
    124124                           userid INT4 REFERENCES users(id), 
    125125                           PRIMARY KEY (groupid, userid)); 
    126                             
    127 --                          
     126 
     127-- 
    128128-- Create the printer groups relationship 
    129129-- 
     
    133133-- 
    134134-- Create the table for payments 
    135 --  
     135-- 
    136136CREATE TABLE payments (id INTEGER PRIMARY KEY NOT NULL, 
    137137                       userid INT4 REFERENCES users(id), 
     
    141141CREATE INDEX payments_date_ix ON payments (date); 
    142142 
    143 --  
     143-- 
    144144-- Create the table for coefficients wrt paper sizes and the like 
    145145-- 
    146 CREATE TABLE coefficients (id INTEGER PRIMARY KEY NOT NULL,  
    147                            printerid INTEGER NOT NULL REFERENCES printers(id),  
    148                            label TEXT NOT NULL,  
    149                            coefficient FLOAT DEFAULT 1.0,  
     146CREATE TABLE coefficients (id INTEGER PRIMARY KEY NOT NULL, 
     147                           printerid INTEGER NOT NULL REFERENCES printers(id), 
     148                           label TEXT NOT NULL, 
     149                           coefficient FLOAT DEFAULT 1.0, 
    150150                           CONSTRAINT coeffconstraint UNIQUE (printerid, label)); 
    151151 
    152 --  
     152-- 
    153153-- Create the table for the billing codes 
    154154-- 
  • pykota/trunk/initscripts/sqlite/README.sqlite

    r3279 r3413  
    2727    for use with PyKota, in the case you don't want to use 
    2828    either PostgreSQL, MySQL, or LDAP : 
    29      
     29 
    3030    NB : an SQLite3 database can't be shared between several 
    3131    PyKota managed print servers, contrarily to the other 
    3232    database backends. 
    33      
     33 
    3434    HowTo : 
    35      
     35 
    3636      - Install SQLite v3.2.1 or higher, and its development files, 
    3737        for example on my Debian box : 
    38          
     38 
    3939                # apt-get install sqlite3 libsqlite3-dev 
    40                  
    41         You can also download SQLite from http://www.sqlite.org         
     40 
     41        You can also download SQLite from http://www.sqlite.org 
    4242 
    4343      - Download and install PySQLite v2.0.5 or higher from : 
    44        
     44 
    4545                http://www.pysqlite.org 
    4646 
     
    5050                # cd pysqlite-2.0.5 
    5151                # python setup.py install 
    52                  
     52 
    5353        Under Debian, if the package exists for your version of Debian, 
    5454        simply do : 
    55          
     55 
    5656                # apt-get install python-pysqlite2 
    57                  
     57 
    5858      - Create an SQLite3 database for PyKota : 
    5959 
     
    6262                # chmod 660 ~pykota/pykota.db 
    6363                # chown pykota.pykota ~pykota       (seems to be necessary) 
    64                  
     64 
    6565        NB : adapt the permissions so that the user your printing 
    6666             system runs as (e.g. user 'lp') can read and write 
    6767             to the /etc/pykota/pykota.db file. 
    68                  
     68 
    6969      - In ~pykota/pykotadmin.conf, just comment out all the lines 
    7070 
     
    7474                storagebackend : sqlitestorage 
    7575                storagename : /etc/pykota/pykota.db 
    76                  
     76 
    7777        And comment out all other directives which name begins with 'storage'. 
    7878        NB : feel free to use a different path to store pykota.db, and 
    7979             adapt your configuration files and permissions accordingly. 
    80                  
    81 Your PyKota setup is now ready to be used with an SQLite3 database.              
     80 
     81Your PyKota setup is now ready to be used with an SQLite3 database. 
    8282 
    8383IMPORTANT : with PyKota's SQLite backend there's no possibility to separate