Loading...
 

SearchPermissionsQuickfix

Image
// Check wiki permissions
// This was done quickly and with a sense of urgency
// It may be useful to anyone in a similar position who
// can't wait for a better fix.
// This code should be located after tiki-searchindex.php
// populates the $results variable  -zibas
  if($user){
  $group = $userlib->get_user_groups($user);
  }
  $filtered_results = array();
          foreach($results["data"] as $e){
            if($e['location'] ==  "Wiki"){
              $page=$e["pageName"];
              $perms = $userlib->get_object_permissions($page, 'wiki page');
              if(isset($perms[0])){
                if($user){
                foreach($perms as $perm){
                  if($perm["permName"] == "tiki_p_view"){
                    if(in_array($perm["groupName"],$group)){
                      $filtered_results['data'][]=$e;
                    }
                  }
                }
                }
              }
              else{
                $filtered_results['data'][]=$e;
              }
            }
          }
  $results['data'] = $filtered_results['data'];

Page last modified on Wednesday 29 September 2004 14:05:22 GMT-0000