[Tickets #5687] Re: guest can't access tickets whups
    bugs at bugs.horde.org 
    bugs at bugs.horde.org
       
    Thu Sep  6 03:36:26 UTC 2007
    
    
  
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=5687
-----------------------------------------------------------------------
 Ticket             | 5687
 Updated By         | lee_tao86 at yahoo.com
 Summary            | guest can't access tickets whups
 Queue              | Whups
 Type               | Bug
 State              | Feedback
 Priority           | 2. Medium
 Owners             | 
-----------------------------------------------------------------------
lee_tao86 at yahoo.com (2007-09-05 20:36) wrote:
> In a bug report you should be as specific as possible. Just saying 
> PHP 5 is a tiny bit of information but largely useless. Please be 
> more specific.
>
> Put in a var_dump of $permission in the line before the fatal error, 
> see what it is.
how can i put that var_dump??what is the code?i'm sorry my ability in
coding is not really good T_T.. this is the code:
-------------------------------------------------------------------------------------------------
 function getPermissions($permission, $user = null, $creator = null)
    {
        if (!is_a($permission, 'DataTreeObject_Permission')) {
            $permission = &$this->getPermission($permission);
            if (is_a($permission, 'PEAR_Error')) {
                Horde::logMessage($permission, __FILE__, __LINE__,
PEAR_LOG_DEBUG);
                return false;
            }
        }
        if (is_null($user)) {
            $user = Auth::getAuth();
	  
        }
        // If this is a guest user, only check guest permissions.
        if (empty($user)) {
            return $permission->getGuestPermissions();
	   
        }
        // If $creator was specified, check creator permissions.
        if (!is_null($creator)) {
            // If the user is the creator of the event see if there
            // are creator permissions.
            if (strlen($user) && $user === $creator &&
                ($perms = $permission->getCreatorPermissions()) !== null)
{
                return $perms;
            }
        }
---------------------------------------------------------------------------------------------------
    *****THIS IS THE ERROR PART****** 
   // Check user-level permissions.
 -->        $userperms = $permission->getUserPermissions();
        if (isset($userperms[$user])) {
           return $userperms[$user];
        }
--------------------------------------------------------------------------------------------------
        // If no user permissions are found, try group permissions.
        if (isset($permission->data['groups']) &&
            is_array($permission->data['groups']) &&
            count($permission->data['groups'])) {
            require_once 'Horde/Group.php';
            $groups = &Group::singleton();
            $composite_perm = null;
            $type = $permission->get('type');
            foreach ($permission->data['groups'] as $group => $perm) {
                if ($groups->userIsInGroup($user, $group)) {
                    if (is_null($composite_perm)) {
                        $composite_perm = $type == 'matrix' ? 0 :
array();
                    }
                    if ($type == 'matrix') {
                        $composite_perm |= $perm;
                    } else {
                        $composite_perm[] = $perm;
                    }
                }
            }
            if ($composite_perm !== null) {
                return $composite_perm;
            }
        }
        // If there are default permissions, return them.
        // if (($perms = $permission->getDefaultPermissions()) !== null)
{
        //  return $perms;
        //      }
        // Otherwise, deny all permissions to the object.
        return false;
    }
    
    
More information about the bugs
mailing list