resume nodes show up in search results

enky - September 19, 2006 - 13:19
Project:Job Search
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs work
Description

hi,

i love this module, but, the resume nodes are showing up in search results,

i think patches are required for the drupal 4.7.3 node.module, to exclude
the 'resume' node type from being indexed by the search module.

any ideas?

#1

drupalgirl - December 18, 2007 - 02:01
Version:4.7.x-1.x-dev» 5.x-1.x-dev

Has this issue been dealt with? Please let users know if still represent a security issue for the resume poster.

#2

klance - April 23, 2008 - 18:30

I'm glad I looked at this bug report, because I didn't realize it was doing that. One of my modules was doing the same thing, and I had to implement hook_db_rewrite_sql to overcome this problem. In this case it would look something like this:

/*
* Implementation of hook_db_rewrite_sql().
*/
function job_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  switch ($primary_field) {
    case 'nid':
      // this query deals with node objects
      $return = array();
      if (!user_access('view resumes')) {
        if ($primary_table != 'n') {
          $return['join'] = "LEFT JOIN {node} n ON $primary_table.nid = n.nid";
        }
        $return['where'] = "n.type <> 'resume'";
        return $return;
      }
      break;
    case 'tid':
      // this query deals with taxonomy objects
      break;
    case 'vid':
      // this query deals with vocabulary objects
      break;
  }
}

#3

klance - April 23, 2008 - 15:37
Status:active» needs review

#4

kbahey - April 23, 2008 - 17:40
Status:needs review» needs work

@klance

There are two modules included with the job search module for node access stuff.

Can you please check if your function should go into the resume_access or job_access module rather than the main? Also please test the results with the new change for regression (current access permissions are not affected).

Thanks

#5

klance - April 23, 2008 - 18:30

Cut the code from job.module and paste it into resume.module. Same effect, more appropriate location.

AttachmentSize
resume.module.patch 977 bytes

#6

klance - April 24, 2008 - 18:02

Yeesh... that gets it out of the search results, but it causes an SQL error that prevents views from showing up. Oh well...

 
 

Drupal is a registered trademark of Dries Buytaert.