[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.acl2.php, 1.1.1.5
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.acl2.php, 1.1.1.5 |
Date: |
Fri, 21 May 2004 20:50:34 -0000 |
Update of /property
Modified Files:
Branch:
class.acl2.php
date: 2004/04/27 09:27:45; author: sigurdne; state: Exp; lines: +58 -98
Log Message:
no message
=====================================================================
Index: property/class.acl2.php
diff -u property/class.acl2.php:1.1.1.4 property/class.acl2.php:1.1.1.5
--- property/class.acl2.php:1.1.1.4 Sat Apr 24 19:39:54 2004
+++ property/class.acl2.php Tue Apr 27 09:27:45 2004
@@ -112,11 +112,11 @@
function member($accountid = '')
{
- $account_id = get_account_id($accountid);
+ $account_id = $this->get_account_id($accountid);
$security_equals = Array();
// $acl = CreateObject('phpgwapi.acl');
- $security_equals =
$this->get_ids_for_location($account_id, 1, 'phpgw_group');
+ $security_equals =
$this->get_ids_for_location($account_id, 1, '.api');
unset($acl);
if($security_equals == False)
@@ -140,15 +140,17 @@
@param $required required
@param $app app optional defaults to
$phpgw_info['flags']['currentapp'];
*/
- function get_ids_for_location($location, $required, $app =
False)
+ function get_ids_for_location($acl_account, $required,
$location = False)
{
-echo 'hepp';
- if ($app == False)
+//echo 'hepp';
+//html_print_r($GLOBALS['phpgw_data']['flags']['req_app']);
+ if ($location == False)
{
- $app =
$GLOBALS['phpgw_data']['flags']['req_app'];
+ $location =
'.'.$GLOBALS['phpgw_data']['flags']['req_app'];
}
- $sql = "select acl_account, acl_rights from phpgw_acl
where acl_appname = '$app' and ";
- $sql .= "acl_location = '".$location."'";
+// $sql = "select acl_account, acl_rights from phpgw_acl
where acl_appname = '$app' and ";
+// $sql .= "acl_location = '".$location."'";
+ $sql = "select acl_account, acl_rights from fm_acl2
where acl_location LIKE '%$location%' AND acl_account = '".$acl_account."'";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
$rights = 0;
if ($dbresult->_numOfRows == 0 )
@@ -536,45 +538,6 @@
}
}
-/*
- function exists($account_lid)
- {
- static $by_id, $by_lid;
-
- $sql = 'SELECT count(account_id) FROM phpgw_accounts
WHERE ';
- if(is_integer($account_lid))
- {
- if(@isset($by_id[$account_lid]) &&
$by_id[$account_lid] != '')
- {
- return $by_id[$account_lid];
- }
- $sql .= 'account_id=' . $account_lid;
- }
- else
- {
- if(@isset($by_lid[$account_lid]) &&
$by_lid[$account_lid] != '')
- {
- return $by_lid[$account_lid];
- }
- $sql .= "account_lid ='" . $account_lid . "'";
- }
-
- $dbresult = $GLOBALS['phpgw']->db->Execute($sql);
- $ret_val = $dbresult->fields[0] > 0;
- if(gettype($account_lid) == 'integer')
- {
- $by_id[$account_lid] = $ret_val;
- $by_lid[$this->id2name($account_lid)] =
$ret_val;
- }
- else
- {
- $by_lid[$account_lid] = $ret_val;
- $by_id[$this->name2id($account_lid)] = $ret_val;
- }
- return $ret_val;
- }
-
-*/
function cache_rights()
{
@@ -745,19 +708,22 @@
$recieved_args = func_get_args();
$args = $this->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 = "SELECT acl_rights FROM fm_acl2 WHERE (acl_appid
= '".$args['app_id']."' ";
+// $sql .= " and acl_account = ".$args['account_id'];
+ $sql = "SELECT acl_rights FROM fm_acl2 WHERE
(acl_account = '".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=".$args['type']." and grantor is NULL)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
if($dbresult->_numOfRows != 0)
{
$newrights = $this->bit_set($args['rights'],
(int)$dbresult->fields['acl_rights']);
$sql = "UPDATE fm_acl2 SET acl_rights
=".$newrights;
- $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'];
+// $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'];
+ $sql .= " WHERE acl_host=".$this->host_id." AND
acl_account=".$args['account_id']." AND acl_location='".$args['location']."'
AND acl_type=".$args['type'];
}
else
{
- $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']."')";
+// $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']."')";
+ $sql = "INSERT INTO fm_acl2
(acl_host,acl_account,acl_location,acl_rights,acl_type,acl_data) VALUES
(".$this->host_id.",".$args['account_id'].",'".$args['location']."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
}
$GLOBALS['phpgw']->db->Execute($sql);
$this->rights_cache = Array();
@@ -785,8 +751,9 @@
$grantor = $GLOBALS['phpgw_data']['user']['id'];
}
- $sql = "SELECT acl_rights, acl_location FROM fm_acl2
WHERE (acl_appid = '".$args['app_id']."' ";
- $sql .= " and acl_account = ".$args['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 = "SELECT acl_rights, acl_location FROM fm_acl2
WHERE (acl_account = ".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=".$args['type']." and grantor = $grantor)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
while (!$dbresult->EOF)
@@ -799,7 +766,8 @@
{
$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='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . " AND grantor = $grantor";
+// $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . " AND grantor = $grantor";
+ $sql .= " WHERE acl_host=".$this->host_id." AND
acl_account=".$args['account_id']." AND
acl_location='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . " AND grantor = $grantor";
$GLOBALS['phpgw']->db->Execute($sql);
$updated_locations[]=$dbresult->fields['acl_location'];
@@ -834,21 +802,24 @@
{
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 = "SELECT
acl_rights FROM fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
+ // $sql .= " and
acl_account = ".$args['account_id'];
+ $sql = "SELECT
acl_rights FROM fm_acl2 WHERE (acl_account = ".$args['account_id']."' ";
$sql .= " and
acl_location = '$location' and acl_type=".$args['type']. " AND grantor =
$grantor)";
$dbresult =
$GLOBALS['phpgw']->db->Execute($sql);
if($dbresult->_numOfRows == 0)
{
- $sql = "INSERT
INTO fm_acl2
(acl_host,acl_appid,acl_account,acl_location,acl_rights,acl_type,acl_data,grantor,grantor_type)
VALUES
(".$this->host_id.",".$args['app_id'].",".$args['account_id'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."',$grantor,'$grantor_type')";
+// $sql = "INSERT
INTO fm_acl2
(acl_host,acl_appid,acl_account,acl_location,acl_rights,acl_type,acl_data,grantor,grantor_type)
VALUES
(".$this->host_id.",".$args['app_id'].",".$args['account_id'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."',$grantor,'$grantor_type')";
+ $sql = "INSERT
INTO fm_acl2
(acl_host,acl_account,acl_location,acl_rights,acl_type,acl_data,grantor,grantor_type)
VALUES
(".$this->host_id.",".$args['account_id'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."',$grantor,'$grantor_type')";
$GLOBALS['phpgw']->db->Execute($sql);
}
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 grantor = $grantor";
+// $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 grantor = $grantor";
+ $sql .= " WHERE
acl_host=".$this->host_id." AND acl_account=".$args['account_id']." AND
acl_location='".$location."' AND acl_type=".$args['type'] . " AND grantor =
$grantor";
$GLOBALS['phpgw']->db->Execute($sql);
}
}
@@ -871,8 +842,9 @@
$expected_args[5] =
Array('name'=>'data','default'=>NULL, 'type'=>'any');
$recieved_args = func_get_args();
$args = $this->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 = "SELECT acl_rights, acl_location FROM fm_acl2
WHERE (acl_appid = '".$args['app_id']."' ";
+// $sql .= " and acl_account = ".$args['account_id'];
+ $sql = "SELECT acl_rights, acl_location FROM fm_acl2
WHERE (acl_account = ".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=".$args['type']." AND grantor is NULL)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
while (!$dbresult->EOF)
@@ -885,7 +857,8 @@
{
$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='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . ' AND grantor is NULL';
+// $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . ' AND grantor is NULL';
+ $sql .= " WHERE acl_host=".$this->host_id." AND
acl_account=".$args['account_id']." AND
acl_location='".$dbresult->fields['acl_location']."' AND
acl_type=".$args['type'] . ' AND grantor is NULL';
$GLOBALS['phpgw']->db->Execute($sql);
$updated_locations[]=$dbresult->fields['acl_location'];
$dbresult->MoveNext();
@@ -919,20 +892,23 @@
{
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 = "SELECT
acl_rights FROM fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
+// $sql .= " and
acl_account = ".$args['account_id'];
+ $sql = "SELECT
acl_rights FROM fm_acl2 WHERE (acl_account = ".$args['account_id']."' ";
$sql .= " and
acl_location = '$location' and acl_type=".$args['type']." AND grantor is NULL
)";
$dbresult =
$GLOBALS['phpgw']->db->Execute($sql);
if($dbresult->_numOfRows == 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'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
+// $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'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
+ $sql = "INSERT
INTO fm_acl2 (acl_host,acl_account,acl_location,acl_rights,acl_type,acl_data)
VALUES
(".$this->host_id.",".$args['account_id'].",'".$location."',".$args['rights'].",".$args['type'].",'".$args['data']."')";
$GLOBALS['phpgw']->db->Execute($sql);
}
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 grantor is NULL';
+// $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 grantor is NULL';
+ $sql .= " WHERE
acl_host=".$this->host_id." AND acl_account=".$args['account_id']." AND
acl_location='".$location."' AND acl_type=".$args['type'] . ' AND grantor is
NULL';
$GLOBALS['phpgw']->db->Execute($sql);
}
}
@@ -956,8 +932,9 @@
$recieved_args = func_get_args();
$args = $this->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 = "SELECT acl_rights FROM fm_acl2 WHERE (acl_appid
= '".$args['app_id']."' ";
+// $sql .= " and acl_account = ".$args['account_id'];
+ $sql = "SELECT acl_rights FROM fm_acl2 WHERE
(acl_account = ".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=".$args['type']." and grantor is NULL)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
if($dbresult->_numOfRows != 0)
@@ -971,7 +948,8 @@
{
$sql = "DELETE FROM fm_acl2";
}
- $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location LIKE '%".$args['location']."%' AND acl_type=".$args['type'] . '
and grantor is NULL';
+// $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location LIKE '%".$args['location']."%' AND acl_type=".$args['type'] . '
and grantor is NULL';
+ $sql .= " WHERE acl_host=".$this->host_id." AND
acl_account=".$args['account_id']." AND acl_location LIKE
'%".$args['location']."%' AND acl_type=".$args['type'] . ' and grantor is NULL';
$GLOBALS['phpgw']->db->Execute($sql);
$this->rights_cache = Array();
$this->masks_cache = Array();
@@ -999,8 +977,9 @@
$grantor = $GLOBALS['phpgw_data']['user']['id'];
}
- $sql = "SELECT acl_rights FROM fm_acl2 WHERE (acl_appid
= '".$args['app_id']."' ";
- $sql .= " and acl_account = ".$args['account_id'];
+// $sql = "SELECT acl_rights FROM fm_acl2 WHERE (acl_appid
= '".$args['app_id']."' ";
+// $sql .= " and acl_account = ".$args['account_id'];
+ $sql = "SELECT acl_rights FROM fm_acl2 WHERE
(acl_account = ".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=".$args['type']." and grantor = $grantor)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
if($dbresult->_numOfRows != 0)
@@ -1014,7 +993,8 @@
{
$sql = "DELETE FROM fm_acl2";
}
- $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location LIKE '%".$args['location']."%' AND acl_type=".$args['type'] . "
and grantor = $grantor";
+// $sql .= " WHERE acl_host=".$this->host_id." AND
acl_appid=".$args['app_id']." AND acl_account=".$args['account_id']." AND
acl_location LIKE '%".$args['location']."%' AND acl_type=".$args['type'] . "
and grantor = $grantor";
+ $sql .= " WHERE acl_host=".$this->host_id." AND
acl_account=".$args['account_id']." AND acl_location LIKE
'%".$args['location']."%' AND acl_type=".$args['type'] . " and grantor =
$grantor";
$GLOBALS['phpgw']->db->Execute($sql);
$this->rights_cache = Array();
$this->masks_cache = Array();
@@ -1033,8 +1013,9 @@
$recieved_args = func_get_args();
$args = $this->safe_args($expected_args,
$recieved_args,__LINE__,__FILE__);
- $sql = "SELECT acl_rights,acl_type,acl_data FROM
fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
- $sql .= " and acl_account = ".$args['account_id'];
+// $sql = "SELECT acl_rights,acl_type,acl_data FROM
fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
+// $sql .= " and acl_account = ".$args['account_id'];
+ $sql = "SELECT acl_rights,acl_type,acl_data FROM
fm_acl2 WHERE (acl_account = ".$args['account_id']."' ";
$sql .= " and acl_location = '".$args['location']."'
and acl_type=0)";
$dbresult = $GLOBALS['phpgw']->db->Execute($sql);
$rights = 0;
@@ -1046,28 +1027,6 @@
return $this->bit_check($rights,$args['required']);
}
- /* I dont feel this function will be needed, and plan to remove
it when certain.
- function check_location()
- {
- $expected_args[0] =
Array('name'=>'location','default'=>'##REQUIRED##', 'type'=>'alphanumeric');
- $expected_args[1] =
Array('name'=>'required','default'=>1, 'type'=>'number');
- $expected_args[2] =
Array('name'=>'app_id','default'=>$this->app_id, 'type'=>'number');
- $recieved_args = func_get_args();
- $args = $this->safe_args($expected_args,
$recieved_args,__LINE__,__FILE__);
-
- $sql = "SELECT acl_rights,acl_type,acl_data FROM
fm_acl2 WHERE (acl_appid = '".$args['app_id']."' ";
- $sql .= " and (acl_account in
(".$this->account_id.",".$this->memberships_sql.'))';
- $sql .= " and acl_location = '".$args['location']."'
and acl_type=0)";
- $dbresult = $GLOBALS['phpgw']->db->Execute($sql);
- $rights = 0;
- while (!$dbresult->EOF)
- {
- $rights =
$this->bit_set($rights,(int)$dbresult->fields['acl_rights']);
- $dbresult->MoveNext();
- }
- return $this->bit_check($rights,$args['required']);
- }
- */
function get_grants($app='',$location='')
{
if ($app=='')
@@ -1077,7 +1036,8 @@
$app_id =
$GLOBALS['phpgw']->applications->data[$app]['id'];
- $sql = "select grantor,grantor_type, acl_rights from
fm_acl2 where acl_appid = $app_id AND acl_type=0 and acl_location =
'$location' AND grantor is NOT NULL AND"
+// $sql = "select grantor,grantor_type, acl_rights from
fm_acl2 where acl_appid = $app_id AND acl_type=0 and acl_location =
'$location' AND grantor is NOT NULL AND"
+ $sql = "select grantor,grantor_type, acl_rights from
fm_acl2 where acl_type=0 AND acl_location = '$location' AND grantor is NOT
NULL AND"
. " fm_acl2.acl_account in ";
$security = "(". $this->account_id ."";
// $myaccounts = CreateObject('phpgwapi_accounts');
@@ -1091,7 +1051,7 @@
$security .= "," . $group['account_id'];
}
$security .= ')';
- $dbresult = $GLOBALS['phpgw']->db->Execute($sql);
+ $dbresult = $GLOBALS['phpgw']->db->Execute($sql .
$security);
$rights = 0;
$accounts = Array();
if ($dbresult->_numOfRows == 0)
@@ -1108,7 +1068,7 @@
if($grantor_type =='g')
{
- $grantor_members =
$myaccounts->member($grantor);
+ $grantor_members =
$this->member($grantor);
foreach($grantor_members as $grantor)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.acl2.php, 1.1.1.5,
nomail <=