There's a new tutorial at http://drupal.org/node/200631 which is a different approach to Taxonomy Access Control than I have seen, a very different approach to Groups (as a concept), and multiple Domains (hence a multisite solution). I am trying to discern what is going on with og, mulltisite, domain access, and TAC generally.
This tutorial suggests similar functionality to the combination of Domain Access module with Organic Groups, but without either and promises to offer more fine grained control over permissions, although the OG_User_Roles module is perhaps offering similar functionality. It would be interesting to link that concept of a group (i.e. AccountTypes module?) to an OG. How does this approach sit with the OG User Roles people? Does it offer any unique functionality?
The tutorial looks really interesting, although I'm sure that building UI modules will be needed (and perhaps other OG like modules as well). My question for those who know the OG_User_Roles module, what are the advantages to sticking with OG as opposed to a completely new concept of groups? And regarding the Taxonomy Access Control module, what is the maximum number of suggested roles which Drupal is optimized for?
It's an interesting approach to skinning the multisite problem. What do you think?
Seasons Greetings!
ps. sorry for cross-posting similar questions with taxonomy and multisite groups.
Comments
Interesting
We need more posts like that. I am very interested to see the "multisite" functionality tutorial.
From the Domain Access p.o.v., one thing to remember is extensible architecture. Take a look at the new rc1 for Domain Access and the "Domain Strict" module -- which implements much of what the tutorial asks for. Domain Strict alters the behavior of the core module by using a 10-line API implementation. DA, as a whole, is designed to be modular and extensible in the Drupal way.
The bigger question, which came up as someone was trying (!) to use DA, TAC, and OG User Roles on the same site, is that these modules take slightly different approaches to the question: How do we make multiple node access modules work together.
Obviously, I think the mutliple node access patch is the path to take here, but that patch seems to be incompatible with OGUR.
The problem that we run into as developers is trying to make a system that is flexible enough to implement the business logic described in this tutorial. But we can't develop something that forces specific business logic on people.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Second tutorial now ready
Many thanks for your helpful comments. We have finished the second tutorial, at http://drupal.org/node/201673. In fact this second tutorial just addresses a multisite solution, without any taxonomy access control, but we envisage it as working together with TAC to provide the node access permission system. Your comments on the joint solution would be very valuable to us, as you have gone so deeply into different ways of meeting multisite/group requirements.
Domain Access
Domain Access provides this functionality in, I think, a much cleaner way.
And I find it borderline offensive that you have ripped the first 3 paragraphs of the module description.
http://drupal.org/project/domain
That aside, I don't like using (abusing) taxonomy in this way, which is one of the reasons DA exists.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Why the taxonomy is an abuse ?
Dear agentrickard,
As the author of these tutorials I am very sorry that you felt some wording was ripped from your Domain Access description. This was not at all the intention or even a conscious action. We greatly admire your work on DA, and your opinion on the issues is extremely important.
You write here about ‘abusing’ taxonomy, which is a strong statement. Would you be kind enough to explain why you feel that it is not legitimate to use taxonomy in the context of multisite functionality and node access control?
Thanks
I was just a little upset (call it pride) that you seemed to be suggesting that you could duplicate what DA does natively, but were recommending a different approach. So it seemed like you were not aware of the design purpose of DA. And to see the description used in that way was rather jarring.
Personally -- and this is a personal view -- I don't like modules that use Taxonomy for purposes other than tagging content as a navigation aid. I don't think that requiring the creation of new Vocabularies in order to segregate content across sites is a very effective solution.
I think -- and reasonable people may agree to disagree -- that it is a solution that leverages the taxonomy system in a way it was never designed to be used. See http://groups.drupal.org/node/7725#comment-23408 for example.
For us, we typically use taxonomy as free-tagging, so the idea of using that to segregate content just doesn't make sense.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Re: doesn't make sense
I use taxonomy to segregate content daily and without any special module. You do too from what you describe. A module using a vocabulary is very natural when it comes to classifying its content. The module can insert terms into its vocabulary for its content type.
vocabulary and module
I think you are right about using module-specific vocabularies, which is a feature I just discovered and have not tried.
This is also, in some respects, a matter of personal preference. Part of the DA use-case came from not wanting content editors to have to remember vocabulary tagging rules in order to classify content.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Learning Drupal's vision for these (core) functions
Season's Greetings,
My geek-gene gets a real kick from the idea of '(abusing) taxonomy'.
I am getting my feet wet and asking honest questions here. I'm trying to handle 100 groups, each having 5 or so group roles, spread across about 30 domains.
Why has the Drupal community created Organic Groups as they are? Why this way as opposed to another? I'm sure there are extremely valid reasons. Perhaps the answer helps to understand TAC's use (or abuse) in this tutorial. Perhaps not.
I imagine Drupal as a best-practices learning process. So what am I missing?
As a database person, I would query the idea that a 'role' be named a 'group' (the group entity existing as a role or set of roles). Is that 'normalized' for example? Should a separate key field exist to properly articulate the one-to-many relationship that is called for between groups and group roles, or do roles suffice (as in this tutorial's case)?
Before entering into domain/multisite issues, I can see that either approach offers this as a starting point. However, what makes sense for these two approaches -- roles alone (grouped by naming convention), or roles grouped by another element (i.e. OG/OG_User_Roles)? How are they optimized differently and why? Which approach encourages the right functionality to be developed for open and sustainable social networking, for example? Which will require the most developer time to bring to full groups functionality? Either way, my groups will need multiple roles, and I need a way to list my groups. Can one really escape using OG for grouping users?
If this tutorial is inconsistent with the long-term vision emerging in Drupal (for TAC, groups and multisite), then please say more. What if OG and Domain Access resolve issues with OG_User_Roles and everything moves in that direction -- which seems a strong possibility -- would the above tutorial still be necessary?
Grateful for this!
Long-term
If this tutorial is inconsistent with the long-term vision emerging in Drupal (for TAC, groups and multisite), then please say more.I do not think the tutorial is inconsistent, since there is no agreed upon long-term goal. It is a "here's how to do it now" document. However, I do think (somewhat pridefully) that Domain Access solves this problem in a much easier way. Otherwise, I would have done something similar to what the tutorial suggests.
Long-term, I think we need to get some smart people together and solve this problem in a manner similar to FeedAPI.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Scalablity-Maintenance
HowTo: Groups as Roles tutorial
http://drupal.org/node/200631
I am concerned with the ability to scale this to organizations that have a large number of groups or where groups are self-assembled. I share all the same requirements as you but having to create a Category+Role for each new group seems like a maintenance nightmare. My organization has over 200 groups, with your schema I will have over 200 terms that must be coordinated with 200 roles "by hand". No thanks!
Regards,
Michael Hofmockel
Open Source || Open Access || Open Mind
Yes! Not by hand
I agree, that would be a horrible job. We had assumed, but realise we did not say, that we would have to write a module which would automate the process of creating new groups, so that this would not have to be done by hand.
Lots to say
Lots to say, little time. Thanks for the nice tutorials. I read them but did not test.
You are not the first to suggest that groups should be taxonomy powered. Two smart cookies, Earl Miles and Mark Frederickson have suggested a similar path. See A, B, C. We had more discussion via private email.
It is important to recognize that there is no right answer here. These subtle questions can only be answered by actually building and using both solutions on production sites and evaluating which one makes you contort less.
Here's my breakdown:
Benefits of taxonomy powered groups
These are all significant benefits. 2. is doable in og but the lack of node relationships in core makes it harder. Still, I would like this in the next version.
Benefits to og powered groups
The essential discussion point here is the merit of group as node. I submit that this benefit is enormous. First, we have an easy way for end users to create nodes, according to their permission. We have no such tool for terms. Second, og supports naming multiple content types as 'group' types. This enables you to have different cck fields for different properties of a group. Some group types are casual yahoo groups type groups while another might be a group around a proposed law to congress. The proposed law group will collect and display different metadata. Third, nodes can easily trigger actions.module actions when they are submitted such as email notification and such. Nodes can be put into a moderation queue, and put into a book. Fourth, nodes are easily listed in every imaginable slice and dice with Views module. Since Views2 will support listing of non nodes, this benefit may diminish over time.
The tutorial proposes groups as terms and I disagree with that. The full force of Drupal development is behind nodes. See above. It is foolish to ignore that. The taxonomy module has not substantially changed since 2002 when it was born. It was born a masterpiece for sure, but still its lack of growth is telling. Consider how advanced we are at rendering nodes these days. We have this killer drupal_render() system which learned about node styles in D6. We have no equivalent for terms. Sure it can built, but then you are swimming up river, instead of floating along with it.
Roles versus custom subscriber lists
The tutorial proposes to use roles to collect users and affiliate with a group. Thats fine, but core really hurts us here. We have no strong API for creating roles, or adding/removing users from roles. Lastly, we need a way to remove roles from the UI. If we had all this, roles might be the preferred choice. Note that og does more than affiliate users to groups. We store if a user is an admin in the group and if he wants to receive notifications for the group and so on. So I don't think pure roles will do for storing user+group info. Bottom line - someone go improve the role API!
Question
In the multi-site, what is doing the content restriction so that content from marketing does not show up in finance.local (for example). I did not catch this.
Restricting content
Moshe, thanks so much for these seriously helpful comments. On your last question: content restriction would be done by the Taxonomy Access Control module which offers the kind of fine-grained control we need. So, for example, we might have a vocabulary 'Domains', and another vocabulary 'Access' (determining how to restrict access to the required role/s - we need two sitewide user roles, basic user and full user - and/or to a group), and then a third vocabulary 'Groups'. A test configuration worked rather well.
HOWEVER, your post and that of others makes us feel that it would be a mistake to go down this route. We are back looking at a DA/OG combination, possible with TAC thrown in to give a little extra control.
I'm Telling you the answer: Get TAC and OG working together!
It's funny. I started the Access Control group nearly a year ago to plead for help in my quest to do two things:
Now, all these months later, I see this very good discussion on a subject which leads me back to my original suggestions.
In the real world of communities and organizations, I've found that we mostly always have these things:
Groups
Roles for Users within these Groups
Access to content based upon user role in group
For this, we already have in Drupal:
OG (Groups)
User Roles + OG User Roles (Roles for Users within these Groups)
Taxonomy (Access to content based upon user role)
You can see the only problem now is, because OG and Taxonomy don't work together, we can't use Taxonomy to provide access to content based upon the user role in the group.
Everyone seems to agree that TAC is a wonderful tool for fine-tuning permissions. I feel that Organic Groups is a great tool for organizing group content. Imagine how much more fine-tuned our content would be if node permisisons consisted of the combination of taxonomy and group restrictions; that is, you can only see content if you BOTH belong to the group AND have the correct taxonomy as opposed to you can see the content if you EITHER belong to the group OR have the correct taxonomy.
Add to this the ability to further restrict access by user roles that could change depending upon the group content, and I think you've got the thing everyone wants here.
I don't know who else uses my TAC/OG kludge, but it provides the enterprise-level access and security my client was looking for. It could do this for all Drupal users, if we could get rid of the kludge and make TAC/OG integration a permanent feature.
I'm certain that if the TAC and OG maintainers got together on this, it could happen without requiring major internal changes to Drupal.
My two cents on the matter.
I second this motion!
Let's get the modules we have now to work together rather than creating a new module amongst the 2000 we already have.
Get TAC and OG working together!
An ACL arbitrator sounds like a good long term solution. Then we can have any ACL module work with any other ACL module.
But in the short term we can get TAC and OG aware of each other.
Regards,
Michael Hofmockel
Open Source || Open Access || Open Mind
ACL
There is an ACL module, in fact. http://drupal.org/project/acl
But I'm not sure it totally solves the problem. When working on DA, I decided against it simply because I did not want the dependency.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
I'm Telling you that you are full of hot air!
not so.
TAC and OG can coexist already just like any two node access modules. the problems come when you have a business requirement which core node access does not currently support. That is, when you require that users have all possible grants in order to view a piece of content. Core node access was designed around assumption that having one grant is sufficient authorization.
If folks want this improved, I suggested reviewing Ken's patch.
Maybe. Then, maybe not.
I submit, with all the hot air I can muster, that having taxonomy respected by OG and vice-versa is not a specialised business requirement, but simple fundamental logic that should be supported.
Just as it doesn't make sense to duplicate user roles every time you create a new group, to me it doesn't make sense to duplicate taxonomy every time you create a new group in order for OG and Taxonomy to work together logically. They should all work together, not simply "co-exist", but work in concert with each other, respecting each others permission grants.
Accomplish this by Ken's patch, or by hook_nodeapi, or who knows what. But it should be the goal, in my humble opinion.
I cannot tell by Ken's patch if it's logic supports the concept of TAC and OG working together as many of us would like. If it does, I'm all for it. If it doesn't, then I'm for the solutions Ken sought to avoid:
http://drupal.org/node/122173
http://drupal.org/node/143075
Or, any solution that works.
And, in this particular case, core node access design could be wrong.
Core design
Core design is limited, and needs to be rethought. The basis of the patch is this:
Current logic is OR based grant. So:
IF OG or TAC or DA grant access, you get access.The patch allows (but does not require) the behavior:
IF OG or TAC and DA grant access, you get access.Or any permutation in between.
It does this by adding an optional 'group' element to the $grants array. Each $grant not defined in a group is included in an OR statement. Every group is appended as an AND, with a subquery.
[I should note that core does not do this largely because subqueries are the only way to achieve this, and subqueries are not supported in MySQL 4.0. Fortunately, D6 requires 4.1 or higher.]
The second big problem in node access is the lack of hooks that let modules change access grants. One very easy way to make modules meet special use-cases is the ability to pass grants by reference, so that other modules can modify them.
Take a look at how hook_domaingrants() works within domain_node_grants() and the implementation in the Domain Strict submodule. This module has 10 lines of code and fundamentally alters the core behavior of the module.
We need to do as you suggest and start plotting how node access should work in D7.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
What can we do today?
In my mind, what we need is this:
If OG and TAC and DA grant access, you get access.Great minds have been debating Drupal node access for some time, and it looks like they will continue debating it. So, in the interim, what do you think we could do now which would get us where we want to be?
I used hook_nodeapi($op='access') to accomplish my TAC/OG Integration. The basic, fundamental code:
<?phpif ($og_access === TRUE && ($tac_access == TRUE || $ca_access == TRUE)) {
$access = TRUE;
}
?>
It works like a charm, except that I'm stuck with this massive db_rewrite_sql() overhead. If I could accomplish the same thing with node grants (which I found to be impossible with the current core design), that would obviously be the better way to go (no arguments about that here) and the db_rewrite_sql headache goes away.
So, can this be accompished with your code logic? If so, do you have any recommendations on how we could make this work with OG, TAC, CA (Content Access - why not?) and DA -- TODAY?
Ken's Patch Now Implemented in OGR - Good Hot Air
Thanks for the suggestion. I looked at Ken's patch http://drupal.org/node/196922 and found it to be a more elegant solution to the problem of making multiple access control systems (like TAC and OG) work together.
As I am a big proponent of figuring out how to solve today's problem today, I am utilizing a version of this patch for OGR TAC/OG Integration in the next release.
I don't see any evidence that this patch has found any support within Drupal for implementation in core. I do hope that something like it will be introduced in the forseeable solution.
But for now, we'll be using it to solve the problem of Making TAC and OG work together.
How's that for using Hot Air in a useful manner?
A very special Thank You to agentrickard not only for creating and supporting this patch, but for tirelessly promoting it for the past several months.
Yes
The multiple_node_access patch supports this logic today. And, to be clear, what we need is the option to allow any combination of AND and OR among a collection of modules. Some sites may want:
IF OG or TAC and DAOthers may want:
IF OG AND TAC and DAOr:
IF OG or TAC and DA and CASo our code logic should be flexible enough to support that. I think the patch allows for this type of control, if implemented smartly. I went through about three options for OG/DA integration before arriving at this patch.
What you do is add a 'group' element to the $grants array passed by hook_node_grants(). One of the things I like about the patch is that it requires only a very minor API change and does not require any current modules to change at all unless they want to exploit this feature.
See the implementation at: http://therickards.com/api/function/domain_node_grants/Domain
Ideally, as Moshe points out in the patch issue, this behavior is configurable. In the case of Domain Access, we run this check:
// Do we need to use complex rules?$rules = variable_get('domain_access_rules', FALSE);
And we append the $grants['group'] = 'domain' if TRUE.
The 'domain_access_rules' variable is optionally set through a configuration form, and can only be activated if more than one module implements hook_node_grants().
See the implementation in http://therickards.com/api/function/domain_configure_form/Domain (search for 'node_access_grants_sql').
In the case of TAC or OG, a similar setting could be applied using this logic:
-- Check for the existence of other node access modules
-- If TRUE, allow AND or OR logic to be selected
-- Then, in hook_node_grants(), if TRUE, set 'group' in the $grants array.
-- e.g.
$grants['tac']['group'] = 'tac';A module may declare one or more groups, depending on how many different grants it passes. Each grant not assigned to a group is put into an 'all' array and processed using the current OR logic. Each distinct group is then AND attached to the query as a subselect.
NOTE: One reason this is a patch and not in core is that MySQL 4.0 does not support subselects, and Drupal <= 5 runs on MySQL 4.0 >.
It is also possible that this is a bad approach, and it needs to be tested for scale.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
How do I make OGR Compatible with DA?
I read with some interested your remarks about OGR here: http://drupal.org/node/212915. Instead of replying there, I decided to reply here since this is the subject I am more interested in. In describing Domain Access, you say:
Generally speaking, you are correct. However, OGR only uses the hook_nodeapi('access') patch for TAC/OG integration, which is NOT a fundamental function for which OGR was created. However, as you've seen in the thread here, I do have a great interest in getting TAC and OG working together.
By working together, I mean:
If a node belongs to a group and has taxonomy, a user is NOT permitted to access the node unless he has permissions for access to BOTH the group and the taxonomy. Right now, today, a user is allowed access to the node if he has permissions for either one.
My understanding is that with your multiple_node_access patch you have resolved this by using hook_node_grants which, in Drupal, is the preferred method.
So, what would it take to make OGR compatible with DA so that TAC and OG will work together as I've described?
Patch review
I may misunderstand how OGR handles the access nodeapi hook, but my read of the patch says that the hook fires a return, interrupting the normal db_rewrite_sql() routine that other node-access modules depend on.
This approach is fine for the current OR logic of node access grants, but DA introduces the idea of AND grants across different modules.
As for integration, see http://drupal.org/node/196922 for the official patch and some discussion.
The technical discussion might best be placed in an issue, since that will allow me (at least) to track it better.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
OK, but one more question...
I'll create an issue, but I have one question: I don't really understand how to implement this, but I know I'd need to patch the node.module, and I'd need to do something with hook_node_grants in my module.
However, if I want TAC and OG to work together as I've described, would I also have to modify the hook_node_grants functions of the taxonomy_access and og modules as well? Or, could I do everything I need within my module once the node.module patch is installed?
Multisite/groups/access control solution using OG only
This thread was started to test whether TAC could be used as the only additional module (together with core Drupal multisite functionality) to provide a sophisticated multisite/group solution with fine-grained access control. The team working on meeting the requirements of an international NGO (www.drupalproject.iofc.org) for multiple domains and groups, with fine-grained access permissions, plus shared users and content across all domains and groups, evaluated six possible configurations. All of them apart from the first assume Drupal's core multisite functionality for that part of the requirement (summary in a moment). The six are:
It should be noted that the modules mentioned in this list are only the modules which control node access. Our 'holy grail' was to have only one such module, which was why we looked carefully at option 2 (see top of this thread). Our final solution, option 6, requires the og_user_roles module but this does not compete with OG for node access.
Readers of this thread may not have time to hear details of the advantages/disadvantages of each solution. So I will summarize how we configured option 6, and why we felt it came closest to meeting our requirements. But first a brief summary of our core requirements.
Main requirements
The OG-only configuration
Advantages/disadvantages of this solution
Each of the six solutions has its advantages and disadvantages. The main disadvantages of OG only for us have to do with the loss of Domain Access functionality:
The main advantages for us (some of these would have also been achieved with other solutions) include:
We would welcome and be grateful for any further feedback on this solution.
Very interesting. We
Very interesting. We currently were using what you called option 1, however then found the need for OG roles, which lead me here to this can of worms!
Our additional need is for block customization per group, allowing key content (logos, intro paragraphs etc) to be customized without having to place them all in the og group content type itself. DA filled this very nicely allowing us to clone tables, however, your OG only poposal looks cleaner from my standpoint. This leads me to a new problem, how to have default blocks, which can then be seamlessly edited by group owners.I would be interested to hear any ideas or alternative solutions people can think of.
seems like :
Having a dedicated user_roles table per domain, is this better than use OG user roles and could you elaborate on :
As is this a advantage (ie being able to set the scope of the role) or a disadvantage and you need to apply the role in 3 places for it to be system wide?
I arrived to the same
I arrived to the same conclusion for a social community distribution profile i am building located here http://groups.drupal.org/openmusic
for music bands/artists/fans. Essentially each artist/music band is an organic group, and each organic group has the ability -through og_user_roles to assign group specific roles to group members, making them "manager of the band", "band photographer", "band member" etc. I've been following SomebodySysop's progress almost from the beginning and I have to say he has build a very solid and to the point module that is perfectly suited for this situations.
A healthy disregard for the impossible.