Technology Solutions for Everyday Folks
Glass that turns opaque with an electric current.

Private Content in Drupal

When I started going down the Drupal road a year ago, with minor delay after delay after delay, one of the many 'dorky' things I wanted to do was port my old "Start Page" to a real platform. See, I've had this flat HTML "Start Page" on my desktop for well over a decade, and it's set as my primary browser homepage. This page is my launching point for most 'frequent flyer' sort of stuff: banks, services, weather, news, and even a little calculator widget I use to reverse-calculate sales tax (which I will speak to a bit more in my upcoming financial posts).

The biggest problem is that I use many browsers, including the new Edge (Chromium), and sometimes different workstations nowadays. This one flat file doesn't scale well, and it'd be nice to be able to bolt in additional functionality if/as necessary (see tax calculator).

Some time ago I created a special role within Drupal for "Intranet" content (how very dot-com-era of me). Its intention was to provide a layer of access within the CMS that wouldn't be public, but would be accessible. And so the role sat dormant...for the better part of a year.

New Year, New Features

In mid-January, I decided to sit down and give it a go. Within a day of off-and-on attention, it's working amazingly well. I now have a hosted start page that's accessible wherever I have Internet access, but not accessible to folks without access to the CMS and with a specific role. I am Most Pleased with it.

To create this functionality, it boils down to the following bits:

  • A specific role for access rights;
  • A new custom content type for the various start page nuggets;
  • Installation of the View access per node Drupal extension;
  • Configuration of the VAPN module to control access for the new content type, to disallow access outside of the specific role (e.g. no anonymous or generic authenticated access);
  • A new view to consolidate all of the content of the new content type into one 'page,' which is also access-limited to the specific role;
  • Custom theme changes for the new view (namely removing most header content and some other unnecessary functionality);
  • Style magic to properly format it all nicely (including a refresh on the calculator form inputs); and
  • A hodgepodge of random tests across browsers and access rights.

In the end, it was actually pretty simple to implement, though I definitely had to reference some bits that Past Me wrote about debugging. Only once did I encounter the mysterious and fatal "...website encountered an error..." which was quickly resolved by a purge of the cache.

Before I decided to install the VAPN module, I did a trial with unpublished content, which was effective in preventing node access (public). It just seemed like a hack to use unpublished content in an access-restricted view to do this, though. Installing the module was the better way to go, and actually provides more flexibility in the long term.

What's Next?

It's unclear, but I'm glad to have these links all set up in a way that works well for me with little maintenance required. It's also nice to flex the memory muscles a bit with creating new content types, views, modifying theme configurations and style settings...so perhaps the Next Big Thing will be porting over some really old content and fiddling with applying a completely different theme.

Headline image via giphy