Changeset 1515

Show
Ignore:
Timestamp:
01/16/08 11:29:48 (11 months ago)
Author:
ewout
Message:

Fix for access restrictions SQL that was not constructed correctly due to the changed order of execution of the various SQL where generating code. Should resolve #244. Thanks Kevin and Renato.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/community/lib/communities_access_level_sql_check.php

    r1080 r1515  
    2222    if (count($communitieslist) > 0) { 
    2323        $communitieslist = array_unique($communitieslist); 
    24         $run_result .= " or access IN ('community" . implode("', 'community", $communitieslist) . "') "; 
     24        if (!empty($run_result)) 
     25            $run_result .= " OR"; 
     26        $run_result .= " access IN ('community" . implode("', 'community", $communitieslist) . "') "; 
    2527    } 
    2628} 
  • devel/mod/groups/lib/function_access_level_sql_where.php

    r1251 r1515  
    33    // Returns an SQL "where" clause containing all the access codes that the user can see 
    44     
    5         if (logged_on) { 
     5if (isloggedin()) { 
    66             
    7             $groupslist = array(); 
    8              
    9             if ($groups = run("groups:getmembership",array($_SESSION['userid']))) { 
    10                 foreach($groups as $group) { 
    11                     $groupslist[] = $group->ident; 
    12                 } 
    13                 $run_result .= "or access IN ('group" . implode("', 'group", $groupslist) . "')"; 
     7  $groupslist = array(); 
     8   
     9  if ($groups = run("groups:getmembership",array($_SESSION['userid']))) { 
     10    foreach($groups as $group) { 
     11      $groupslist[] = $group->ident; 
     12    } 
     13    if (empty($run_result)) { 
     14                $run_result = ''; 
     15            } else { 
     16                $run_result .= ' OR '; 
    1417            } 
    15              
    16         } 
     18     
     19    $run_result .= " access IN ('group" . implode("', 'group", $groupslist) . "')"; 
     20  } 
     21   
     22 } 
    1723 
    1824?> 
  • devel/mod/users/lib/function_access_level_sql_where.php

    r1322 r1515  
    33    // Returns an SQL "where" clause containing all the access codes that the user can see 
    44     
    5         $run_result = " access = 'PUBLIC' "; 
    65     
    76        if (isloggedin() && isadmin($_SESSION['userid'])) { 
     
    109        elseif (isloggedin()) { 
    1110             
    12             $run_result = " owner = " . $_SESSION['userid'] . " "; 
     11            if (empty($run_result)) { 
     12                $run_result = ''; 
     13            } else { 
     14                $run_result .= ' OR '; 
     15            } 
     16             
     17            $run_result .= " owner = " . $_SESSION['userid'] . " "; 
    1318            $run_result .= " OR access IN ('PUBLIC', 'LOGGED_IN', 'user" . $_SESSION['userid'] . "') "; 
    1419