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<br />

and Security<br />

Permissions lie at the center of <strong>Drupal</strong>'s security paradigm. Simply put, permissions<br />

determine who can perform what action on a website. Most commonly, permissions<br />

allow users to gain access (or be denied access) to specific features, such as access to<br />

the site-wide contact form or the ability to change the author of a piece of content.<br />

These permissions are not assigned to individual users, but instead to classes of users,<br />

defined as roles. A role is a collection of permissions. Individual users may then be<br />

assigned to one or more roles, as is appropriate to your project's business rules.<br />

Note: When assigning permissions to roles, the default "authenticated<br />

user" role is a special case. Any permission granted to this role will also be<br />

granted to any other role except "anonymous user". Why? This is because<br />

the act of logging in to a user account defines a user as "authenticated".<br />

Custom roles created for a site inherit the base permissions assigned to<br />

the "authenticated user" role users.<br />

Understanding this behavior is critical to site builders, making it crucial<br />

for module developers. You may need to create very specific permissions<br />

in order to satisfy the business logic that your module requires. In our<br />

discussion, we will explore common problems that can occur when<br />

permissions are too broad or too narrow.<br />

Any module may establish new permissions. In this chapter, we will discuss best<br />

practices for security and usability when defining your module's permission options.

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

Saved successfully!

Ooh no, something went wrong!