Module Development

Movie Project: Add User Permissions for Drupal 7

Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Create a permissions hook to secure access to pages within Drupal.


Require a user to have a certain permission before they can access a page.


You will need the following knowledge and skills. If you need a review, check out the Additional resources section at the bottom of this page.

  1. How to use permissions hooks.
  2. Understand security issues within Drupal.


Create a permissions hook, with a permission of ‘add movie review’ to restrict access to the custom movie import page.

For the role of ‘contributor’ in your demo site, add the permission ‘add movie review’, also ensuring access to create and edit their own Movie Review nodes.

Make a list of 10 issues which can affect security within Drupal.


  • Maintaining a secure site within Drupal is essential, and a wide range of factors need to be taken into account to ensure this.
  • Any custom code must take into consideration security issues by validating input and output.

Further your understanding

Additional resources

Creative Commons License

Drupal Training Resources by Damian Robinson are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at

Hands-On Exercises: Movie Project