0

How do I set content permission so that specific content types become visible/usable to the admin user only, while other content types may be visible by other user roles?

After I added new content types, I checked the rebuild permissions.

Content access is working fine but the problem seems to be the fact that the enw content types aren't made visible / accessible to the other roles...

  • go to admin/people/permissions – M a m a D May 15 '14 at 12:12
  • Thanks, I did though but which one should i definitely check? – user28875 May 15 '14 at 12:26
  • Content types are listed there and select the ones you want – M a m a D May 15 '14 at 12:27
  • go to that page, then find NODE title, under this title all of the content types are listed – M a m a D May 15 '14 at 12:51
  • 1
    @Drupalist, I think we all know how it looks like. But the question was about how to control "visibility" (i.e. View permission) for a particular content type. As your screen shoot clearly shows, there is no radio-button within the area you outline in red that allow one to do that. The only permissions available are Create, Edit and Delete. – Free Radical May 15 '14 at 13:09
4

The core's built-in support for node access control is rather course, and to control a specific role's access to view a page, it is not enough to go to admin/people/permissions to set permissions, since there is only a global setting for "View published content" that apply to all published content.

However. to give the permission to Create new content (node/add), there is no need for an extra module, since all other permissions, i.e. Create, Edit, Delete, is managed by the Drupal core and there are per-role settings in the built-in permissions interface. First, just to make sure content is visible, navigate to admin/people/permissions and make sure you have the permission View published content checked for the authenticated user role.

Then, just below it, locate the check boxes to "Create new content" for the content types you want users beyond the administrators to be able to create, and check those for the roles you want to have this permission granted (ditto with the Edit and Delete permissions).

Also make sure new content is Published. If content is not Published, the only user that has access to it us the super admin user.

To set the default to Published for a new content type, navigate to Administration → Structure → Content types. Then click on the edit link for the type you want to configure- Locate the "Publishing option" tab. and make sure that there is a tick mark for "Published" under "Default options".

If you need fine grained access control beyond this, you need to install a node access control module.

The module I recommend for this is Content Access. It let you control access per content type and user role.

To set the per content access settings, navigate to Administration → Structure → Content types. Then click on the edit link for the type you want to manage, and then on the Access control tab. This takes you to the control panel for role based access control settings. The screen dump below shown how do set this for the built-in content type "Basic page":

basic page access settings

After setting the permissions the way you want, click "Submit".

There is a nice tutorial about installing and configuring the Content Access module on YouTube. (Thanks to @shrish for bringing this to my attention.)

  • Thanks, i am using content access, which is a great module! Do I understand it correctly that you first have to set the change the permissions settings per node per role and then change the settings in content access? – user28875 May 15 '14 at 13:32
  • you can add this video link to your answer as quick demo for module . :) youtube.com/watch?v=VSQ4L7wADnc – shrish May 15 '14 at 14:02
  • Thanks @shrish. It looks like a very helpful module (helpful demo video) but the thing is that other roles besides the administrator role don't have access to new content types (node/add/) that I have created... – user28875 May 15 '14 at 14:19
  • Yes, I did but it doesn't seem to do much. It is just ignoring any changes (adding new to the content types). Apparently the other roles don't have access to newly created content types, or 'old' ones like basic page. – user28875 May 15 '14 at 14:28
  • Both are missing, i.e. they cannot view the new content type and thus create a new node with the content type. – user28875 May 15 '14 at 14:46
1

Content access is no longer under active development (according to the project page on drupal.org). It's a good module but for long-term site sustainability, it might not be the best solution.

Another option is the field permissions module (https://drupal.org/project/field_permissions). It offers more granular control over the fields of each content type (which is more than what it sounds like you need) but it can easily be used to accomplish your objective.

I've used the field permissions module on a number of sites with great success. It's stable and very easy to use. I can offer some tips if you decide to use field permissions.

Here's a snipit from the module's README.txt file:

INSTALLATION

1) Copy all contents of this package to your modules directory preserving subdirectory structure.

2) Go to Administer -> Modules to install module. If the (Drupal core) Field UI module is not enabled, do so.

3) Review the settings of your fields. You will find a new option labelled "Field visibility and permissions" that allows you to control access to the field.

4) If you chose the setting labelled "Custom permissions", you will be able to set this field's permissions for any role on your site directly from the field edit form, or later on by going to the Administer -> People -> Permissions page.

5) Get an overview of the Field Permissions at: Administer -> Reports -> Field list -> Permissions

0

Related, I've found the use of an added extra content type, ie "Draft Document" or "Draft Data" etc for admin/exec/dev user permissions only, along with the Node Convert module, allows publishing of nodes in the "site flow and layout" as published rather than unpublished first revisions of Page, Article entities etc. This tweak seems a need to compensate for the D7 ui workflow weakness of layout/design/workflow/permissions of core and core node. Node Convert Node does A1 job of field mapping so its practical even for a newbie, but caveat, Node Convert may not play nice with VBO (maybe).

If a previlaged user wants to make a doc, simple data or image page node and see how it looks on a D7 site screen/layout/display before revealing it to the world on a live site (rather than a hidden/dev/beta site), unfortunately D7 core does not provide rendered layout of the standard UNPUBLISHED nodes, even if you are the admin/exec/dev and superuser 1. NODES NEED TO BE PUBLISHED TO BE DISPLAY unless templates and API preproccessing for rendering by programmers is done or ACL or field permissions are used one way or another. One of the Drupal glitches to my mind.

Therefore it's unfortunate ACL - Access Control module (that i believe funny enough mirrors older D6 content type node permissions options/config and as well, an ADCI Solutions (see drupal association) module for this)... is not a most popular, or secure solution to this subtle but substantial fail in Drupal realm. Guess it's time i dig into D8.

Of course, maybe the Workflow module and rules and/or triggers is another way, more sophisticated way, to solve like challenges

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.