Show
Ignore:
Timestamp:
01/19/05 09:49:41 (19 years ago)
Author:
jalet
Message:

Now dumpykota.cgi behaves like printquota.cgi wrt the REMOTE_USER environment
variables if the script is username+password protected.
Small fix in printquota.cgi wrt ldap auth with Apache : the workaround was
not used everywhere.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/cgi-bin/dumpykota.cgi

    r2028 r2032  
    2424# 
    2525# $Log$ 
     26# Revision 1.5  2005/01/19 08:49:41  jalet 
     27# Now dumpykota.cgi behaves like printquota.cgi wrt the REMOTE_USER environment 
     28# variables if the script is username+password protected. 
     29# Small fix in printquota.cgi wrt ldap auth with Apache : the workaround was 
     30# not used everywhere. 
     31# 
    2632# Revision 1.4  2005/01/17 08:44:24  jalet 
    2733# Modified copyright years 
     
    149155                    self.arguments = self.form["filter"].value.split() 
    150156                     
     157                # when no authentication is done, or when the remote username     
     158                # is 'root' (even if not run as root of course), then unrestricted 
     159                # dump is allowed. 
     160                remuser = os.environ.get("REMOTE_USER", "root")     
     161                # special hack to accomodate mod_auth_ldap Apache module 
     162                try : 
     163                    remuser = remuser.split("=")[1].split(",")[0] 
     164                except IndexError :     
     165                    pass 
     166                if remuser != "root" : 
     167                    # non-'root' users when the script is password protected 
     168                    # can not dump any data as they like, we restrict them 
     169                    # to their own datas. 
     170                    if self.options["data"] not in ["printers", "pmembers", "groups", "gpquotas"] : 
     171                        self.arguments.append("username=%s" % remuser) 
     172                     
    151173                if self.options["format"] in ("csv", "ssv") : 
    152                     #ctype = "application/vnd.sun.xml.calc" 
     174                    #ctype = "application/vnd.sun.xml.calc"     # OpenOffice.org 
    153175                    ctype = "text/comma-separated-values" 
    154176                    fname = "dump.csv" 
    155177                elif self.options["format"] == "tsv" : 
    156                     #ctype = "application/vnd.sun.xml.calc" 
     178                    #ctype = "application/vnd.sun.xml.calc"     # OpenOffice.org 
    157179                    ctype = "text/tab-separated-values" 
    158180                    fname = "dump.tsv" 
     
    167189                print 
    168190                try : 
    169                     self.main(self.arguments, self.options) 
     191                    self.main(self.arguments, self.options, restricted=0) 
    170192                except PyKotaToolError, msg :     
    171193                    print msg