Bảo vệ Drupal Content với Node Access Password

Bảo vệ Drupal Content với Node Access Password

Node Access Password is a module that allows you to password-protect your Drupal content.

This module will automatically generate a random password for each node you want to protect. That password must be entered before viewing the content.

We're going use the example of a real estate website. We're going to set up a Property Manager who can give access to individual properties by handing out passwords.

The Property Manager case will be able to view the passwords created and give those passwords out.

Step 1. Install the four required modules


Node Access Password is a single module, but it won't operate without three dependencies. You will need to install and enable all of these modules:

Step 2. Enable all the modules


  • Return to the Module page and check the boxes next to the modules.
  • Scroll to the bottom of the page and save.
  • Double check that all are checked. You can't activate a module until it's dependencies are activated, so you can't always activate everything at once.

Step 3. Add a new role


  • Go to People > Permissions > Roles. We're going to create the role for the Property Manager.


  • Type in the name of the role.
  • Click Add role.
  • Click Save order.

Step 4. Edit role permissions


  • Click edit permissions after the role is added and saved.

A quick reminder about permissions: Permissions let you control what users can do and see on your site. You can define a specific set of permissions for each role. Two important roles to consider are Authenticated Users and Administrators. Any permissions granted to the Authenticated Users role will be given to any user who can log into your site. You can make any role the Administrator role for the site, meaning this will be granted all new permissions automatically. You can do this on the User Settings page. You should be careful to ensure that only trusted users are given this access and level of control over your site.


  • Grant permissions for Content Access.


  • Grant permissions for any content types you want the property manager to have access to. There may be more than one type.
  • Double check the entire permissions list for permissions you should grant. Other modules you have installed may need attention.
  • You won't see the "Property" type until you've created it. We'll create that in the next step.
  • You will need to return to the role permissions after the content types are set up.

Step 5. Create a Content type Called Property


  • Go to Structure > Content types.
  • Create a content type called Property.

Step 6. Add the Password Field to Property


  • Go to Structure > Content types > click manage fields next to Property.
  • Choose Node access password as the Type of data to store.
  • Make sure the widget is also Node access password.

Step 7. Define per content access control


  • After creating the field, you will now see an Access Control tab.
  • Give the Property Manager the access you want that role to have.
  • Go through each section of the content control and create the formula that is going to work for you. You may want to adjust the anonymous and authenticated user access. Trial and error after you've got it all working is the best method.
  • Be sure to check "Enable per content node access control settings."
  • Optionally you can enable per content node access control settings. If enabled, a new tab for the content access settings appears when viewing content. You have to configure permission to access these settings at the permissions page.

Step 8. Create the content


  • Go to Add content > Property.
  • Check the box next to the password field you created. Your field label may be different than mine.
  • Save and publish your entry.


  • The password will be generated and visible on the View tab when you are logged in with the proper permissions.
  • You can give this password out to your users.

Step 9. The Access control Tab


  • After creating the node, you will see an additional tab called Access control.
  • Click the Access control tab to view the password or to create new access rules.

Step 10. Give Selected Users a Link to the Content

Bảo vệ Drupal Content với Node Access Password

  • You can create a menu item or you can simply give them a link directly to the page.
  • In the example above I went directly to the page via the URL. If I try to view the content directly, I get the message "Access is denied".
  • There is a password prompt which I will have to deal with before I can see the content.

via ostraining

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

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

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





Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

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

Bí quyết trốn thoát khỏi Facebook Timeline

Bí quyết trốn thoát khỏi Facebook Timeline

Nếu thực sự bức xúc với giao diện mới, bạn hãy cài trình duyệt IE7 xem sao.

LG Prada 3.0 start selling in UK on february

LG Prada 3.0 start selling in UK on february

We’ve already talked about the LG Prada 3.0‘s quest to the UK. The sexy device has already been announced by few phone retailers, which will offer it either unlocked or with a carrier contract.

Siri Proxy Makes Starting Your Car With Your Voice a Reality

Siri Proxy Makes Starting Your Car With Your Voice a Reality

A few days ago we told you about one clever fellow who had found a way to create a ‘Siri proxy,’ allowing him to intercept Siri commands.