[Mpuls-commits] r458 - in wasko/trunk: . waskaweb/lib waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 2 10:30:41 CEST 2009


Author: torsten
Date: 2009-04-02 10:30:39 +0200 (Thu, 02 Apr 2009)
New Revision: 458

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/lib/security.py
   wasko/trunk/waskaweb/model/case.py
   wasko/trunk/waskaweb/model/user.py
Log:
Fixed issue111


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-04-02 07:24:44 UTC (rev 457)
+++ wasko/trunk/ChangeLog.txt	2009-04-02 08:30:39 UTC (rev 458)
@@ -9,6 +9,13 @@
 	  Added new option "Teambesprechung". Adjusted evaluation on logbook
 	  page. 
 
+	Fixed issue111:
+
+	* waskaweb/model/case.py,
+	  waskaweb/model/user.py,
+	  waskaweb/lib/security.py: On creation of case the standin of the
+	  user is inserted into the case. 
+
 2009-04-01	Sascha L. Teichmann	<teichmann at intevation.de>
 
 	* waskaweb/converter/wasko_v1v2.py: Fixed elimination of

Modified: wasko/trunk/waskaweb/lib/security.py
===================================================================
--- wasko/trunk/waskaweb/lib/security.py	2009-04-02 07:24:44 UTC (rev 457)
+++ wasko/trunk/waskaweb/lib/security.py	2009-04-02 08:30:39 UTC (rev 458)
@@ -60,7 +60,7 @@
 check_re            = re.compile(r"^[a-z_0-9]+$")
 ROLE_SQL            = """select groname from pg_group where getOID() = ANY (grolist)"""
 ROLE_SQL            = """select where getOID() = ANY (grolist)"""
-FETCH_USER_DATA_SQL = """SELECT id, vorname, nachname, passwort_aendern, aktiviert, rolle, gid, last_login from ka_benutzer_tbl_view WHERE login = %(login)s"""
+FETCH_USER_DATA_SQL = """SELECT id, vorname, nachname, passwort_aendern, aktiviert, rolle, gid, last_login, vertreter from ka_benutzer_tbl_view WHERE login = %(login)s"""
 UPDATE_LASTLOGIN_SQL = """SELECT set_last_logintime(%(user_id)s)"""
 UNAUTHORIZED_DETAIL = \
 """Sie sind nicht authorisiert, das angeforderte Dokument anzuschauen.
@@ -113,6 +113,7 @@
                     data['role']       = unicode(str(result[5]), 'utf-8')
                     data['gid']        = result[6]
                     data['last_login'] = result[7]
+                    data['standin']    = result[8]
                 except:
                     data = None 
             finally:

Modified: wasko/trunk/waskaweb/model/case.py
===================================================================
--- wasko/trunk/waskaweb/model/case.py	2009-04-02 07:24:44 UTC (rev 457)
+++ wasko/trunk/waskaweb/model/case.py	2009-04-02 08:30:39 UTC (rev 458)
@@ -46,7 +46,7 @@
 from waskaweb.lib.xmlexport import exportAsXML
 from waskaweb.lib.base import session, g, h, config 
 import waskaweb.lib.filters as F
-from waskaweb.model.user import UserObject 
+from waskaweb.model.user import UserObject, UserGroupFactory
 from waskaweb.model.agencysettings import Agency
 from waskaweb.model.repeatgroup import AidList, CREATE_RG_BILDEN_DS,CREATE_RG_LEBEN_DS, CREATE_RG_QUALI_DS, CREATE_RG_BERUF_DS
 from waskaweb.model.statement import PrivacyStatement, AidPlanStatement, DiscretionStatement
@@ -127,7 +127,7 @@
 DELETE_CASE_SQL = """select delete_master_ds(%(id)s)""" 
 
 CREATE_CASE_SQL = """SELECT create_master_ds(%(uuid)s)"""
-UPDATE_CASE_ON_CREATE_SQL = """UPDATE master_tbl_view set name = %(name)s, vorname = %(vorname)s, einwilligung = %(einwilligung)s, addresse_strassenr_1 = %(strassenr)s,  addresse_strasse_1 = %(strasse)s, addresse_plz_1 = %(plz)s, addresse_ort_1 = %(ort)s WHERE id = %(id)s"""
+UPDATE_CASE_ON_CREATE_SQL = """UPDATE master_tbl_view set name = %(name)s, vorname = %(vorname)s, mitarb_vv = %(gvorname)s, mitarb_vn = %(gname)s, einwilligung = %(einwilligung)s, addresse_strassenr_1 = %(strassenr)s,  addresse_strasse_1 = %(strasse)s, addresse_plz_1 = %(plz)s, addresse_ort_1 = %(ort)s WHERE id = %(id)s"""
 INIT_CASE_SQL= """UPDATE page_0_view SET ks = %(ka_name)s, fkz = %(fkz)s, mitarb_zv = %(vorname)s, mitarb_zn = %(nachname)s WHERE id = %(id)s"""
 
 CREATE_RG_KOMPETENZ_DS = """SELECT create_rg_kompetenz_ds(%(id)s, %(uuid)s)"""
@@ -438,6 +438,13 @@
         conn, cur = None, None
         try:
             user = session['USER_AUTHORIZED']
+            if user.standin:
+                group = UserGroupFactory().load(user.standin)
+                gname = group.name
+                gvorname = 'Gruppe'
+            else:
+                gname = None 
+                gvorname = None 
             agency = Agency()
             statement = data.get('statement_signed') and 1 or -1 
 
@@ -448,6 +455,8 @@
                 'ort':          data.get('wohnort'),
                 'name':         data.get('name_1'),
                 'vorname':      data.get('vorname_1'),
+                'gname':        gname,
+                'gvorname':     gvorname,
                 'einwilligung': statement,
                 'id':           id
                 }

Modified: wasko/trunk/waskaweb/model/user.py
===================================================================
--- wasko/trunk/waskaweb/model/user.py	2009-04-02 07:24:44 UTC (rev 457)
+++ wasko/trunk/waskaweb/model/user.py	2009-04-02 08:30:39 UTC (rev 458)
@@ -333,6 +333,7 @@
         self.needs_passrefresh = data.get('newpass', True) 
         self.role = data.get('role', '') 
         self.last_login = data.get('last_login') or datetime.datetime.now()
+        self.standin = data.get('standin') 
 
 class SessionSuperAdmin(User):
     def __init__(self, lname, password):
@@ -457,6 +458,8 @@
             cur = con.cursor()
             cur.execute(ALTER_USER_STANDIN_SQL, fields)
             con.commit()
+            session['USER_AUTHORIZED'].standin = gid
+            session.save()
         finally:
             db.recycleConnection(con, cur)
 



More information about the Mpuls-commits mailing list