18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Drupal</strong> Permissions and Security<br />

Summary<br />

Our coverage of <strong>Drupal</strong>'s permission system should give you all the information you<br />

need to properly set the access rules for your module.<br />

In this chapter, we have learned the basics of the permission and role system in<br />

<strong>Drupal</strong>. We have also seen how to use user_access() to assert permissions. We<br />

have discussed how hook_menu() handles access control, and also how to use<br />

hook_permission().<br />

We have seen the importance of granular permission definitions, and when to use a<br />

function other than user_access() to assert permission control. We discussed how<br />

to write a custom access control function, and how to respond when access is denied.<br />

We also saw how to assign and remove permissions using hook_enable() and<br />

hook_disable().<br />

We learnt how to manage roles programmatically along with the basics of securing<br />

<strong>Drupal</strong> forms. Lastly we looked at how to safely handle AJAX callbacks.<br />

[ 240 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!