Closed (duplicate)
Project:
Tagadelic
Version:
master
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
10 May 2006 at 15:05 UTC
Updated:
11 Nov 2008 at 13:52 UTC
Jump to comment: Most recent file
Tags should only be displayed to a user if they have permission to see at least one of the nodes tagged with that term. Currently a block of tags is displayed to an anonymous user even if they have no rights to access nodes. It also affects sites using different node-based permissions or the organic groups permissions system.
I think the weighting should also be dependent on the number of nodes they are able to see, not the total number of nodes tagged with that term.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | after.PNG | 3.59 KB | Alex Regenbogen |
| #17 | before.PNG | 3.82 KB | Alex Regenbogen |
| #13 | tagadelicpermissions2-cvs.diff.txt | 1.12 KB | geodaniel |
| #10 | tagadelicpermissions-cvs.diff | 4.52 KB | geodaniel |
| #8 | tagadelicpermissions.diff | 3.69 KB | geodaniel |
Comments
Comment #1
Bèr Kessels commentedThis is rather important.
Comment #2
geodaniel commentedI've rolled a patch that checks the permissions of nodes that tags refer to, and as long as at least one of those is accessible to the user then the tag is displayed. The number of nodes a user is allowed to see is then used to calculate the size, not the number of those tags across the whole site.
This may not scale well for large tag clouds as a query is made for each tag in the cloud.
Comment #3
geodaniel commentedComment #4
Bèr Kessels commentedThe patch looks good. but it fails. Can you please update it to the latest HEAD?
Comment #5
geodaniel commentedI've just tried to set up an install of HEAD and the latest OG and Tagadelic modules, but I can't get into either of their settings pages now that the settings pages have been depreciated. I'll come back and try and get this patch working once the settings pages for those modules are up and running.
Comment #6
catchI'm also getting restricted tags displayed to anonymous and other user groups using the taxonomy access control module
Comment #7
ju.ri commentedi would also be very interested in this. quite essential for a site with many organic groups. many thanks for looking into it :)
Comment #8
geodaniel commentedI've updated this patch to go against the current 4.7 version of the module. (Will hold off on CVS/5.0 one until the first RC is out).
Due to the potentially large number of database calls this patch could make, I've also added in a setting that allows the admin to choose whether or not they want these permissions to be cheched for each tag (and set the default to no).
Comment #9
geodaniel commentedComment #10
geodaniel commentedAh, I see the HEAD version is still 4.7 based, so I've gone ahead and patched that as well.
Comment #11
Bèr Kessels commentedThis needs to be improved, or else done a different way. I think we should look at the db_rewrite_sql instead.
This patch will be such a huge performance bottleneck that I cannot consider applying this as it is.
Comment #12
geodaniel commentedArgh. The voice of reason :) Ok, I'll check into db_rewrite_sql and see if it can be done more intelligently than the current patch.
Comment #13
geodaniel commentedThis patch should reduce the overhead - it does a query (through db_rewrite_sql on the node table) to get the node id's the user is allowed to access and then uses them in the main query to see if the nid from term_node is in that list. Does that reduce it to an acceptable level?
Should this be something that taxonomy.module does on its own instead of relying on contrib modules to each check on their own?
(I tried to limit this using db_rewrite_sql / hook_db_rewrite_sql but couldn't quite get my head around it)
Comment #14
Bèr Kessels commenteddb_rewrite_sql()
Can we not simply pass the 'SELECT COUNT(*) AS count ...' trough the db_rewrite_sql()?
Comment #15
Bèr Kessels commentedThere seems to be little interest, throttling down the Priority.
Comment #16
Bèr Kessels commentedAnyone care to review?
Comment #17
Alex Regenbogen commentedLooks like this does the trick.
I've got e few tags here that I'm not using for the general public.. And there not showing up after the patch.
Can't make statements about the performance though, since I'm not using a lot of tags to organize my posts in ;)
This fine module has made it into the list of modules for my upgrade-project (4.7 -> 5.0)!
Comment #18
Alex Regenbogen commentedSorry for the duplicate reply, forgot to 'merge' the two screenshots... ;)
Comment #19
Bèr Kessels commentedReviewed the code. Its not an option this way:
Imagine what happens when you have 62840 nodes? Innacceptible, this needs a better solution.
1) The overhead: looping trough 100.000 items is not an option.
2) The limit: IN() allows only so much entries, If I am not mistaken, only 255. This solution will trow warnings when you go over that limit.
3) The SQL overhead: an IN() is rather expensive. This slows down stuff a LOT.
4) The SLQ-over-the-Line: your SQL query itself will grow huge requiring a lot of stuff to be passed to-and-from Mysql server: requires a lot of memory.
Comment #20
wallan commentedSubscribing...
Comment #21
ednique commentedSame problem here...
People seeing the tags but no nodes for them...
Any other idea's for fixing this issue ???
Comment #22
ednique commentedOk, I made it work using db_rewrite_sql() on my 4.7.x-dev instance...
Use this query in the tagadelic_get_weighted_tags() function:
Comment #23
geodaniel commentedI haven't had a chance to try this out but it sounds like a good solution if it's working as expected through db_rewrite_sql.
Comment #24
ednique commentedIt works... juist make sure you do NOT test it with the admin account... For admins the sql is NOT rewritten... as they can see all...
Comment #25
Bèr Kessels commentedhttp://drupal.org/node/132759 was marked duplicate of this issue
http://drupal.org/node/164243 was marked duplicate of this issue
Comment #26
Bèr Kessels commentedI am closing this issue and merging it with http://drupal.org/node/84095
Comment #27
Bèr Kessels commentedContinued at http://drupal.org/node/141682