pyromanfo,
Here is my patch to CVS that incorporates my improvements that I posted here a couple of weeks ago. It's basically the same except for the following:
-Changed 'tax_access' to 'term_access' per your suggestion at http://drupal.org/node/12892
-Cleaned up some code to be in compliance with Drupal coding standards
-Added a hook_user() function that checks to see if new roles have been added
-Squashed a bug in my _taxonomy_access_update_db() function
-Got rid of author permissions feature that posed security risk
-As a security precaution, I changed default permissions for newly created taxonomies and roles so that content is not viewable at first. The user must specifically change this in category permissions in order for content to be viewed.
One minor thing that still needs to be done:
-The code that handles the case of a user having no role can be yanked. I found out that it is not supposed to be possible. I'll take care of this in another patch.
After some limited testing on my test site, all appears to work well. Please check it out and let me know what you think.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | taxonomy_access_1.module | 21.38 KB | Anonymous (not verified) |
| #1 | taxonomy_access_5.patch | 25.69 KB | Steve Dondley |
| taxonomy_access_4.patch | 25.67 KB | Steve Dondley |
Comments
Comment #1
Steve Dondley commentedI found a bug in a last minute revision to my patch; I didn't provide NULL values as default parameters to the _taxonomy_access_update_db() function.
Attached is the corrected patch. Please use this one.
Comment #2
nazadus commentedI tried to patch this against the latest CVS (wget'ed mere hours ago) and I got all hunks failed.
Using 'patch -p0 module < patch' format.
Am I missing something?
I've also tried patching against my insanely patched module already (heh) and it failed as well..
I also tried patching 1 version back in CVS and failed...
/confused now.
Comment #3
Steve Dondley commentedI can't duplicate your problem. I just downloaded and applied this patch to the cvs version with the same command you used and had no problem.
Has the patch failed for anyone else out there?
Comment #4
Steve Dondley commentednazadus,
After thinking about this more, I'm guessing there might be a whitespace problem. The cvs verison of this module was written on a Windows machine which uses both a linefeed character and a carriage return to terminate a line. This could be causing problems. In fact, I just noticed that when I do my patch, I get a little warning that the CRs (carriage returns) in my patch are getting stripped out.
So try patching the file with the --ignore-whitespace switch and see if that helps.
Comment #5
nazadus commentedI couldn't find a --ignore-whitepsace option.
I also tried doing a 'man patch | grep "white"'
and got nothing.
however,
merely opening the file and saving it in nano, and then attempting to patch did correct the issue.
Thanks!
Comment #6
Steve Dondley commentedWhat platform are you on, by the way? I'm just curious. Seems like you are using a version of patch that I don't have. I'm using Debian Linux.
Comment #7
nazadus commentedI'm running Gentoo.
2004.1 install.
I updated the world about a month ago.
I could get more detailed, if you'd like.
Comment #8
nazadus commented(forgot to add on last post)
Curious, which vesion of patch are you running?
I'm running 2.5.9.
Comment #9
Steve Dondley commentedWeird, I've got an older version: 2.5.4. I wonder how I could have different features in my version of patch than you.
I also discovered the CR charachter was getting injected by my Windows program that transfers the file from my Linux box to my Windows box (my Linux box does not have XWindows or a browser with which to uplad the file directly to Drupal). I didn't even realize this happened when you transfer files in ASCII mode. I guess I need to do file transfers in binary? Seems counterintuitive.
Anyway, thanks for letting me know about your patch problem so now I can correct for this.
Comment #10
Steve Dondley commentedI looked at my patch manual page and the word "whitespace" is definitely in there. When I do a grep like you, it doesn't show up. In fact, I discovered any search for text on a line that begins with "--" fails. Just plain weird.
Comment #11
nazadus commentedHow very intersting.
How do you x-fer files over?
I use mpad (Imagine Windows Notepad on steroids. Very lean, but very powerful) or Crimson Editor (Like WorkPad on Steroids. Not as lean as mpad, but has many more features... but signifignatly learner than FrontPage and Word) to do my coding on a Windows box.. Both of which handle Unix/Windows stuff nicely.
Then I use WinSCP to x-fer to over via SSH to the box...
I'm sure Debian has a package for a ssh daemon (or I could help you get one going if needed).
Feel free to contact me through the drupal system.
Comment #12
nazadus commented*feels stupid.*
You already answered how you transfer files over.
Although I don't entirely understand it, I get enough of it to get by.
:)
Comment #13
nazadus commentedFound it.
About 3/4 down on the second page.
I must have missed it.
Still though, very strange how a grep doesn't find it. I must pursue this further or else I lose faith in my valued grep.
=)
Comment #14
Steve Dondley commentedFor smaller changes I do my editing directly on the Linux box with VIM. For larger changes, I use UltraEdit (a proprietary text editing program) on my Windows machine over ssh.
I also use WinSCP to transfer files from my local Linux box to Windows (been too lazy to reinstall samba). That's the program that has been doing the line termination conversion. UltraEdit does the same thing. When I edit a file on the Linux box over SSH, it also does the automatic line conversion.
Weird about grep. Let me know if you find out why it didn't work.
Anyway, we're badly off topic. I tried to e-mail you through Drupal but you have not activated your e-mail to do that.
Comment #15
(not verified) commentedall hunks fail when patching the latest taxonomy.module from cvs.
can you just attach the patched version of taxonomy.module instead?
Comment #16
(not verified) commentedThe patched module is attached.
Comment #17
sami_k commentedNice work! This does work much better than the original. The top module was posted by me and I am using this right now and can confirm it does work. The only thing which would be cool is if a certain forum was completely hidden from view if a certain group of users did not have the right to see it.
Comment #18
Steve Dondley commentedIt should be hidden if you install the taxonomy.module patch, I believe but I'm not even entirely sure. Do you have that patch installed?
Comment #19
Blender commentedHi, excuse me if i've posted in the wrong place but i'm very new to drupal.org.
My problem is about the 4.5.0 module and it's patch,
I have the same problem that nysus had with patch, when i try patching file i get following error:
where -l is an alias for --ignore-whitespace
patch version is: 2.5.9
Linux box runs debian
I tryed working with plane taxonomy_access.module for drupal 4.5-0 & the patched taxonomy_access_1.module for cvs that nysus linked, but neither (as obvious i think) are working on my website http://teamlove.matrixclan.it as you can see with your own eyes: If you take a look to Forum section there you can see a Private Board that shouldn't be acessible to anonymous users as the name suggests.
Could anyone link me the patched 4.5.0 module to download or tell me what i'm doing wrong with the patch command.
Thanks
Comment #20
sami_k commentedtaxonomy.patch is not for taxonomy_access.module, it's for taxonomy.module found in your modules directory. the patch you're suppose to apply to taxonomy_access.module is found above or alternatively download the file that i send and rename it to taxonomy_access.module, over-writing the original. i hope that helps. anyhow yea i have the latest patch in the cvs applied to my taxonomy.module and a forum that is not suppose to be visible shows for certain users with no posts. i don't have privacy byrole installed, maybe i should?
Comment #21
pyromanfo commentedOkay, applied to the CVS version fine and I commited your changes. Thanks for all the hard work nysus, you improved this module alot.
Comment #22
Steve Dondley commentedsami,
If I understand you correctly, I think I know the problem. It's one I overlooked when making this patch. In line 332, try changing
$sql .= ") and (tid='$tid' OR tid=0) and grant_". $op . "=1";to
$sql .= ") and (tid='$tid') and grant_". $op . "=1";I need to issue a revised patch.
Please let me know how it works . Thanks.
Comment #23
Steve Dondley commentedThanks, pyro. I'm glad to contribute. Thanks for your work, too.
Oh, and please see my last comment above. I think there needs to be a minor change. I haven't tested it thoroughly, but when I made the change, everything seemed to work again. It's the same problem mentioned at http://drupal.org/node/12892, comment #15.
Comment #24
Steve Dondley commentedOops, typo. I meant to say comment #14.
Comment #25
Steve Dondley commentedaccidentally got changed in a previous post. reverting back to "fixed"
Comment #26
sami_k commentedWell I did try changing that line, it didn't fix the problem. Thanks for trying though. Man this is some really powerful and badly needed functionality for Drupal. Keep up the good work!
Comment #27
Steve Dondley commentedsami,
As an experiment, I installed my new module on top of the older version without cleaning out the old node_access mysql table. It caused problems. Have you done the same?
If you've got access to mysql, take a peek at your node_access table. What do you see in the 'realm' column? Do you still see 'taxonomy' in there?
If everything is good there, we'll have to dig a little deeper. And can you clarify what you are seeing? I don't quite follow when you say: "a forum that is not suppose to be visible shows for certain users with no posts." You mean the forum has no posts?
Comment #28
sami_k commentedwell i did go and empty the table and the schema now looks like this:
tid
rid
grant_view
grant_update
grant_delete
what i am seeing is basically empty forums when a person doesn't have permission to see them. the specific forum that person doesn't have the right to see has 0 posts, while others which the person is allowed to see have posts.
Comment #29
Steve Dondley commentedSo you are saying that instead of empty forums, you want to see the "Access denied" message?
The taxonomy.patch should take care of that for you. It's been working for me. Other than the change to the line I mentioned above, I don't know. I haven't really even looked at that patch. Maybe pyromanfo could help troubleshoot this.
Comment #30
sami_k commentedwell in one version of this module it actually hid those forums which the user didn't have right to see and showed only those that they had permission to see. as it is now, it is perfectly acceptable if it's how it's suppose to be behaving, but sometimes you don't want other useres to know that certain forums even exist. thanks for all the support though!
regards,
sami
Comment #31
Steve Dondley commentedNot so. The protected forum topics are hidden on my site. No one can see the unless they have access. You may want to update your forum.module. I think this bug was corrected and that may be your problem.
Comment #32
Steve Dondley commentedOops, I misread your post. I thought you wrote "not one version of this module".
At any rate, my forum topics are hidden. So there is definitely something amiss.
Comment #33
sami_k commentedare you using drupal 4.5 or drupal cvs?
Comment #34
Steve Dondley commented4.5...for the most part. There were a couple of modules I upgraded. But taxonomy.module wasn't one of them. I did upgrade the forum.module at one point.
Comment #35
Steve Dondley commentedSami,
When I get some time this weekend, I will install a fresh version of 4.5.1 and see if I have any problems with taxonomy_access.module/taxonomy.patch on my test site. I'll let you know if I see similar problems.
Comment #36
nazadus commentedNysus, I too am seeing this.
I have two installations. Both of which are from complete scratch of 4.5.0.
You can verify this by going to:
Etherpunk.com
And looking at my taxonomoy_tree.
Goto Personal, then Gogo Dark Labyrinth.
I have told taxonomoy_access that no one should have access to Dark Labyrinth except group X.
As you can see, you see nothing in there however I can assure you that there are some.
Very strange.
I've duplciated this issue by doing another Drupal install (another knowledge base for work purposes at here)
Thoughts?
Comment #37
Steve Dondley commentedSorry, I can't do anything until I duplicate the problem on my site. Then I'll be able to troubleshoot.
Comment #38
pyromanfo commentedMake sure users don't have view permissions for the forums. When the user doesn't have view permissions, they're hidden on my site as well. The taxonomy.patch in CVS is against taxonomy.module version 4.5.0.
Comment #39
(not verified) commented