bugphpGroupWare - Bugs: bug #5482, function get_specific_rights -...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #5482: function get_specific_rights - error when checking group permissions

Submitted by:  Johnson <jecinc>
Submitted on:  Mon 22 Sep 2003 08:54:22 PM UTC  
 
Item Group: 0.9.16RC1Category: API - phpGroupware API
Severity: 3 - NormalPriority: 5 - Normal
Status: InvalidPrivacy: Public
Assigned to: Dave Hall <skwashd>Open/Closed: Closed
Component Version: SVNOperating System: GNU/Linux - RedHat/Fedora
Reproducibility: NonePlanned Release: None
Fixed Release: 

Wed 24 Sep 2003 03:28:36 AM UTC, comment #3:

I can't find the code you refer to anywhere.

This is what I have for that method:

/*!
@function get_specific_rights
@abstract get specific rights for this->account_id for an app location
@param $location app location
@param $appname optional defaults to currentapp
@result $rights ?
*/
function get_specific_rights($location, $appname = False)
{
if ($appname == False)
{
settype($appname,'string');
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
}

$count = count($this->data);
if ($count == 0 && $GLOBALS['phpgw_info']['server']['acl_default'] != 'deny')
{
return True;
}
$rights = 0;

reset ($this->data);
while(list($idx,$value) = @each($this->data))
{
if ($this->data[$idx]['appname'] == $appname &&
($this->data[$idx]['location'] == $location ||
$this->data[$idx]['location'] == 'everywhere') &&
$this->data[$idx]['account'] == $this->account_id)
{
if ($this->data[$idx]['rights'] == 0)
{
return False;
}
$rights |= $this->data[$idx]['rights'];
}
}
return $rights;
}

Dave Hall <skwashd>
Project AdministratorIn charge of this item.
Tue 23 Sep 2003 04:48:41 AM UTC, comment #2:

near line 360 of phpgwapi/inc/class.acl.inc.php

the problem is when you use get_specific_rights on a group account id and have $checkgroups=True

the $userGroups = $GLOBALS['phpgw']->accounts->membership($this->account_id); returns a false and then you get an error at while (list($null,$ad_account) = each($userGroups)) since $userGroups is not an array (it is false or null)

it is rare that someone would do this, but adding $userGroups = $userGroups ? $userGroups : array(); between the above lines eliminates the error

Johnson <jecinc>
Mon 22 Sep 2003 10:54:46 PM UTC, comment #1:

Hi,

Can you please provide the error message that is being generated. I have grep'd for this code and can't find it anywhere.

Cheers

Dave Hall <skwashd>
Project AdministratorIn charge of this item.
Mon 22 Sep 2003 08:54:22 PM UTC, original submission:

Warning output when processing group id's at line:
while (list($null,$ad_account) = each($userGroups))

The function works as expected but issues warnings to screen.

problem is that $userGroups = $GLOBALS['phpgw']->accounts->membership($this->account_id); doesn't return and array when $this->account_id is a group

adding $userGroups = $userGroups ? $userGroups : array(); before the while() gets rid of the error

Johnson <jecinc>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 24 Sep 2003 03:49:51 AM UTCskwashdStatusNone=>(Error - Not Found)
  Open/ClosedOpen=>(Error - Not Found)
Mon 22 Sep 2003 10:54:46 PM UTCskwashdPriority100(Error - Not Found)=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1