Dave Cohen wrote:
On Thursday 26 July 2007 10:48, Ron Parker wrote:
[snip]
  
So, my question is: Why is this hook_db_rewrite_sql code in a custom
module creating a circumstance where views no longer work as user #1
when the same code does NOT create this problem when replacing the
node_db_rewrite_sql function in the node.module?

    
Sounds like the node.module code is granting access, where your code is not.  
Look for enties with realm 'all' in the node_access table.

  
Actually, it was the exact opposite: My new code was granting access.  I resolved it by adding code that exempts user #1 (or any user with "administer nodes" permission).

  
I'm ThisClose to making this all work after several months of banging my
head against the wall, so any suggestions are much appreciated.  Thanks!
    

My suggestions are: 1) Install devel module and enable the query log.  Look at 
the exact SQL that is the result of all the rewriting.  And 2) Enable 
devel_node_access and see what it has to say.  And of course 3) debug your 
problem.

  
I did install devel module.  Thanks for the suggestion.
I'm also going to reiterate what Moshe said earlier.  Think long and hard 
before implementing your own hook_db_rewrite_sql.  The grant hooks can do 
quite a lot for you.  Sounds like you may know what you're doing - I don't 
mean to imply that you don't.

  
Again, you are right.  I actually used the hook_node_access_records() in another module to create the exact permission grants I needed for private access to work without hook_db_rewrite_sql().  Problem here is I've not though through a way to grant permissions that take into account OG, TAC and Content Access (CA) access control.

I can assure you I take everything you suggest as an effort to help, and apprecite it as such.  Using the node access API is a much better way to go, no question about it.  I just have not figured out how to do it as efficiently or effectively as I have with hook_nodeapi and hook_db_rewrite_sql.

Thanks for all the help!

-ron
-Dave



__________ NOD32 2424 (20070726) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



  


-- 
Ron Parker
Software Creations               http://www.scbbs.com
Self-Administration Web Site     http://saw.scbbs.com
SDSS Subscription Mgmt Service   http://sdss.scbbs.com
Central Ave Dance Ensemble       http://www.centralavedance.com
R & B Salsa                      http://www.randbsalsa.com