Closed (fixed)
Project:
Table Manager
Version:
4.6.x-1.x-dev
Component:
User interface
Priority:
Minor
Category:
Bug report
Assigned:
Reporter:
Created:
26 Nov 2005 at 00:12 UTC
Updated:
28 Nov 2005 at 16:33 UTC
When simple_access module is enabled, the anonymous users view this error in the page:
"No table data available."
In the admin panel, the log say:
Unknown table 'n' in on clause query: SELECT tm.tid, tm.header, tmd.tid, tmd.data FROM tablemanager_data tmd INNER JOIN node_access na ON na.nid = n.nid INNER JOIN tablemanager tm ON tm.tid = tmd.tid WHERE (na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0','simple_access0','simple_access2')) AND tmd.tid = '1' in /home/mhd-01/www.nomesito.it/htdocs/includes/database.mysql.inc nella riga 66.
Comments
Comment #1
pobster commentedThe tables aren't stored as nodes, they're stored in their own separate table in your database... What I *think* is happening here is that the simple_access module completely takes over the serving of the pages from Drupal and I *think* (BIG EMPHASIS ON **THINK**) is that simple_access is blocking access to your table data as it doesn't know what it is and believes it to be grabbing data from another node. The reason I think this is that that ISN'T one of the queries in my code, I'll wager that simple_access rewrites ALL queries so it can control access to whats going on.
I'll contact the author of simple_access and ask them to take a look at whats going on here and maybe they can patch the code to allow lookups to the tablemanager db (or allow permissions or whatever) - I'm no expert, bear with me here...
Pobster
Comment #2
pobster commentedIncidentally I kinda wrote something important there and forgot to explain it properly... Tablemanager DOESN'T store data as nodes, hence why you can't just go into simple_access and enable your data to be viewable.
Maybe the author of simple_access could provide a patch for my code to check to see whether (if the their module is enabled) the viewer is allowed access to the node being accessed? If they do have permissions then my module will display the information... Obviously that'd call for their code to always allow calls to tablemanager and tablemanager_data to not be restricted.
This all makes sense to me in my head... But of course, I don't know if this is how it works...
Pobster
Comment #3
pobster commentedMore can't fix than won't fix... Not a bug with my module, it's an issue with simple_access not having the facility to set permissions for tablemanager db lookups, which is hardly surprising as simple_access is a few months old and tablemanager only a couple of weeks! :o)
Pobster
Comment #4
pobster commentedComment #5
jjeff commentedPobster,
I need to look into this more closely, but that query does NOT look like something that Simple Access is creating.
Actually, Simple Access only manages the core node access functions. And access-wise, it doesn't add anything that is not already in the core. It also does NOT rewrite any queries.
It looks like something weird is happening around the 4th line of the tablemanager_display() function:
However Simple Access does not implement hook_db_rewrite_sql(), so it's not Simple Access rewriting the query. I actually think it is node_db_rewrite_sql() that is the culprit.
But I think that this is happening because tablemanager.module isn't calling the db_rewrite_sql() function properly. The default value for the second argument of db_rewrite_sql() is 'n', however the $sql in the above line doesn't contain a reference to the {node} table (n), so it should be sending a second argument defining the primary table.
The documentation for db_rewrite_sql() says:
Which makes me think that the use of db_rewrite_sql() is inappropriate above.
Either way, I'm pretty sure that Simple Access is not to blame for the "Unknown table 'n' in on clause query:" error because the table 'n' is being brought in by the db_rewrite_sql() call in the above code.
-Jeff
Comment #6
pobster commentedOooo! :o) Okay! Thanks - will look into it...
Pobster
Comment #7
pobster commentedFixed... Embarrassingly... I actually stole (*cough* 'adapted') the original code from another module and didn't really know what it did (YES REALLY!!! I don't have a clue!) Anyways, I thought that the pager_query needed the rewrite to function correctly, but of course... It doesn't... Man, there really should be better write-ups for the APIs... That's my excuse anyways! ;o)
Either download the packaged version tomorrow or simply change these lines:
To:
Sorry about that! BTW, it's in more places than just there - in tablemanager_list and tablemanager_admin as well...
Pobster
Comment #8
pobster commentedComment #9
pobster commented