Drupal as a front-end for Google Drive II
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:
- Set the Client ID, Secret ID and Redirect URI on the Google Drive authentication settings page.
- Set the Redirect URI on the Google API’s Console page (not in Drupal), it’s always the following: http://DOMAIN/goauth/authenticate.
- 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.
- Create a flag for documents, and another one for Projects for highlighting.
- 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.