Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 1757)
+++ /pykota/trunk/pykota/config.py (revision 1785)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.53  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.52  2004/09/29 20:20:52  jalet
 # Added the winbind_separator directive to pykota.conf to allow the admin to
@@ -237,4 +241,6 @@
     def __init__(self, directory) :
         """Reads and checks the configuration file."""
+        self.isAdmin = 0
+        self.directory = directory
         self.filename = os.path.join(directory, "pykota.conf")
         if not os.path.isfile(self.filename) :
@@ -286,10 +292,13 @@
         backendinfo["storageadminpw"] = None
         adminconf = ConfigParser.ConfigParser()
-        adminconf.read(["/etc/pykota/pykotadmin.conf"])
+        filename = os.path.join(self.directory, "pykotadmin.conf")
+        adminconf.read([filename])
         if adminconf.sections() : # were we able to read the file ?
             try :
                 backendinfo["storageadmin"] = adminconf.get("global", "storageadmin", raw=1)
             except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) :    
-                raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", "/etc/pykota/pykotadmin.conf")
+                raise PyKotaConfigError, _("Option %s not found in section global of %s") % ("storageadmin", filename)
+            else :    
+                self.isAdmin = 1 # We are a PyKota administrator
             try :
                 backendinfo["storageadminpw"] = adminconf.get("global", "storageadminpw", raw=1)
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 1771)
+++ /pykota/trunk/pykota/version.py (revision 1785)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.20alpha20_unofficial"
+__version__ = "1.20alpha21_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: /pykota/trunk/bin/pykotme
===================================================================
--- /pykota/trunk/bin/pykotme (revision 1584)
+++ /pykota/trunk/bin/pykotme (revision 1785)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.14  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.13  2004/07/01 19:56:42  jalet
 # Better dispatching of error messages
@@ -157,6 +161,5 @@
             
         # get current user
-        uid = os.geteuid()
-        username = pwd.getpwuid(uid)[0]
+        username = pwd.getpwuid(os.geteuid())[0]
         user = self.storage.getUser(username)
         if user.Exists and user.LimitBy and (user.LimitBy.lower() == "balance"):
Index: /pykota/trunk/bin/repykota
===================================================================
--- /pykota/trunk/bin/repykota (revision 1546)
+++ /pykota/trunk/bin/repykota (revision 1785)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.50  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.49  2004/06/18 13:34:49  jalet
 # Now all tracebacks include PyKota's version number
@@ -239,7 +243,7 @@
   with "laser" or ends with "pson".
   
-  If launched by a non-root user, additionnal arguments representing
-  users or groups names are ignored, and only the current user/group
-  is reported.
+  If launched by an user who is not a PyKota administrator, additionnal
+  arguments representing users or groups names are ignored, and only the
+  current user/group is reported.
 
 This program is free software; you can redistribute it and/or modify
@@ -263,7 +267,6 @@
     def main(self, ugnames, options) :
         """Print Quota reports generator."""
-        uid = os.geteuid()
-        if not uid :
-            # root user
+        if self.config.isAdmin :
+            # PyKota administrator
             if not ugnames :
                 # no username, means all usernames
@@ -272,5 +275,5 @@
             # not the root user
             # reports only the current user
-            username = pwd.getpwuid(uid)[0]
+            username = pwd.getpwuid(os.geteuid())[0]
             if options["groups"] :
                 user = self.storage.getUser(username)
Index: /pykota/trunk/bin/warnpykota
===================================================================
--- /pykota/trunk/bin/warnpykota (revision 1546)
+++ /pykota/trunk/bin/warnpykota (revision 1785)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.30  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.29  2004/06/18 13:34:49  jalet
 # Now all tracebacks include PyKota's version number
@@ -171,7 +175,7 @@
   with "laserjet"
   
-  If launched by a non-root user, additionnal arguments representing
-  users or groups names are ignored, and only the current user/group
-  is warned.
+  If launched by an user who is not a PyKota administrator, additionnal
+  arguments representing users or groups names are ignored, and only the
+  current user/group is reported.
 
 This program is free software; you can redistribute it and/or modify
@@ -195,17 +199,16 @@
     def main(self, ugnames, options) :
         """Warn users or groups over print quota."""
-        uid = os.geteuid()
-        if not uid :
-            # root user
+        if self.config.isAdmin :
+            # PyKota administrator
             if not ugnames :
                 # no username, means all usernames
                 ugnames = [ "*" ]
         else :        
-            # not the root user
+            # not a PyKota administrator
             # warns only the current user
             # the utility of this is discutable, but at least it
             # protects other users from mail bombing if they are
             # over quota.
-            username = pwd.getpwuid(uid)[0]
+            username = pwd.getpwuid(os.geteuid())[0]
             if options["groups"] :
                 user = self.storage.getUser(username)
Index: /pykota/trunk/bin/pykosd
===================================================================
--- /pykota/trunk/bin/pykosd (revision 1608)
+++ /pykota/trunk/bin/pykosd (revision 1785)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.8  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.7  2004/07/20 22:42:26  jalet
 # pykosd now supports setting color
@@ -141,6 +145,5 @@
         savecolor = color
         
-        uid = os.geteuid()
-        uname = pwd.getpwuid(uid)[0]
+        uname = pwd.getpwuid(os.geteuid())[0]
         while 1 :
             color = savecolor
Index: /pykota/trunk/bin/dumpykota
===================================================================
--- /pykota/trunk/bin/dumpykota (revision 1779)
+++ /pykota/trunk/bin/dumpykota (revision 1785)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.10  2004/10/06 10:05:47  jalet
+# Minor changes to allow any PyKota administrator to launch enhanced versions
+# of the commands, and not only the root user.
+#
 # Revision 1.9  2004/10/05 20:08:46  jalet
 # Misleading help message. Thx to Johannes Laemmermann.
@@ -149,4 +153,7 @@
     def main(self, arguments, options) :
         """Print Quota Data Dumper."""
+        if not self.config.isAdmin :
+            raise PyKotaToolError, _("You're not allowed to dump PyKota's datas.")
+            
         datatype = options["data"]
         if datatype not in [ "history",
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 1774)
+++ /pykota/trunk/NEWS (revision 1785)
@@ -22,4 +22,15 @@
 PyKota NEWS :
 
+    - 1.20alpha21 :
+    
+        - Now dumpykota refuses to launch if the current user is not
+          a PyKota administrator (a PyKota administrator is an user
+          allowed to read the pykotadmin.conf file).
+          
+        - Now any PyKota administrator can use repykota and warnpykota
+          with additionnal arguments, not only the root user.
+          
+        - Improved documentation a bit.
+        
     - 1.20alpha20 :
     
