Cleanup use of acl, one less db call, etc.

This commit is contained in:
Miles Lott 2001-08-23 04:29:20 +00:00
parent 9d60e7f2ac
commit b4eacadef8

View File

@ -21,15 +21,23 @@
function soaddressbook() function soaddressbook()
{ {
global $phpgw,$phpgw_info,$owner; if(!isset($GLOBALS['owner']))
{
$GLOBALS['owner'] = 0;
}
$owner = $GLOBALS['owner'];
if(!isset($owner)) { $owner = 0; } $this->contacts = CreateObject('phpgwapi.contacts');
$grants = $this->contacts->grants;
/* _debug_array($GLOBALS['phpgw_info']); */
/* _debug_array($grants); */
$grants = $phpgw->acl->get_grants('addressbook');
if(!isset($owner) || !$owner) if(!isset($owner) || !$owner)
{ {
$owner = $phpgw_info['user']['account_id']; $owner = $GLOBALS['phpgw_info']['user']['account_id'];
/* echo $owner; */
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
/* echo $rights; */
} }
else else
{ {
@ -38,7 +46,7 @@
$rights = $grants[$owner]; $rights = $grants[$owner];
if (!($rights & PHPGW_ACL_READ)) if (!($rights & PHPGW_ACL_READ))
{ {
$owner = $phpgw_info['user']['account_id']; $owner = $GLOBALS['phpgw_info']['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
} }
} }
@ -46,7 +54,6 @@
$this->rights = $rights; $this->rights = $rights;
$this->grants = $grants; $this->grants = $grants;
$this->owner = $owner; $this->owner = $owner;
$this->contacts = CreateObject('phpgwapi.contacts');
} }
function read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order) function read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order)