[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.12,1.13
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.12,1.13 |
Date: |
Fri, 18 Jul 2003 17:10:16 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv17075/inc
Modified Files:
class.acl2.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.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.acl2.inc.php 18 Jul 2003 18:10:03 -0000 1.12
--- class.acl2.inc.php 18 Jul 2003 21:10:14 -0000 1.13
***************
*** 53,116 ****
}
- function cache_rights_org()
- {
- $expected_args[0] =
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
- $expected_args[1] =
Array('name'=>'app_id','default'=>$this->app_id, 'type'=>'number');
- $expected_args[2] =
Array('name'=>'account_id','default'=>$this->account_id, 'type'=>'number');
- $expected_args[3] =
Array('name'=>'owner_id','default'=>False, 'type'=>'number');
-
- $recieved_args = func_get_args();
- $args = safe_args($expected_args,
$recieved_args,__LINE__,__FILE__);
-
-
if(isset($this->rights_cache[$args['app_id']][$args['account_id']][$args['location']]))
- {
- return;
- }
-
- $sql = "SELECT
acl_rights,acl_type,acl_data,acl_location FROM fm_acl2 WHERE (acl_appid =
'".$args['app_id']."' ";
- $sql .= " and (acl_account in
(".$args['account_id']."".$this->memberships_sql.'))';
- $sql .= " and
(".$this->get_location_list($args['location'],$args['app_id'],$args['account_id']).")";
-
- if($args['owner_id']>0)
- {
- $sql .= " and (owner_id=" . $args['owner_id'] .
")";
- }
- else
- {
- $sql .= " and (owner_id is NULL)";
- }
-
- $sql .= ') ORDER BY acl_location, acl_type DESC';
-
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
-
if($this->rights_cache[$args['app_id']][$args['account_id']][$args['location']]
== 0)
- {
- if ($this->previous_location != '')
- {
-
$this->rights_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')]
=
$this->bit_mask($this->rights_cache[$args['app_id']][$args['account_id']][$this->previous_location],
$this->masks_cache[$args['app_id']][$args['account_id']][$this->previous_location]);
-
- }
- else
- {
-
$this->masks_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')]
= 0;
-
$this->rights_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')]
= 0;
- }
- }
-
- if((int)$this->db->f('acl_type') == 0)
- {
-
$this->rights_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')]
=
$this->bit_set($this->rights_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')],(int)$this->db->f('acl_rights'));
- }
- else
- {
-
$this->masks_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')]
=
$this->bit_set($this->rights_cache[$args['app_id']][$args['account_id']][$this->db->f('acl_location')],(int)$this->db->f('acl_rights'));
- }
-
- $this->previous_location =
$this->db->f('acl_location');
- }
- $this->previous_location = '';
- }
function cache_rights()
--- 53,56 ----
***************
*** 170,230 ****
}
- function get_location_list()
- {
- $expected_args[0] =
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
- $expected_args[1] =
Array('name'=>'app_id','default'=>$this->app_id, 'type'=>'number');
- $expected_args[2] =
Array('name'=>'account_id','default'=>$this->account_id, 'type'=>'number');
- $expected_args[3] =
Array('name'=>'return','default'=>'sql', 'type'=>'alpha');
-
- $recieved_args = func_get_args();
- $args = safe_args($expected_args,
$recieved_args,__LINE__,__FILE__);
- if(!strstr($args['location'], '.'))
- {
- $location_list =
Array('.','.'.$args['location'],$args['location']);
- $sql = "acl_location in ('.',
'.'.".$args['location'].",".$args['location'].")";
- return $sql;
- }
- $location_list = explode('.',$args['location']);
- $num = count($location_list);
- for ($i=0; $i < $num; $i++)
- {
- if(isset($location_list[$i-1]))
- {
- if($location_list[$i-1] != '.')
- {
- $location_list[$i] =
$location_list[$i-1].'.'.$location_list[$i];
- }
- else
- {
- $location_list[$i] =
$location_list[$i-1].$location_list[$i];
- }
- }
- else
- {
- $location_list[$i] = '.';
- }
-
- if(!isset($sql))
- {
- $sql = "acl_location in
('".$location_list[$i]."'";
- }
- else
- {
- $sql .= ",'".$location_list[$i]."'";
- }
-
- if($args['return'] != 'array' &&
!isset($this->rights_cache[$args['app_id']][$args['account_id']][$args['location']]))
- {
-
$this->rights_cache[$args['app_id']][$args['account_id']][$location_list[$i]] =
0;
-
$this->masks_cache[$args['app_id']][$args['account_id']][$location_list[$i]] =
0;
- }
- }
- $sql .= ')';
- if ($args['return'] == 'array')
- {
- return $location_list;
- }
- return $sql;
- }
function check_grant()
--- 110,113 ----
***************
*** 323,407 ****
}
$this->db->query($sql,__LINE__,__FILE__);
- $this->rights_cache = Array();
- $this->masks_cache = Array();
- }
-
- function set_org() // no inheritance 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__);
-
- $sql = "SELECT acl_rights 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 is NULL)";
- $this->db->query($sql,__LINE__,__FILE__);
- if($this->db->num_rows() != 0)
- {
- 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='".$args['location']."' AND acl_type=".$args['type'];
- $this->db->query($sql,__LINE__,__FILE__);
- }
- else
- {
- if($args['rights'] != 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'].",'".$args['location']."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
-
$this->db->query($sql,__LINE__,__FILE__);
- }
- }
- $this->rights_cache = Array();
- $this->masks_cache = Array();
- }
-
- function set_grant_org() // no inheritance 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 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__);
- if($this->db->num_rows() != 0)
- {
- 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='".$args['location']."' AND acl_type=".$args['type'] . " AND
owner_id = $owner_id";
- $this->db->query($sql,__LINE__,__FILE__);
- }
- else
- {
- if($args['rights'] != 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'].",'".$args['location']."',".$args['rights'].",".$args['type'].",'".$args['data']."',
$owner_id)";
-
$this->db->query($sql,__LINE__,__FILE__);
- }
- }
$this->rights_cache = Array();
$this->masks_cache = Array();
--- 206,209 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php,1.12,1.13,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php, 1.11, 1.12 class.boadmin.inc.php, 1.10, 1.11
- Next by Date:
[Phpgroupware-cvs] CVS: setup applications.php,1.21.2.4,1.21.2.5
- Previous by thread:
[Phpgroupware-cvs] CVS: property/inc class.acl2.inc.php, 1.11, 1.12 class.boadmin.inc.php, 1.10, 1.11
- Next by thread:
[Phpgroupware-cvs] CVS: setup applications.php,1.21.2.4,1.21.2.5
- Index(es):