[Mpuls-commits] r6082 - base/trunk/mpulsweb/model

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 1 17:23:57 CEST 2012


Author: torsten
Date: 2012-10-01 17:23:57 +0200 (Mon, 01 Oct 2012)
New Revision: 6082

Modified:
   base/trunk/mpulsweb/model/user.py
Log:
Update standin rules after setting reponsibility for agencys in evaluation
server.


Modified: base/trunk/mpulsweb/model/user.py
===================================================================
--- base/trunk/mpulsweb/model/user.py	2012-10-01 14:48:22 UTC (rev 6081)
+++ base/trunk/mpulsweb/model/user.py	2012-10-01 15:23:57 UTC (rev 6082)
@@ -92,6 +92,8 @@
 """
 DELETE_USER_AGENCY_SQL = """DELETE from nm_user_fkz WHERE user_id = %(id)s"""
 ADD_USER_AGENCY_SQL = """INSERT INTO nm_user_fkz (user_id, fkz_id) VALUES (%(id)s, %(fkz)s)"""
+DELETE_EVAL_STANDIN = """DELETE FROM nm_benutzer_master_tbl"""
+INSERT_EVAL_STANDIN = """INSERT INTO nm_benutzer_master_tbl (benutzer_id, master_id) select b.gid, m.id from nm_user_fkz nm JOIN fkz_tbl f ON f.id = nm.fkz_id JOIN ka_benutzer_tbl b ON b.id = nm.user_id JOIN master_tbl_view m ON m.fkz::integer = f.id"""
 
 
 def parse_dblogin(dblogin):
@@ -577,6 +579,9 @@
                 cur.execute(DELETE_USER_AGENCY_SQL, {'id': self.id})
                 for fkz in self.linked_fkz:
                     cur.execute(ADD_USER_AGENCY_SQL, {'id': self.id, 'fkz': fkz})
+                # Update responsibility
+                cur.execute(DELETE_EVAL_STANDIN)
+                cur.execute(INSERT_EVAL_STANDIN)
 
             conn.commit()
         finally:
@@ -604,6 +609,9 @@
             db.execute(DELETE_USER_AGENCY_SQL, {'id': self.id})
             for fkz in self.linked_fkz:
                 db.execute(ADD_USER_AGENCY_SQL, {'id': self.id, 'fkz': fkz})
+            # Update responsibility
+            db.execute(DELETE_EVAL_STANDIN)
+            db.execute(INSERT_EVAL_STANDIN)
 
     def delete(self):
         db.execute(DELETE_USER_SQL,



More information about the Mpuls-commits mailing list