Quản lý Drupal node bằng Taxonomy Access Control.module

Quản lý Drupal node bằng Taxonomy Access Control.module

In another tutorial this week, we talked about a major hole in Drupal's permissions system.

The hole is that Drupal allows you to control who can create, edit and delete content but not who can view it.

Because this problem impacts a lot of sites, there are a lot of available solutions. In that other tutorial, we recommended the Content Access module. In this tutorial, we're going to recommend the Taxonomy Access Control module.

What's the difference?

  • Content Access works best if your user roles closely match your content types.
  • Taxonomy Access Control works best if you have a more complicated permissions system and one that doesn't closely match your content types.

Using the Taxonomy Access Control Module

Here's the example we're going to use in this tutorial.

  • On this screen we have 5 content items, all of the same content type.
  • Each content item is tagged with the appropriate state. For example, San Francisco is tagged with "California".
  • We want to deny anonymous users the ability to view items from some states.

media_1355778945289.png

Here's how we use Taxonomy Access Control to solve this problem.

media_1355777813695.png

media_1355777829342.png

  • You'll see a message saying, The content access permissions have been rebuilt.
  • Go to Configuration > Taxonomy Access Control.
  • You'll see that you have options for each user role. Click "edit access" rules next to anonymous user.

media_1355778312806.png

You'll now see the main Taxonomy Access Control page. Here's how to understand the page:

  • You add the tags on the left.
  • You look for the permissions across the top.

media_1355778345432.png

First, let's add the tags:

  • Under New, choose a tag.
  • Click Add.
  • Repeat until you've chosen all the tags that you want to control access for.

media_1355778451527.png

Now let's look across the top of the page:

media_1355778577251.png

Here are 5 new permissions that Drupal doesn't have by default:

  • View: can the user see nodes with this term?
  • Update: can the user edit node with this term?
  • Delete: can the user delete nodes with this term?
  • Add: can the user add this term to a node?
  • View: can the user see the term when looking at a node?

Now that we've seen both the left and the top of the page, we can start to apply permissions.

For each permssion, you choose the setting for each tag. Here's what the labels A, I, D mean:

  • A: people in this user role (in this case, anonymous) have this permission (in this case, View)
  • I: people in this user role have the same permissions as the default setting above
  • D: people in this user role do not have this permission.

So, if we the permissions as in the image below, anonymous users can view content tagged with Texas and Washington but they can't view content tagged with California or Georgia.

Drupal viet nam

Look back up to the image at the start of this tutorial. Here's how that screen now appears to anonymous users.

media_1355779013696.png

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy Tran owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy
  • Phone/Zalo: (+84) 944 225 212
  • WhatsApp: (+84) 944 225 212
  • Line Messenger: (+84) 944 225 212
  • Email: asaleotestf@gmail.com
  • Telegram Messenger: https:/t.me/tommytran0401

Quảng cáo việc làm

 

Thích hợp các bạn nữ mảng thợ may làm việc tại nước NGA

Đơn hàng Tuyển dụng 100 Thợ may đi Nga(đợt 1 tháng 3.2021, đợt 2 tháng 5.2021). Lương thực lãnh 800 USD, bao ăn ở, vé máy bay và visa, phí xuất cảnh(1800 USD)trả khi đi làm có lương. Bạn có thể liên hệ CÔNG TY qua Phone/Zalo: (+84) 944 225 212. Công ty sẽ tư vấn cho bạn.

Xem chi tiết: >>> https://bit.ly/3o9NOfR

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn làm Integrate Drupal và Shopify

Hướng dẫn làm Integrate Drupal và Shopify

Don't get me wrong. Drupal Commerce is a great system, and we have

Composer, học Composer trong 5 PHP Components của Drupal 8

Composer, học Composer trong 5 PHP Components của Drupal 8

Drupal is not the only system changing though. PHPBB, EZPublish and even non-product PHP systems

3 thuận lợi khi bạn sử dụng Git submodules with Drupal

3 thuận lợi khi bạn sử dụng Git submodules with Drupal

While building Drupal websites, we end up building modules for all sorts of random tasks – anything from simply reorganizing the contents of a node object or adding fields to the Site Information page to views plugins or huge integrations.