My vain attempt to document organic groups and how I am currently implementing it. (D7 + OG)

My vain attempt to document organic groups and how I am currently implementing it. (D7 + OG)

Problem:
I spent about a week pursuing various modules and combinations of solutions to find a way to basically filter the content in a view based on the currently logged in user's role. So, if I have a role called lab admins, anyone in that role needs to be able to see a certain set of data. This data cannot be see by lets say office admin role. Office admin role has an entirely different set of data. Many people think this is doable and it is but only for the author of the content. In my situation, I have 15 different labs and growing and each lab can only see their sets of data. For each lab, I need to be able to add users to their admin role. So lab1 admin might be just Bob, but lab2 needs Bill and Joe, and lab3 needs to allow Bob from lab1 and Bill from lab2. The only way to tackle and solve this was Organic Groups.
 
Solution:
Install organic groups. Create a new content type that will relate the data to the user group or roles or whatever (In my situation I created a content type call Labs and associated the title of the node to the author. So the title was the lab name and the author was the author of content being imported). Go to the content type of the data that you want to relate and under the edit tab choose organic groups and check the group content checkbox with target type node. When you do this it will add to fields to that content type: Groups audience and other groups (both are entity reference fields). The next step may vary from person to person. For me, I was using feeds to pipe the data in. So I added a source called Lab Name and pointed it to target: Groups audience (Entity reference by Entity label). This is not an option until you patch OG. 
Once you finish that you should be able to check out the content in one of the views that is installed with Organic Groups. I basically found the view, cloned it, tweaked it, and tested it until I was comfortable all the data was correct and private.

about the author

David Leary

related posts