fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7107] API: Add?\194?\160mod-info?\194?\160to?\194?\1


From: Sigurd Nes
Subject: [Fmsystem-commits] [7107] API: Add?\194?\160mod-info?\194?\160to?\194?\160acl
Date: Fri, 11 Mar 2011 11:15:41 +0000

Revision: 7107
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7107
Author:   sigurdne
Date:     2011-03-11 11:15:39 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
API: Add?\194?\160mod-info?\194?\160to?\194?\160acl

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.acl.inc.php
    trunk/phpgwapi/setup/setup.inc.php
    trunk/phpgwapi/setup/tables_current.inc.php
    trunk/phpgwapi/setup/tables_update.inc.php

Modified: trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.acl.inc.php        2011-03-10 19:05:26 UTC (rev 
7106)
+++ trunk/phpgwapi/inc/class.acl.inc.php        2011-03-11 11:15:39 UTC (rev 
7107)
@@ -480,8 +480,12 @@
                        }
 
                        // using stored prosedures
-                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id)'
-                                                       . ' VALUES(?, ?, ?, ?, 
?)';
+                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id, modified_on, modified_by)'
+                                                       . ' VALUES(?, ?, ?, ?, 
?, ?, ?)';
+
+                       $now                    = time();
+                       $mod_account    = 
$GLOBALS['phpgw_info']['user']['account_id'] ? 
$GLOBALS['phpgw_info']['user']['account_id'] : -1;
+
                        $valueset=array();
 
                        foreach ( $new_data as $loc_id => $grants )
@@ -516,7 +520,17 @@
                                                        (
                                                                'value' => 
$loc_id,
                                                                'type'  => 
PDO::PARAM_INT
-                                                       ),                      
                                        
+                                                       ),
+                                                       6       => array
+                                                       (
+                                                               'value' => $now,
+                                                               'type'  => 
PDO::PARAM_INT
+                                                       ),
+                                                       7       => array
+                                                       (
+                                                               'value' => 
$mod_account,
+                                                               'type'  => 
PDO::PARAM_INT
+                                                       )
                                                );
                                        }
                                }
@@ -529,7 +543,7 @@
 
                        /*remove duplicates*/
 
-                       $sql = "SELECT * FROM phpgw_acl WHERE acl_account = 
{$acct_id}"
+                       $sql = "SELECT acl_account, acl_rights, acl_grantor, 
acl_type, location_id FROM phpgw_acl WHERE acl_account = {$acct_id}"
                        . ' GROUP BY acl_account, acl_rights, acl_grantor, 
acl_type, location_id';
                        $this->_db->query($sql,__LINE__,__FILE__);
 
@@ -572,7 +586,17 @@
                                                (
                                                        'value' => 
$_location_id,
                                                        'type'  => 
PDO::PARAM_INT
-                                               ),                              
                                
+                                               ),
+                                               6       => array
+                                               (
+                                                       'value' => $now,
+                                                       'type'  => 
PDO::PARAM_INT
+                                               ),
+                                               7       => array
+                                               (
+                                                       'value' => $mod_account,
+                                                       'type'  => 
PDO::PARAM_INT
+                                               )
                                        );
                                }
                //              
$test[$_acl_account][$_acl_grantor][$_acl_type][$_location_id] = true;
@@ -582,8 +606,8 @@
                                        . " WHERE acl_account = {$acct_id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
 
-                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id)'
-                                                       . ' VALUES(?, ?, ?, ?, 
?)';
+                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id, modified_on, modified_by)'
+                                                       . ' VALUES(?, ?, ?, ?, 
?, ?, ?)';
 
                        $this->_db->insert($sql, $unique_data, __LINE__, 
__FILE__);
                        unset($unique_data);
@@ -647,6 +671,9 @@
                        . ' GROUP BY acl_account, acl_rights, acl_grantor, 
acl_type, location_id';
                        $this->_db->query($sql,__LINE__,__FILE__);
 
+                       $now                    = time();
+                       $mod_account    = 
$GLOBALS['phpgw_info']['user']['account_id'] ? 
$GLOBALS['phpgw_info']['user']['account_id'] : -1;
+
                        $cache_info = array();
                        while($this->_db->next_record())
                        {
@@ -678,15 +705,25 @@
                                        (
                                                'value' => 
$this->_db->f('location_id'),
                                                'type'  => PDO::PARAM_INT
-                                       ),                                      
                        
+                                       ),
+                                       6       => array
+                                       (
+                                               'value' => $now,
+                                               'type'  => PDO::PARAM_INT
+                                       ),
+                                       7       => array
+                                       (
+                                               'value' => $mod_account,
+                                               'type'  => PDO::PARAM_INT
+                                       )
                                );
                        }
 
                        $sql = "DELETE FROM phpgw_acl {$condition}";
                        $this->_db->query($sql, __LINE__, __FILE__);
 
-                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id)'
-                                                       . ' VALUES(?, ?, ?, ?, 
?)';
+                       $sql = 'INSERT INTO phpgw_acl (acl_account, acl_rights, 
acl_grantor, acl_type, location_id, modified_on, modified_by)'
+                                                       . ' VALUES(?, ?, ?, ?, 
?, ?, ?)';
 
                        $this->_db->insert($sql, $unique_data, __LINE__, 
__FILE__);
                        unset($unique_data);
@@ -964,10 +1001,13 @@
                                $inherit_location[] = 
$this->_db->f('location_id');
                        }
 
+                       $now                    = time();
+                       $mod_account    = 
$GLOBALS['phpgw_info']['user']['account_id'] ? 
$GLOBALS['phpgw_info']['user']['account_id'] : -1;
+
                        foreach ( $inherit_location as $acl_location )
                        {
-                               $sql = 'INSERT INTO phpgw_acl (location_id, 
acl_account, acl_rights, acl_grantor, acl_type)'
-                                       . " VALUES ('{$acl_location}', 
{$account_id}, {$rights}, -1 , 0)";
+                               $sql = 'INSERT INTO phpgw_acl (location_id, 
acl_account, acl_rights, acl_grantor, acl_type, modified_on, modified_by)'
+                                       . " VALUES ('{$acl_location}', 
{$account_id}, {$rights}, -1 , 0, {$now}, {$mod_account})";
                                $this->_db->query($sql, __LINE__, __FILE__);
                        }
 

Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php  2011-03-10 19:05:26 UTC (rev 7106)
+++ trunk/phpgwapi/setup/setup.inc.php  2011-03-11 11:15:39 UTC (rev 7107)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.532';
+       $setup_info['phpgwapi']['version']   = '0.9.17.533';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '1.0';
        $setup_info['phpgwapi']['enable']    = 3;

Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2011-03-10 19:05:26 UTC (rev 
7106)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2011-03-11 11:15:39 UTC (rev 
7107)
@@ -42,6 +42,8 @@
                                'acl_grantor' => array('type' => 'int', 
'precision' => 4, 'nullable' => true, 'default' => '-1'),
                                'acl_type' => array('type' => 'int', 
'precision' => 2, 'nullable' => true, 'default' => '0'),
                                'location_id' => array('type' => 'int', 
'precision' => 4),
+                               'modified_on' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'modified_by' => array('type' => 
'int','precision' => 4,'nullable' => False, 'default' => '-1')
                        ),
                        'pk' => array(),
                        'ix' => array('location_id','acl_account'),

Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php  2011-03-10 19:05:26 UTC (rev 
7106)
+++ trunk/phpgwapi/setup/tables_update.inc.php  2011-03-11 11:15:39 UTC (rev 
7107)
@@ -2864,3 +2864,37 @@
                }
        }
 
+       $test[] = '0.9.17.532';
+       /**
+       * Add mod-info to acl
+       *
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_532()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_acl','modified_on',array(
+                       'type' => 'int',
+                       'precision' => '4',
+                       'nullable' => True
+               ));
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_acl','modified_by',array(
+                       'type' => 'int',
+                       'precision' => '4',
+                       'nullable' => True,
+                       'default'       => -1
+               ));
+
+               $now = time();
+
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_acl SET 
modified_on = {$now}, modified_by = -1");
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.533';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]