[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.10,1.11
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.10,1.11 |
Date: |
Mon, 14 Jul 2003 05:07:45 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv22697/inc
Modified Files:
class.acl2.inc.php
Log Message:
Inheritance saved to database
Index: class.acl2.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.acl2.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.acl2.inc.php 14 Jul 2003 08:51:56 -0000 1.10
--- class.acl2.inc.php 14 Jul 2003 09:07:41 -0000 1.11
***************
*** 313,317 ****
}
! function set_grant()
{
$expected_args[0] =
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
--- 313,317 ----
}
! function set_grant_org() // no inheritance saved to the database
{
$expected_args[0] =
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
***************
*** 350,353 ****
--- 350,442 ----
}
}
+ $this->rights_cache = Array();
+ $this->masks_cache = Array();
+ }
+
+ function set_grant() //inheritance is saved to the database
+ {
+ $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__);
+ $owner_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $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']." and owner_id = $owner_id)";
+ $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'] .
" AND owner_id = $owner_id";
+ $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);
+ }
+ $add_locations =
explode("-",implode("-",$add_locations));
+ //_debug_array($add_locations);
+ if(is_array($add_locations) && count($add_locations)>0)
+ {
+ for ($i=0;$i<count($add_locations);$i++)
+ {
+
+ for ($j=0;$j<($i+1);$j++)
+ {
+ $location
=$add_locations[$j];
+ }
+ //_debug_array($location);
+
+
if(strlen($location)>=strlen($args['location']))
+ {
+ 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 = '$location' and acl_type=".$args['type']. " AND owner_id =
$owner_id)";
+
$this->db->query($sql,__LINE__,__FILE__);
+
+ //echo $sql;
+
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,owner_id)
VALUES
(".$this->host_id.",".$args['app_id'].",".$args['account_id'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."',$owner_id)";
+
+
$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='".$location."' AND
acl_type=".$args['type'] . " AND owner_id = $owner_id";
+
$this->db2->query($sql,__LINE__,__FILE__);
+ }
+ }
+ }
+ unset($location);
+ }
+ }
+
$this->rights_cache = Array();
$this->masks_cache = Array();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.10,1.11,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/setup default_records.inc.php, 1.28, 1.29
- Next by Date:
[Phpgroupware-cvs] CVS: property/inc class.boinvoice.inc.php, 1.21, 1.22 class.bolocation.inc.php, 1.21, 1.22 class.bowo_hour.inc.php, 1.9, 1.10 class.soinvoice.inc.php, 1.31, 1.32 class.uiinvoice.inc.php, 1.28, 1.29 class.uiwo_hour.inc.php, 1.30, 1.31
- Previous by thread:
[Phpgroupware-cvs] CVS: property/setup default_records.inc.php, 1.28, 1.29
- Next by thread:
[Phpgroupware-cvs] CVS: property/inc class.boinvoice.inc.php, 1.21, 1.22 class.bolocation.inc.php, 1.21, 1.22 class.bowo_hour.inc.php, 1.9, 1.10 class.soinvoice.inc.php, 1.31, 1.32 class.uiinvoice.inc.php, 1.28, 1.29 class.uiwo_hour.inc.php, 1.30, 1.31
- Index(es):