0

The reason of my question is that I have built a one-page website, but if people who knows a bit of drupal patterns wants to try to request the site by editing the url with a path like domain.tld/node/12 (for ex.), they will be redirected to the clean url and it will work, but this behavior is not intended and the theming customized in a way which is not made for direct requests on nodes.
Apart from the one-page, all the other content is in views and blocks, with a few colorbox links to open one content type in detail.
What I want to do is find a way to disallow node/* requests in path, just to "keep some control" of the way anonymous users visit the site (and potentially test it).

I have tested internal nodes which gives a partial answer, but it disallows all node's requests in colorbox.

I tried path rules but same issue as internal nodes.

Any idea to help me?

marked as duplicate by Mołot, rooby, Krishna Mohan, kiamlaluno Apr 29 '15 at 14:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • thanks for the links, I'll look into it. But I am not sure it answers the "colorbox issue". – Tritof Apr 29 '15 at 10:44
  • 1
    If you will use any of them and narrow down your question to only colorbox part, I'll retract my "close as duplicate" vote. For now, main part of your question seems already answered to me. Maybe whole of it. – Mołot Apr 29 '15 at 10:48
  • I need to test a few of the options suggested in the links you have pointed. It is possible that the answer will be in one of them. Then I would know and maybe change my question if none of them works. Thanks for follow-up on the comment. – Tritof Apr 29 '15 at 12:04
0

You can give permission to particular node using hook_permission().

function your_module_name_permission() {
  return array(
    'access your modulename module' => array(
      'title' => t('Access your modulename module'),
      'description' => t('Allows access to your modulename module'),
      'restrict access' => TRUE
    ),
  );
}

and then go to permission section under people menu. and uncheck above created permission for anonymous user.

0

I believe the Taxonomy Access Control or Taxonomy Access Control Lite is what you need. You can set the access control for user roles based on taxonomy categories. Here are the features.

  • Automatically controls access to nodes(based on their taxonomy terms)
  • Configuration page for each user role.
  • Three node access permission types: View, Update, Delete.
  • Two term access types: View tag, Add tag.

Here are the steps you need

  1. Create a Vocabulary in Taxonomy, and named something like "Access Permission". Then add "Member" term.
  2. Add a "Term reference" field on a Content type with that Vocabulary you just created. Make sure the Required field is NOT checked, so you can use the default None value.
  3. Go to "Configuration > People > Taxonomy access control" and add that "Member" term to anonymous user. Set the View, Update and Delete to "D", then Save all.

This way, anonymous user will not be able to view any node with "Member" term. You may also want to set the Default 403 to the login page, so whoever try to access "Member" term page will require to login. You can change the default 403 in "Configuration > System > Site information".

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