tags:

views:

24

answers:

1

i need help how to organize nodes of drupal cms.

i have three kind of users (three additional user groups).

nodes are accessible only if users are logged in.

users from first group can access to all nodes, that are created by all users (all users group).

users from second group can access only to nodes created by them self.

users from third group can access to content created by them and users from first group.

important is that when users enter their content, they does not have to define who can access to which content. it have to be done by system.

is it possible to organize using views module? also, it is important that users must use same link to access to nodes.

do i need some extra programming for that?

thank you in advance!!!

+1  A: 

I'm sorry but the answer to this is rather complicated to explain. The concept is actually quite simple.

You will need to use a Node Access based module. What do node access modules do? Please see:

http://drupal.org/node/270000 for a good overview

First, create 3 user roles. Lets call them: Role_A, Role_B, Role_C. Then create a vocabulary called Group. Add three terms in Group vocabulary: Group_A, Group_B, Group_C.

Make sure the Group Vocabulary applies to all Content types you want to control e.g. Page, Story, etc.

The concept is the following: When a user of Role_A will create a Node, he should add Group_A term to the node. When a user of Role_B will create a Node, he should add Group_B term to the node. When a user of Role_C will create a Node, he should add Group_C term. I know you want the user to not have to do this... there are ways we can avoid this or make it simple... keep reading.

Using taxonomy access control lite module http://drupal.org/project/tac_lite you will make it such that:

Role A will have view access to all Nodes that have the taxonomy terms Group_A or Group_B or Group_C. Role B will have view access to all Nodes that have the taxonomy terms Group_B. Role C will have view access to all Nodes that have the taxonomy terms Group_A or Group_C

Now you need to prevent users of Role_A attaching any term from Group vocabulary other than Group_A. i.e. a Role_A user should only be able to add term Group_A to their nodes, a Role_B user should only be able to add term Group_B to their nodes and a Role_C user should only be able to add term Group_C to their nodes.

You can do that by using the term permissions module http://drupal.org/project/term_permissions

Go to each term in the Group vocabulary and edit it, there is a permissions section which will now be available. So let Role_A only have permission for term Group_A, Role_B for Group_B and Role_C for Group_C.

Now you should make the Group vocabulary required (click the required checkbox in the edit vocabulary settings). This is so that users are force to choose their group. Note, that due to term permissions they will only have ONE item in their dropdown that they need to choose from so this is trivial.

Views module will work out of the box. Role_A users will only be able to see the nodes they should and so on. So you're okay there.

Note 1: If you want that people should not worry about having to choose the Group, you can always use the rules module to make sure that a node is marked with a certain taxonomy term upon save. See http://drupal.org/project/rules . So you will add Group_A term if user role is Role A and so on upon save. If you are using rules you don't need to make the Group vocabulary "required".

Note 2: Please note that instead of using the taxonomy access control lite + term permissions module combination you could have simply used taxonomy access control http://drupal.org/project/taxonomy_access which is powerful but more tricky module.

Note 3: Please note that at the time of writing this, the term permissions module interferes with the Hierarchical Select (HS) Module and perhaps the taxonomy super select (TSS) modules. So if you are using the HS/TSS modules you will need to user taxonomy access control (and not tac_lite)

Sid NoParrots

related questions