Drupal TAC not working? Setup wrong? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this questionI'm new to Drupal and decided to use Drupal 7 to manage a user system in which one logged in user sees one page, and another logged in user sees another page. I've got it set up to the point where each user logs in and is directed to their landing page, no problem. However if once logged in, user 1 attempts to view users 2's landing page (by say changing the url in address bar) then user 1 is looking at user 2's landing page, not supposed to happen. It work in reverse as well.
I've set up Taxonomy Access Control but not sure if I'm setting it up properly maybe? The Lite version won't set up properly (though it seems more applicable here) and it fails when rebuilding permissions. So TAC is all I can find to do this. I cannot figure out where to add the "terms" to my content. I have set up roles - viewerCompany1 and viewerCompany2 and I have my users defined properly with these开发者_如何学JAVA roles. I just can't figure out how to tell Drupal "don't allow user 1 to see landing page 2".
Harp, your almost there. This is how I usually set it up in D7.
- Create a role called "Members"
- Create a new vocabulary called "Access"
- Add two terms to the "Access" vocabulary, "Public" and Members Only"
- Add a new field to each content type - Admin > Structure > Content Types of type term reference. I usually use the checkbox widget but it is up to you.
- Set the vocabulary to be the "Access" vocabulary you set up in step 2
- Set the default to be "Public" - this is optional but it means all pages are publicly accessible unless specifically set to "Members Only"
- Save
- Go to the Manage Display settings for that content type
- Set the Access field to hidden
- save
- Now go to Admin > Configuration > Taxonomy access control
- Go to edit access rules for anonymous users
- Under "New" select members in the dropdown
- Set each option in the row to "D"
- Click Add
- Do steps 12 to 15 for the authenticated user
- Do steps 12 to 15, expect select "A" instead of "D" for the members role
Now when you select Members Only for the Access field on any node, that node will not be visible to the anonymous and authenticated users. Any user with the Members role will be able to view the node. This will also hide menu items that are directed to this node. See the taxonomy terms documentation for more help. https://drupal.org/node/31601
You need to add a new field to your content type of type 'Term Reference', then link it to the appropriate vocabulary(s). Then edit the nodes in question and choose which categories they should be part of.
Once you've done this the nodes will be linked to taxonomy terms so the TAC module should then work as expected.
精彩评论