CVS edit link for extde

Welcome Node Native URL Access Control.

This module allows restrict access to nodes by native URL "node/nid" and "node" (default node).
It restricts access by native URL for all roles except "Administrator" by default.
You may permit access for specific role in Drupal admin permissions form - "admin/people/permissions"
User will be redirected to "Page Not Found 404" page in case if he/she try to access node by native URL "node/nid" and has no permission to do so.

There is two ways to address content in Drupal - a) with node/nid and 2) with path aliases.
Mixing both types of addressing will cause complicated problems related to visibility settings (at lease blocks visibility)
This module will allow you to implement addressing with node aliases and restrict access by node/nid for desired roles (for example for anonymous users).
Of course node access with native URL is very important for web site developers and administrators.
So, this module allows to manage which roles will have an acces to nodes (and other functions like node/nid/edit, etc.) by native URL.
Module tries to implement same functionality as www.whitehouse.gov have (it does not allow access by node/nid)

Many people asked about how to implement this use case but there is no acceptable solution found and no drupal module contributed:
1) http://drupal.org/node/952398
2) http://drupal.org/node/164526

Comments

extde’s picture

StatusFileSize
new7.13 KB
extde’s picture

Status: Postponed (maintainer needs more info) » Active
extde’s picture

Status: Active » Needs review
bojanz’s picture

What about Global Redirect?

If you need it not to redirect for admin, and Global Redirect is missing that feature, that would be a 3 line patch.

extde’s picture

Hello Bojan,

I checked Global Redirect of course before writing this module.

There are several "why" exists why I can't use this module:

  1. Global Redirect does redirect to page alias (if node have it) and will not redirect if node does not have an alias. My module based on different use case - it forwards to 404 every time when node native URL is used and current user role does not permit access to node by native URL.
  2. Global Redirect module implements several use cases and it does not implement mine (#1).
  3. Global Redirect will use much more processing (CPU/RAM) power because of it's complexity.
  4. Looks like Global Redirect has an issues in architectural design because it's implementation violates "Your module doesn't remove the Drupal variables it defines" (http://drupal.org/node/539608) by calling unset($_REQUEST['destination']);
  5. My module uses hook_url_inbound_alter() and is localization-aware (language-aware) with functionality that is built-in Drupal Core, while Global Redirect uses hook_init(), which is much more generic hook and uses integration with Translations module in this case (does not support built-in localization functions).
  6. My module requires less configuration (uses Drupal core built-in permissions) and does not maintain it's own configuration variables, while Global Redirect has dedicated separate administration interface(form) and requires more learning and configuration time.
  7. Global Redirect does not implement hook_permission() at all and does not integrate with Drupal core security features!!!
  8. Global Redirect module violates Drupal core design in part of "Clean URLs". It will do redirect to clean URL even if site administrator will disable this feature in Drupal core configuration. See http://drupal.org/node/201077
  9. There is another very important conceptual issue with Global Redirect module - how it works with multiple aliases referencing same node. Drupal allows you to have multiple aliases for same node, but Global Redirect is not aware about this situation. Developers of Global Redirect module did not find any acceptable solution. By my mind this issue is in Global Redirect module requirements and can't be implemented at all (impossible to implement). It is one to many relation between node and aliases in Drupal, so you cannot decide which alias to use based on given information (node and aliases relation). In opposite, there is one to one relation in my module where native node URL will be forwarded to 404 page (or not based on user role permission).
  10. Global Redirect does not work in "Maintenance Mode" (http://drupal.org/project/globalredirect - Known Bugs)
  11. Most common issue (and almost constant) for Global Redirect module is "Redirect Loop", while my module uses different architectural design (forward instead of redirect) that will prevent this issue from occurring.
  12. Global Redirect module takes care about trailing slash in URL. I think, it would be more effective to implement this in Apache rewrite (less processing power, less traffic and better compatibility).
  13. At the time of writing this, Global Redirect module has 263 issues and 55 of them is open. This is too much for small module - 1 issue per 2 lines of code!!!
  14. At the time of writing, Global Redirect (dev version) just does not work in Drupal 7 RC2 - it crashes whole web site.
  15. Some people using Global Redirect module just because there is no alternative exists, it does not meet their requirements (as in my case) and used as a workaround.
  16. I would like to keep my module very simple, so it will not to be a cause for performance, architectural design violations or administration issues. Let's keep my module and Global Redirect as a separate modules, so end users will be able to enable only required functions.
  17. My module has just 58 LOC including comments and the code is stable (by my mind), while Global Redirect has 562 LOC (x10 times more) and will grow in the future.
  18. Global Redirect is a way to fix duplicate content problems (when many URLs points to same page) and suitable for SEO optimization. But my module have different approach - it is access control module. I do not think that several URL aliases to same page is bad and looks like Drupal core developers had some idea behind this as soon as they implemented this feature and kept it even in Drupal 7. My approach is not intended to break Drupal design or fix it (as Global Redirect did), but it tries to provide useful flexible mechanism that will help web site developers use all Drupal features (it is extension module).
  19. My module will work even if you specify 404 page in site configuration dialog as native node reference - node/nid. That's because I followed Drupal core design instead of hacking it. I do not expect number of conflicts with other modules.
  20. Hope my module may be included in Drupal 8 core (as a part of Node module) after community will verify it and module will become more mature. ;-)

Node NUAC

Node Native URL Access Control is an Drupal Node security extension module.
It allows to restrict access to nodes using native URL "node/<nid>".
Access to nodes by native URL will be restricted to all user roles except Administrator role by default when you install and enable this module first time.
Drupal superuser (uid=1) will be not affected because drupal core implements security bypass for superuser.
Users (with "Administer permissions" allowed) can allow or restrict access to nodes by native URL for each role separately.
There will be no difference in drupal behavior in case if access to nodes by native URL allowed for current user role, otherwise module will forward to "Page Not Found 404" page, if user tries to access node by native URL, but current user role restricts this access.

What is the defference between Global Redirect module and Node NUAC?

Global Redirect module tries to fix SEO problems related to situation when multiple URLs pointing to same node. For example it will redirect following URLs to node alias.

		http://www.yourDrupalsite.com/
		http://www.yourDrupalsite.com/?q=node/1
		http://www.yourDrupalsite.com/node/1
		http://www.yourDrupalsite.com/node/1/
		http://www.yourDrupalsite.com/my-first-post
		http://www.yourDrupalsite.com/my-first-post/ 

Global Redirect uses HTTP 301 and HTTP 302 redirect responses. Actually it is module that tries to fix problem.

While Node Native URL Access Control module is a security extension module.
It does not apply limitations to current Drupal implementation, but provides flexibility for web site developers.
Node NUAC uses forward method (does not use HTTP 301/302), so, it works on the server side without sending additional HTTP redirect response (and following overhead).

Both modules serves different use cases.

Node NUAC uses Drupal core forms for configuration in opposite to Global Redirect that uses separate administration form.

Keeping Node NUAC and Global Redirect as a separate modules allows web site developers enable required functions only and implement issue separation when issues in the modules will not spread across each module border.

What is wrong with Global Redirect and why Node NUAC should be used instead?

  • Global Redirect canot provide acceptable logic of which node alias to use for redirect in case if more than one alias exists.
  • Apache mod_rewrite will do much better job for "trailing slash" issue than Global Redirect module.
  • Web site developers should discipline yourself and do not create multiple aliases for same node without reason. It is better to find and verify all URL aliases that points to same node and correct problem by removing unnecessary aliases instead of trying to fix this problem with Global Redirect module.
  • Node NUAC module will restrict access to nodes by native URL for specified user roles only (for example Anonymous role). So, this solution is also suitable for SEO. But acces to nodes by native URL is playing very important role for web site developers, so they can access node edit, revisions, etc. That's why Node NUAC is able to apply restriction separately for each user role.
  • Node NUAC supports Drupal core built-in localization features.
  • Node NUAC will work properly in following Drupal modes: 1) "Clean URLs" enabled; 2) "Clean URLs" disabled; 3) "Maintenance mode".
  • Node NUAC will help verify links inside web site content, that these links do not use native node URL, so you will get 404 error if such link will be found during verification process. Global Redirect does not help in this case at all.
  • Node NUAC module is very small. It followed Drupal core implementation instead of hacking or fixing it.

What cases are not covered by Node NUAC

Node NUAC module takes care about node native URL only. All other native URLs are not affected.




I hope it is enough explanation why my module should be allowed.
Let me know if you have any questions.

Regards,
Dmitry Trifonov

extde’s picture

StatusFileSize
new8.65 KB

Some testing performed

avpaderno’s picture

Issue tags: +Module review
zzolo’s picture

Component: Miscellaneous » miscellaneous
Status: Needs review » Postponed

Hi. Please read all the following and the links provided as this is very important information about your CVS Application:

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications

  • The status of this application will be put to "postponed" and by following the instructions in the above link, you will be able to reopen it.
  • Or if your application has been "needs work" for more than 5 weeks, your application will be marked as "closed (won't fix)". You can still reopen it, by reading the instructions above.
avpaderno’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)

As per previous comment, I am setting this issue as Won't fix.
Since now users can create full projects, applications have now a different purpose and they are handled on a different issue queue. See Apply for permission to opt into security advisory coverage for more information.