Pronovix articles

Drupal as a front-end for Google Drive II

technical background
by Daniel Kalmar / Thursday, December 20, 2012 - 14:58

Thank you for your questions about our previous blog post “Drupal as a front-end for Google Drive”. As promised I’m completing the article with a technical background and some more insight into the development. This post will also help you make your own document management system without writing a single line of code.

You’ll need the following Drupal modules:

  • Google Drive Synchronization - We created a module that connects Google accounts to Drupal accounts and imports the documents into Drupal nodes. Check it on drupal.org!
  • Organic Groups - to create a group content type for public or private projects
  • Flag - to highlight documents and projects
  • Views - to create and check overviews easily for searching and filtering

We used some other contributions besides the ones mentioned above, but the main functionality is based on these.

After installing Drupal 7 and enabling the suggested modules, you have to do some configuration:

  1. Set the Client ID, Secret ID and Redirect URI on the Google Drive authentication settings page.
  2. Set the Redirect URI on the Google API’s Console page (not in Drupal), it’s always the following: http://DOMAIN/goauth/authenticate.
  3. Create a group content type for projects, and add the Group visibility field on Organic groups’ field settings page to it. To help better organize projects, we also created a Company content type, and you can create workflows by adding extra fields.
  4. Create a flag for documents, and another one for Projects for highlighting.
  5. Make overviews to display own documents, all documents or all projects via Views UI.

When creating the overviews in step 5, you will need some “magic” to make it work as it should:

As a default, Drupal displays unpublished content to users having admin rights. In this case you need to show documents to simple authenticated users as well. We took the shortcut of disabling the rewrite SQL behavior at http://DOMAIN/admin/structure/views/view/VIEW_NAME/edit in Query settings under the Advanced options solves this issue. In order to not display all documents in the database to all users, set the content author’s uid as a contextual filter to display only the documents belonging to the logged in user. The module in its current form is best only used in a small company setting where you trust all people that have access to the site behind a httpaccess password, e.g. by using the shield module.
If you would like to use complex filtering criteria, we recommend using exposed filters.

And voila, the system is up and running in a couple of hours including configuration.

Add new comment

By submitting this form, you accept the Mollom privacy policy.