Show
Ignore:
Timestamp:
10/06/04 12:05:47 (20 years ago)
Author:
jalet
Message:

Minor changes to allow any PyKota administrator to launch enhanced versions
of the commands, and not only the root user.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/config.py

    r1757 r1785  
    2222# 
    2323# $Log$ 
     24# Revision 1.53  2004/10/06 10:05:47  jalet 
     25# Minor changes to allow any PyKota administrator to launch enhanced versions 
     26# of the commands, and not only the root user. 
     27# 
    2428# Revision 1.52  2004/09/29 20:20:52  jalet 
    2529# Added the winbind_separator directive to pykota.conf to allow the admin to 
     
    237241    def __init__(self, directory) : 
    238242        """Reads and checks the configuration file.""" 
     243        self.isAdmin = 0 
     244        self.directory = directory 
    239245        self.filename = os.path.join(directory, "pykota.conf") 
    240246        if not os.path.isfile(self.filename) : 
     
    286292        backendinfo["storageadminpw"] = None 
    287293        adminconf = ConfigParser.ConfigParser() 
    288         adminconf.read(["/etc/pykota/pykotadmin.conf"]) 
     294        filename = os.path.join(self.directory, "pykotadmin.conf") 
     295        adminconf.read([filename]) 
    289296        if adminconf.sections() : # were we able to read the file ? 
    290297            try : 
    291298                backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1) 
    292299            except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) :     
    293                 raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", "/etc/pykota/pykotadmin.conf") 
     300                raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", filename) 
     301            else :     
     302                self.isAdmin = 1 # We are a PyKota administrator 
    294303            try : 
    295304                backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1)