Permissions by Term | Drupal 8 Project


Project Name : Permissions by Term
Drupal.org project Link : Permissions by Term
Created : 2015-11-07
Last Update : 2017-03-09
Current Version : 8.x-1.17
Download Permissions by Term 8.x-1.17 Version From Drupal.org : Download

Per default Drupal allows you only to restrict access to Drupal nodes by coupling node content types to user roles and the creators of the content by their user account. The Permissions by Term module extends Drupal by functionality for restricting access to single nodes via taxonomy terms. Taxonomy terms are part of the Drupal core functionality. Taxonomy term permissions can be coupled to specific user accounts and/or user roles.

Additionally Permissions by Term module restricts access to taxonomy terms at the node edit form for content editors. Like the access restriction for nodes, also by single user accounts and user roles.

The Permissions by Term module provides features for the front- and backend. No programming skills required. This module can be handled by Drupal site builders via the user interface in the web browser.

Frontend Features

  • Restricts users from accessing the nodes related to specific taxonomy terms by their roles and/or specific user accounts.
  • Restricts users from access to forbidden nodes in views.

Administrator/Editor Backend Features

  • Disallows users with administrative permissions by their role and/or user account to select taxonomy terms on the node edit form, for which they don't have access.
  • Restricts access to nodes also on the backend side by user account and/or user role.

Module's setup

Example Use Cases

The module works for you, when you need to separate content from users.

  • Premium content areas for specific users and user roles.
  • School websites with content that can be accessed only by students from a specific class.
  • Intranets for consultants and sales-people which have content with restricted rights.
  • Editorial boards with granular content permissions.

How to setup the module's functionality on your Drupal-site?

  1. Install the module.
  2. Create a vocabulary and go to it's taxonomy term add/edit-form. In the top of the form you can see the term permissions settings. You can specify here, which roles and users can access this taxonomy term and it's related nodes.
  3. To restrict the access to related nodes, you need to setup a field in your specific content type.
    • This field has to be a "taxonomy term relation"
    • and you have to use the following machine name for this field: "field_secured_areas".
  4. That's all!

Module's setup

Please notice

  • The admin user (user with id "1") will bypass all access checks.
  • All nodes will be shown to users with the permission "bypass node access".

Evaluate the Permissions by Term module quickly at https://simplytest.me/

Just visit the website https://simplytest.me/, choose the Permissions by Term module and this zero-priced service will setup a Drupal 7 or 8 website for you, so you can test the module's functionality without any risk and hosting effort.
Module's setup

Build something on top of it as Drupal developer

Users with programming skills, can use for example the AccessCheckService class in the Drupal 8 version. By this class they can use the public methods like $this->canUserAccessByNodeId(); etc. to build custom functionality on top of the Permissions by Term module. The Drupal 7 version provides various functions in it's .module-file which can be used also for custom modules.

If you have been coding some goodness on top of this module..

Please consider sharing your custom code or module via the Permissions by Term project by the issue queue. Your code can be reviewed and integrated (e.g. as a sub-module) to the project. This way you will gain feedback and credit from the community. Clients will be happy, if someone else reports certain issues.

Which benefit does Permissions by Term have compared with the forked Taxonomy Term Permissions module?

During work on a client project the Taxonomy Term Permissions module was
forked. It couldn't handle a different language and couldn't handle permissions
on single nodes and nodes on a view (= https://www.drupal.org/project/views). The use of Taxonomy Term Permissions is only in taxonomy terms on the node edit page. Not for restriction of accessing taxonomy term related content. This value is inside Permissions by Term module. I've tried to communicate with the creators from Taxonomy Term Permissions module to provide a patch, but I couldn't get any answer. So I've forked their module. Now you can use a module which contains several bugfixes, added features and fixes for Drupal coding standards.

This module was created by Peter Majmesku and the Drupal community.