Thanks for the great work with this module. This almost works for me but I have a situation where some of my products can have many nodes (100+). Instead of manually plugging in each node one by one in the product features, is there a way to choose a bunch at the same time? If not, would it be possible to have this permission granted on a taxonomy term or a view or similar?

Comments

RikiB’s picture

Another idea I was just thinking. Could I have some php code inside the node and use it as some sort of filter with views? Just an idea. :)

jeremy.zerr’s picture

You talk about wanting to break the nodes up by taxonomy term, I think you can do that, but using another method that isn't uc_node_access.

Have you looked at using Taxonomy Access to restrict a taxonomy term by role, then have your purchase grant a role instead of individual node access? Then you can use uc_role instead of uc_node_access as a product feature to give the customer a role, that then would open up one or more taxonomy terms for their access.

This method would break down if you need to offer many different products to grant access to many taxonomy terms, because you would have to make a role for each one of the groups, which wouldn't be ideal, but it would work. But without knowing more about your situation, maybe something like this would work.

Good luck,
Jeremy Zerr
http://www.zerrtech.com

RikiB’s picture

Thanks for the reply! You are correct when you say there are many different products.

Taxonomy Access wouldn't work with roles because I would have to have 20+ roles and in the future that number could grow to 100s.

So it sounds like I need to find someone to implement the Taxonomy Access Module. Or perhaps this one would be better?

http://drupal.org/project/tac_lite

If I could get someone to use this access control instead of ACL+Content Access it would work perfectly. Are my assumptions correct? If so, would this be hard to do?

jeremy.zerr’s picture

If creating the roles would be too much, then something like tac_lite would be better to integrate with uc_node_access because of the ability to control per user access to terms. But on a side note, tac_lite doesn't seem like an actively developed module. Feel free to take a shot at it, I think it would be a good addition.

An alternative way to implement this would be to select taxonomy term(s) when configuring the product feature and ACL+Content Access would be used to grant the user access to each of the nodes matching that term(s). So the uc_node_access feature would just allow a way to select individual nodes in bulk using taxonomy terms.

Benefits would be no dependence on another access control module and it would be quite a bit easier to code up than integrating something like tac_lite.

Downsides would be that no future nodes tagged with that term would be granted access to prior purchasers and if you needed to take access away from a user, you would have to individually go remove them from the access control on all the nodes. This really doesn't sound like a good option to me, but depending on your coding experience, it could be created relatively easy and maybe the downsides wouldn't apply to you very often. Like maybe in your situation, you aren't adding any nodes to terms after you put the product up for sale, or you are OK if customers that bought the product in the past don't get new content. Also, if customers are always purchasing permanent access, then neither downside would apply.

RikiB’s picture

Very interested suggestion. Thanks for your time and insight. I personally wouldn't be able to code it but my good friend Liam was going to quote it out for me.

My last question is if I went ahead and used roles right now, would there be any danger in that? I would have around 20 roles and it could expand to 30 or so in the next year. 30 roles isnt crazy is it? Im just considering my options and roles would really work perfectly out of the box for me right now.

liam mcdermott’s picture

Title: Handling Many Nodes » Handling Many Nodes (grant access by Taxonomy)
Component: Documentation » Code
Category: support » feature
Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new19.63 KB

Firstly, I know this is Ubercart Node Access, but it would be really useful to be able to grant individual users access to taxonomy terms, also core's access control is by node but is flexible enough that modules like TAC Lite and Forum Access can work by taxonomy.

With this in mind, here's a patch that provides a backend for TAC Lite. Unfortunately I had to hack uc_node_access itself a bit to get it to do what I needed; for one thing uc_node_access is given the product node as the access node, which means the conditional actions code is pretty-much useless.

The point of this patch, therefore, is to:

  1. highlight ways uc_node_access is inflexible;
  2. highlight ways it could be improved for the next version (for Drupal 7, I expect);

We could just fork this module to make uc_tac_access but I'd rather not, since there would be a lot of duplicated work between the two.

RikiB’s picture

Status: Needs review » Reviewed & tested by the community

This works amazingly well and I am very happy to have supported this development. With the power of granting access to taxonomy, it really opens the doors with purchasing access to large amounts of content.

I am marking this as reviewed by the community, because it works perfectly, but I would like others to test it out too.

jeremy.zerr’s picture

I just tested the patch from #6, it does work great. Thanks for that contribution.

I really wonder if people would like to potentially use both methods, ACL+Content Access for single node and TAC Lite for taxonomy terms, on the same site. Right now, you have to choose one or the other.

A better architecture for uc_node_access could allow the type of access control to be chosen in the Product Feature configuration, or have the module create a different product feature per access type.

I guess at the very least, you can use a taxonomy term that only contains a single node to do by-node access like ACL+Content Access, but then again, that could get ugly if you have a lot of single nodes you want to offer.

Either way, I think this patch to allow taxonomy-based node access is a great improvement to the module.

Jeremy Zerr
http://www.zerrtech.com

webservant316’s picture

subscribe