Author: jfthomps
Date: Thu Mar 17 13:30:19 2011
New Revision: 1082483

URL: http://svn.apache.org/viewvc?rev=1082483&view=rev
Log:
VCL-434

modified getUsersGroupPerms - if array of groups passed in was empty, an 
invalid query was generated; added check for empty array of groups
modified checkUserHasPerm - if $perms was empty, in_array would fail; added 
check for it being an array

Modified:
    incubator/vcl/trunk/web/.ht-inc/utils.php

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=1082483&r1=1082482&r2=1082483&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Thu Mar 17 13:30:19 2011
@@ -3169,6 +3169,8 @@ function getUsersGroups($userid, $includ
 ///
 
////////////////////////////////////////////////////////////////////////////////
 function getUsersGroupPerms($usergroupids) {
+       if(empty($usergroupids))
+               return array();
        $inlist = implode(',', $usergroupids);
        $query = "SELECT DISTINCT t.id, "
               .        "t.name "
@@ -3206,7 +3208,7 @@ function checkUserHasPerm($perm, $userid
                $usersgroups = getUsersGroups($userid, 1);
                $perms = getUsersGroupPerms(array_keys($usersgroups));
        }
-       if(in_array($perm, $perms))
+       if(is_array($perms) && in_array($perm, $perms))
                return 1;
        return 0;
 }


Reply via email to