Posted by LarsK on November 13, 2012 at 12:50pm
Hi all,
On my page I want some nodes that are only visible for specific members, let´s say ´students´. I want to do this by adding a field in a content type where it is possible to select which users can see the node when creating one.
So when I create a new node I want to select which users can view the node:
'All users'
'Students'
'Projectmembers'
How to do this?
Thanks in advance
Comments
possible modules
I would look for a module which allows you to view nodes by different roles (i.e. "All users", "students"). I don't know particularly which modules do this well, but here are a couple I found from Google:
http://drupal.org/project/node_privacy_byrole
http://drupal.org/project/content_access (though appears rather per node type)
drupalshrek
Maintainer of the VChess module visible in use at chess website Chesspos.com
This can be done out of the
This can be done out of the box with Drupal. You create "roles" and only allow these roles to be able to view certain content types.
You then just need to decide how you wish to assign users to specific roles.
Offering SME's Social Media packages & Drupal website services - www.mylocalelectrician.co.uk
=-=
not quite.
you are correct that drupal uses role based permissions but if the OP has 50 students and wants to assign specific content to each student, a role per student isn't manageable.
Agreed, but by using just one
Agreed, but by using just one module, the auto assign role module, and let the user decide their role, would this not solve the management problem?
This is how I overcome this issue with a job site I created, ie, job seeker and Recruiter
Offering SME's Social Media packages & Drupal website services - www.mylocalelectrician.co.uk
=-=
The problem isn't with the user selecting their role. The problem is with specific content being displayed to specific users.
User A can see node 1 and 2.
User B can see node 1 and 3.
User C can see node 4, 40 and 50
User D can see 3, 40, and 42
... and so on.
You're right it can be done with roles.
I think perhaps the question
I think perhaps the question was not too clear! What you say is exactly what I meant, maybe just not very clear on it ;)
I built a job site using only the auto assign role module and created content types specifically for those roles. eg, job seeker, Recruiter
Offering SME's Social Media packages & Drupal website services - www.mylocalelectrician.co.uk
=-=
ok, but the user doesn't want content types for each role. They want a method to assign the content created to a role.
no big deal, but I wanted to clarify that it can't be accomplished "out of the box"
.:
You can also do this with rules module.
------------
Volvo, Video, Velcro. (I came, I saw, I stuck around.)
=-=
you may also be able to pull this off with a taxonomy and the taxonomy access.module
with taxonomy would would have a select list in the node
with taxonomy access you could control access to each node based on perms to the terms.
Yes, I think this is the best
Yes, I think this is the best solution. Because I want to specify which user roles can view the node, not per user as some of you thought. (sorry if it was not clear enough).
Thank you all.
You may use ACLs
If I understand your question correctly, you don't just want to create nodes that can be viewed by all students (role based access is excellent for that). You want to create a node, and then specify which students can see the node. So you want to create one note and specify that only "Sally" and "Harry" shall have access, and another a specify that only "Ann" shall have access. In that case, I have something similar on my site to maintain report cards for individual students and for small student groups working together on joint projects.
Providing that type of access is a pain with role-based access. The best thing for this type of application, I think, is Access Control Lists (ACL). An ACL is simply a list that specifies the user names of those that shall have access to a particular node.
There exists a pretty good ACL module: http://drupal.org/project/acl - and you should use that.
However, ACL is an API, it comes without a user interface.
I use ACL with an user interface module named Flexi Access: http://drupal.org/project/flexiaccess Unfortunately, Flexi Access was abandoned about two years ago, and it has some issues.
Since I depend on Flexi Access on several of my sites, I've taken some time to fix at least the issues that stops it from working on my sites. But I haven't done any extensive tests yet, so thread carefully.
In case you're interested, I've uploaded my bugfix version of Flexi Access to my sandbox: http://drupal.org/sandbox/gisleh/1834468. You should be able to pull the latest branch (1834498-bugfix) with git. If you do take the time to check it out, I would appreciate your review or comments whether it works for you or not. Please add review or comments to this thread: http://drupal.org/node/1808510.
(And if you find any issues, I'll try to fix them to the best of my ability.)