tac_lite port to Drupal 6
Jonathan.Cochran - February 21, 2008 - 00:12
| Project: | Taxonomy Access Control Lite |
| Version: | HEAD |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Any plans to port this for Drupal 6? If so, let me know and I can help test :)

#1
It will definitely happen. If anyone wants to take this on, please do and submit a patch.
If not, I'll get around to it eventually, but certainly not in the next two or three weeks.
#2
I have updated this module (mainly due to the evolution of the 'form' api). Since I've discovered drupal recently, there are maybe some errors (in particular I have not changed the install file). But it works on my drupal installation.
#3
I get this:
"Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of system_settings_form_submit(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /srv/www/htdocs/drupal6/sites/all/modules/tac_lite/tac_lite.module on line 117"
at the top of every single page on my test site.
In addition, "rebuild permission" doesn't work:
"An error has occurred.
Please continue to the error page
An error occurred. /drupal6/batch?id=11&op=do (no information available)."
#4
I have changed something in the "_tac_lite_admin_settings_submit" function, should work now...
You will have to desactivate the module and reactivate in order to make it work (at least on my installation I have to do so!).
For the rebuild permission error, I don't know because this function is not part of the tac_lite module (function node_access_rebuild()).
#5
I'm eager to take a look at this, but the next few days I'm very busy, so it will be the weekend before I install the patch. Just keeping you informed. And thanks so much for submitting it.
In the future please submit a proper patch rather than the entire module.
#6
paulo_drop: Thank you for posting this!
However, I'm attempting to set up Role Based Privileges with this patch and it's not quite performing the way I expected it to.
The idea is to have separate roles be able to access separate private taxonomy terms. I have a taxonomy called "Privacy" which has two terms called "Private_A" and "Private_B." But when I assign specific roles access to specific terms under "Administer › User management › Access control by taxonomy › Role Based Privileges," it seems like when a role is assigned any of the "Privacy" terms, they have access to all "Privacy" terms.
Is this the way tac_lite is supposed to function? Or am I missing something??
Thanks!
#7
You want to set up different taxonomies for different roles.
#8
Iam should be able to allow different terms to different roles. There is no need to create more than one vocabulary.
Drupal's access rules are touchy. If your content type implements hook_access, and hook_access returns TRUE, then the node_access table will not be consulted. Either that, or there's a bug.
Its a good idea to install the devel_node_access module, which comes with devel. Enable the block it provides, then view one of the nodes in question. That will show you the node_access table entries for that particular node.
#9
It's taken me a lot longer than expected to get to anything Drupal 6 related. Sorry for the slow progress on this.
I want to get patch http://drupal.org/node/248938 into Drupal 5 before creating a drupal 6 branch. If anyone can test that, it would be much appreciated.
Also Paulo, can you put together a proper patch of your changes? http://drupal.org/patch/create
#10
That's the first time I create a patch, so I hope It will work. Tell me if there is any problem with this patch.
#11
Just for what it's worth, I tried this version on a Drupal (6.2) site I'm working on, and it seems to work fine so far. Thanks!
The only odd thing I saw was that when I went to Administer-Modules, TAC_Lite showed up on the core list instead of on the contributed list. I installed it into sites/all/modules, correctly I believe, but this could well be my problem and I will investigate further.
Thanks again.
#12
The place Tac_Lite shows up in the modules section doesn't depend on the path you stored it. It depends on the "tac_lite.info" file. Indeed it's not a core module, I have corrected it with this new patch...
#13
Thanks very much, Paulo!
#14
Works great. One Bug I could find. Regular users have a "tac_lite access" button in their My Account under "Edit". This is dangerous as a user should not be able to put themselves into a group. However, when you click on this link it goes to "Page not found", which is safer then the alternative. When you are logged in as an admin you can click on this button for a user and edit their memberships.
Thanks,
Adam
#15
Hi,
Why not deliver a 6...dev version in order for many of us to test ?
Thank you.
#16
Could this at least be available in HEAD? The version currently in HEAD does not describe what version of Drupal it's compatible with.
#17
The very latest code is in the DRUPAL-5 branch. I'll do my best to update things later today.
#18
After applying the other patch I mentioned earlier, this patch no longer applies. I don't have time to do any more tonight. If someone can re-roll the patch against HEAD that would be great. If not I'll try to get to it soon.
Be sure to run update.php after getting the latest tac_lite.
#19
Also I'll try to fix the permission problem in #14 before checking in.
#20
Thanks for your work on this Dave, look forward to giving it a test run at some stage.
#21
Yes, big thanks here also... Excited to try it out!
#22
Hi,
i have fixed the local task menu bug.
Original code in tac_lite.module:
<?php
/**
* Implementation of hook_user().
*/
function tac_lite_user($op, $edit, $account, $category = null) {
//drupal_set_message("tac_lite_user($op) called."); // debug
// only for administrators
global $user;
if (!user_access('administer_tac_lite'))
return;
switch ($op) {
case 'categories':
return array(array('name' => 'tac_lite',
'title' => 'tac_lite access',
),
);
break;
...
?>
Fixed code with correct 'access arguments' (see the two lines with the //***FIX*** comment):
<?php
/**
* Implementation of hook_user().
*/
function tac_lite_user($op, $edit, $account, $category = null) {
//drupal_set_message("tac_lite_user($op) called."); // debug
// only for administrators
global $user;
if (!user_access('administer_tac_lite'))
return;
switch ($op) {
case 'categories':
return array(array('name' => 'tac_lite',
'title' => 'tac_lite access',
'access callback' => 'user_access', //***FIX***
'access arguments' => array('administer_tac_lite'), //***FIX***
),
);
break;
...
?>
Furthermore I suggest to include a 'weight' => 10 (some value > 1) field as well for not having the 'tac_lite access' tab (if it shows up) on the leftmost position in the local task bar (but this is a matter of taste).
#23
Here, for the record, is the patch I am checking into HEAD. I haven't really tested it. That's why I'm leaving the issue open. If anyone can run it through it's paces, I'd be most grateful. No need to apply the patch, just use the latest from the HEAD branch, this is checked in.
From now on, in this thread, submit patches as a diff against HEAD.
Big thanks again to paulo_drop and everyone who's contributed.
#24
Hi, I've just tried the HEAD version, and it seems to work very well, except for one bug:
If I give a user the right to administer tac_lite, acces to the tac_lite menu is still forbidden for this user.
However, thank you for the good work!
#25
Hi. I'm relatively new to the project pages; where do I download the HEAD version for testing? Thanks
#26
Dave have you forgot to include a HEAD version? The one on the project release page dates back to 2007:
Last updated: January 11, 2007 - 08:13
Please create a new release, and I look forward to testing this. Setting to CNW!
#27
drupal.org will not build a head version for you, as far as I know. You have to check it out of CVS.
When I find time to fix the menu issue in #24 I'll create a DRUPAL-6 branch. But in the meantime any additional testing would be appreciated.
#28
I'm really interested in this module but when I download the file above it says that its "Unable to extract the files and directories from the archive"
I'm using Net2FTP to upload it.
Any ideas why its not working? Or even better does somebody have another file that may work better?
Thanks!
#29
I got this module to open and it works wonderfully.
I have not ran into any problems.
Thanks!
#30
I found a little bug, I think: If you delete a node, the corresponding entry in "node_access" table won't be deleted. This is not critical, but nevertheless, it's quite useful to keep the table "smaller", more efficient & more actual. Adding this feature is quite easy: Just add a "hook_nodeapi" which reacts on deletion. Perhaps someone else could write this patch or I will write it in a few days, I think =)
#31
That patch should not be necessary. The node module (core) should be doing that for us. Access control modules are no longer supposed to touch the node_access table directly. If this is happening, its a core bug.
#32
Thanks for doing a great job on this module! I'm not familiar with diffs and such - are there any plans for the release date of a complete module for 6.x? :)
#33
@pendlaren: The version in CVS works very well. The only issue is you can't make/change settings unless you're logged in as user id 1.
Apart from that, it seems fairly flawless, at least to myself.
I finally took the 6.x plunge and everything tac_lite is working as expected.
Cheers,
Tim
#34
Hi there.
I'd be happy to test this code on D6, too. It would be awesome if someone knowledgeble could create a real 6.x-dev release. I've seen a few comments down this line from others asking for a test release, too.
I installed HEAD from CVS. When I enabled the module an error occured:
Fatal error: Call to undefined function db_num_rows() in /home/www/drupal/sites/all/modules/community_tags/community_tags.module on line 48Line 48 is in menu_hook tac_lite_menu():
$items['admin/user/access/tac_lite'] =Clearing cache doesn't change anything (in fact this throws the same fatal arrow).
Cheers.
#35
tac_lite is not the reason for this error, have a closer look at the error message:
Fatal error: Call to undefined function db_num_rows() in /home/www/drupal/sites/all/modules/community_tags/community_tags.module on line 48So, the module "community_tags" is the one, perhaps it could be a conflict, but this is another thing.
#36
Thanks for replying and sorry for messing that up.
I was diging on three modules at once which you shouldn't do ;) Anyway, now that you pointed it out I'm not sure anymore if I just copied the wrong error message or if indead there was no error at all with tac_lite... I'll come back if I get an error again.
Cheers.
#37
I was able to put a build on the project page, but I don't know how to mark it as a development release, which is what it is.
I'll make an official Drupal 6 branch once we solve the permissions problems that are mentioned above.
#38
Version currently is 6.x-0.0 and described as dev version. Shouldn't it be 6.x-dev instead then?
Cheers.
#39
Exactly. I just don't have time to guess different CVS tags until I get it right. If anyone can tell me how to make it say that, I'll update it.
#40
You have to create a new branch for this:
cvs tag -b DRUPAL-6--1Then, a dev version will be shown in configuration.
#41
Fixed (I think) the permission problem with the admin pages.
Created DRUPAL-6--1 branch and DRUPAL-6--1-2 release.
Thanks to everyone who helped!
#42
Thanks so much Dave!
Sadly, the permissions problem doesn't seem to be fixed. (I'm using 6.x-1.2)
Logged in as God (User ID 1) I can edit the permissions/tac_lite options, but logged in as my normal power user (who has "administer_tac_lite" ticked) I'm still unable to and get a permission denied error.
I don't know enough about drupal to debug it I'm sorry.
Tim
#43
What is the URL where you get permission denied?
Also, please try to empty cache (using the devel module) and see if it still is the case.
#44
I'm really sorry, Dave, this does appear to be working correctly.
When I tried it this morning, it wasn't.
I can't figure out how to get Devel to display the block it used to have in 5.x, so I'm not sure how to clear the cache.
Regardless, it appears fixed. So I'm stupid.
Thanks!
#45
on a side note devel 6 comes with a "development" menu block you have to enable/show in admin/build/block (and maybe enable the menu in admin/build/menu, not sure)
Update: Also using devel.module and it's user switch block switching to user/1 to change tac_lite settings is fairly easy.
#46
Devel includes the lesser-known devel_node_access module which has a block useful for debugging node_access modules. Enable that block in your footer because it is wide.
#47
Automatically closed -- issue fixed for two weeks with no activity.