phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.4,1.5 class.bo


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.4,1.5 class.bocommon.inc.php,1.24,1.25
Date: Mon, 10 Mar 2003 08:24:00 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv17523/inc

Modified Files:
        class.acl2.inc.php class.bocommon.inc.php 
Log Message:
no message

Index: class.acl2.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.acl2.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.acl2.inc.php  10 Mar 2003 09:17:08 -0000      1.4
--- class.acl2.inc.php  10 Mar 2003 13:23:25 -0000      1.5
***************
*** 23,27 ****
                        $args = safe_args($expected_args, 
$recieved_args,__LINE__,__FILE__);
  //_debug_array($args);
!                       $this->db = $GLOBALS['phpgw']->db;
                        $this->account_id = $args['account_id'];
                        $this->host_id = $args['host_id'];
--- 23,30 ----
                        $args = safe_args($expected_args, 
$recieved_args,__LINE__,__FILE__);
  //_debug_array($args);
!                       $this->db       = $GLOBALS['phpgw']->db;
!                       $this->db2      = $this->db;
! 
! 
                        $this->account_id = $args['account_id'];
                        $this->host_id = $args['host_id'];
***************
*** 248,251 ****
--- 251,331 ----
                                }
                        }
+                       $this->rights_cache = Array();
+                       $this->masks_cache = Array();
+               }
+ 
+               function set_test() //rights_cache are making false inheritance 
(not inheriting from parent before one child is defined)
+               {
+                       $expected_args[0] = 
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
+                       $expected_args[1] = 
Array('name'=>'rights','default'=>1, 'type'=>'number');
+                       $expected_args[2] = 
Array('name'=>'account_id','default'=>$this->account_id, 'type'=>'number');
+                       $expected_args[3] = Array('name'=>'type','default'=>0, 
'type'=>'number');
+                       $expected_args[4] = 
Array('name'=>'app_id','default'=>$this->app_id, 'type'=>'number');
+                       $expected_args[5] = 
Array('name'=>'data','default'=>NULL, 'type'=>'any');
+                       $recieved_args = func_get_args();
+                       $args = safe_args($expected_args, 
$recieved_args,__LINE__,__FILE__);
+                       $sql = "SELECT acl_rights, acl_location FROM fm_acl2 
WHERE (acl_appid = '".$args['app_id']."' ";
+                       $sql .= " and acl_account = ".$args['account_id'];
+                       $sql .= " and acl_location = '".$args['location']."' 
and acl_type=".$args['type'].")";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while($this->db->next_record())
+                       {
+                               if((int)$args['rights'] == 0)
+                               {
+                                       $sql = "DELETE FROM fm_acl2";
+                               }
+                               else
+                               {
+                                       $sql = "UPDATE fm_acl2 SET acl_rights 
=".$args['rights'];
+                               }
+                               $sql .= " WHERE acl_host=".$this->host_id." AND 
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND 
acl_location='".$this->db->f('acl_location')."' AND acl_type=".$args['type'];
+                               $this->db2->query($sql,__LINE__,__FILE__);
+ 
+                               
$updated_locations[]=$this->db->f('acl_location');
+                       }
+ 
+                       $sql = "SELECT id FROM fm_submodule WHERE (id like 
'%".$args['location']."%')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while($this->db->next_record())
+                       {
+ 
+                               $add_locations[]=$this->db->f('id');
+                       }
+ 
+                       if($updated_locations)
+                       {
+                               $add_locations  = array_diff($add_locations, 
$updated_locations);
+ 
+ 
+                       }
+                       if(is_array($add_locations) && count($add_locations)>0)
+                       {
+                               $add_locations= explode("_",implode("_", 
$add_locations));
+ //_debug_array($add_locations);
+                               for ($i=0;$i<count($add_locations);$i++)
+                               {
+                                       if($args['rights'] != 0)
+                                       {
+                                               $sql = "SELECT acl_rights FROM 
fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
+                                               $sql .= " and acl_account = 
".$args['account_id'];
+                                               $sql .= " and acl_location = 
'".$add_locations[$i]."' and acl_type=".$args['type'].")";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+ 
+                                               if($this->db->num_rows() == 0)
+                                               {
+                                                       $sql = "INSERT INTO 
fm_acl2 
(acl_host,acl_appid,acl_account,acl_location,acl_rights,acl_type,acl_data) 
VALUES 
(".$this->host_id.",".$args['app_id'].",".$args['account_id'].",'".$add_locations[$i]."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
+ 
+                                                       
$this->db2->query($sql,__LINE__,__FILE__);
+                                               }
+                                               else
+                                               {
+                                                       $sql = "UPDATE fm_acl2 
SET acl_rights =".$args['rights'];
+                                                       $sql .= " WHERE 
acl_host=".$this->host_id." AND acl_appid=".$args['app_id']." AND 
acl_account=".$args['account_id']." AND acl_location='".$add_locations[$i]."' 
AND acl_type=".$args['type'];
+                                                       
$this->db2->query($sql,__LINE__,__FILE__);
+                                               }
+                                       }
+                               }
+                       }
+ 
                        $this->rights_cache = Array();
                        $this->masks_cache = Array();

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** class.bocommon.inc.php      8 Mar 2003 22:23:15 -0000       1.24
--- class.bocommon.inc.php      10 Mar 2003 13:23:25 -0000      1.25
***************
*** 459,463 ****
                                'link_helpdesk'         =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index'),
                                'lang_helpdesk'         =>      
lang('Helpdesk'),
!                               'link_workorder'        =>      
$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder'),
                                'lang_workorder'        =>      
lang('Workorder'),
                                'link_invoice'          =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index'),
--- 459,463 ----
                                'link_helpdesk'         =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index'),
                                'lang_helpdesk'         =>      
lang('Helpdesk'),
!                               'link_workorder'        =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index'),
                                'lang_workorder'        =>      
lang('Workorder'),
                                'link_invoice'          =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index'),





reply via email to

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