In my drupal site I need to restrict the access of a view to certain users. The senario is like, each user will be assigned to a certain Item. Each item is a view. The users relation to the items is defined in a mysql table. Now what I need is, When ever a user clicks on a pirticular view (item) I need to check if he has access to that. Where can I write the code for this ?

  • This is what permissions are for. Grant only certain users the right to access the view. – Alex Gill Mar 26 '14 at 9:59
  • Yes..I have a custom table and a custom module for doing so – I'm nidhin Mar 26 '14 at 10:11
  • If possible can you share the table structure and values? – inizio Mar 26 '14 at 15:00
  • It may be easier to achieve this using Drupal's built in roles and permissions. The views UI has an option for choosing which permission users must have to be able to view the content. – Felix Eve Mar 26 '14 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.