Skip to main content

Field Permission Patterns: a Drupal module for configuring custom field permissions

Developer
Aug 29, 2014

If you ever had to configure custom field permissions in a project that had a ton of custom content types with a bunch of different fields, you probably ended up wishing for a tool that would make this process less boring and error-prone. This is why I wrote Field Permission Patterns, a module that takes the hassle out of configuring custom fields. In this post I tell you more about the usage and configuration options of Field Permission and Field Permission Patterns.

In a project not long ago, I had to update about 50 custom field permission settings. This monkey job was so boring, that I soon realized I would be better off writing a Drupal module for this task. I did, called it Field Permission Patterns and shared it on drupal.org.

What I built on: the Field Permissions module

Once you install the Field Permissions module you need to edit the field settings form in order to enable permissions for each field. The Field Permissions module provides three default settings:

  • Public: Indicates that a field does not have any access control.
  • Private: Private fields are never displayed, and are only editable by the author and by site administrators with the ‘access private fields’ permission.
  • Custom: You can define custom permission settings if none of the above options worked for your requirements.

In most cases you can use the Public and Private options, but if not you are faced with a long and boring configuration job.

Where the Field Permission Patterns module comes in handy

Usually you can divide your access use cases into a few patterns, that you have to apply on each field. If that’s the case, I would suggest you install the Field Permission Patterns module at this point to avoid getting any more grey hairs in the process.

In general the module extends the features of the Field Permissions module with the ability to create field access templates. These templates are available on the field access configuration form beside the default Public, Private and Custom options. Each enabled pattern will appear among the Field Permission options.

The module also provides the necessary interfaces to manage your permission patterns.

As you can see on each interface under Linked Fields you have an overview of the fields that are currently using the pattern. This is also helpful, because if you update a pattern, the update will affect all the linked field permissions. No more repetitive checkbox clicking, you can manage everything from the same interface.

The module also provides Features integration out of the box, so you can easily fit it into your everyday deployment workflow.

Attila graduated as a software information technologist at the University of Szeged, Hungary, where he enrolled to an approved credit Drupal course, since then he is enthusiastic about Drupal development, distributions and the whole Drupal community. He started working as a Drupal trainee in 2009 at a web developer company in Szeged, and quickly became a Drupal developer. Besides Drupal, he has wide knowledge and work experience in PHP, jQuery, CSS and HTML languages and SVN, Git version control systems. At Pronovix he is involved in several big projects and has been working with lead developers to keep widening his knowledge on Drupal and web development.

Newsletter

Articles on devportals, DX and API docs, event recaps, webinars, and more. Sign up to be up to date with the latest trends and best practices.

 

Subscribe