phpgroupware-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-tracker] [bug #5482] function get_specific_rights - error


From: nobody
Subject: [Phpgroupware-tracker] [bug #5482] function get_specific_rights - error when checking group permissions
Date: Tue, 23 Sep 2003 23:28:37 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030618 Debian/1.3.1-3

=================== BUG #5482: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5482&group_id=509

Changes by: Dave Hall <address@hidden>
Date: Wed 09/24/03 at 13:28 (Australia/Melbourne)

------------------ Additional Follow-up Comments ----------------------------
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;

                }





=================== BUG #5482: FULL BUG SNAPSHOT ===================


Submitted by: jecinc                  Project: phpGroupWare                 
Submitted on: Tue 09/23/03 at 06:54
Category:  API - phpGWapi             Bug Group:  0.9.16RC1                 
Severity:  5 - Major                  Priority:  Normal                     
Resolution:  None                     Assigned to:  skwashd                 
Status:  Open                         Component Version:  CVS               
Platform Version:  Linux - RedHat     Reproducibility:  None                

Summary:  function get_specific_rights - error when checking group permissions

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

Follow-up Comments
*******************

-------------------------------------------------------
Date: Wed 09/24/03 at 13:28         By: skwashd
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;

                }



-------------------------------------------------------
Date: Tue 09/23/03 at 14:48         By: jecinc
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

-------------------------------------------------------
Date: Tue 09/23/03 at 08:54         By: skwashd
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


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5482&group_id=509

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]