GSoC17 : Client Side File Crypto : Week 12 : Wrap-up

Submitted by tameeshb on Thu, 08/24/2017 - 23:48

This blog post summarizes the twelfth and final week of writing open-source code for Drupal with Google Summer of Code.

Final week of GSoC! My module is ready for testing and community reviews. I’ve added instructions on the module page . Feel free to provide any feedback and raise issues on the issue queue of the module here.

Final Evaluations

This is the final week of evaluations, my mentors will be evaluating the work done so far and I’ll be continuing work on writing documentation, additional tests and preparing the code for final submission after code reviews. I also added a proper user documentation for the usage of my module on the project page

Here’s a issue page that I created for all links of the project for the final evaluation work submission.

Moment of surprise

The day after when I moved all my code to, to my surprise, I found there were over 110 downloads of the module, which was unbelievably insane. 


Few things that I worked on over the week: 

User Documentation

I worked on the user documentation on some basic information about the module and instructions for how to install and use the module.

Screencast for installing and using the module

Client Side File Crypto Module Screencast from Tameesh Biswas on Vimeo.


User hooks

One of the important functions of the module was to work with insertion or deletion of user keys when the user entities are created or modified.

User insert

Well implementing this was easy, just had to use the hook function hook_user_insert($account) {} and access the user entity using $account->id() as the ID and iterate over the roles of that user to form an array to insert into key requests table.

User alter

This was the one that I, at least thought initially, was going to be a bit trickier. Here the objective was to find the roles that the user has been removed from and the ones he was added to, in other words, the diff of the user roles. After some Googling, I figured Drupal won’t provide me with the relative changes made and rather just return the absolute current state of the user entity. To start off, as I had the user’s UID, I fetched all the roles that the user is enrolled in after the update using $user->getRoles(), stored it in an array and in a separate array, fetched the roles for which the keys are available. Fortunately, there is a function in PHP to find the diff between two arrays so that saved me a few loops, using this I obtained the diff in the roles and removed/inserted the key records from the database/content entity.

Improving the UX

There were several modifications that I made to the code for a better UX before deploying the code for testing and reviews to prevent any usability issues. Some of the things that I did were:

  • Displaying errors for when keys are not present or still not generated.

  • Removing the redirect the user after every login.

  • Displaying proper details and to wait for key generation upon key generation.

Logging out users after module install

How I implemented this before was by truncating the sessions database table but Adam pointed out that it wasn’t a good practice to do that so I looked up alternative methods to do the same and turns out there are inbuilt methods for the same like user_logout() but I went for a JS redirection to /user/logout.

Plans ahead

This week I will be working with completing the documentation for submission, working on other deliverables that would help end users of the module. 

After completing the requirements of submission guidelines, I will get back to implementing additional features on the module and do the translation from database schemas to content entities. For this week, we will also be peer-reviewing our modules and suggesting improvements on the same.

The wrap-up

I've had a great time over the summer, coding for Drupal, meeting dozens of really amazing like-minded people, been to several meet-ups and made a few great friends across the communities over the period of the last 4 months. It was great to be mentored by people of such high levels of expertise. Thanks Colan, AdamTalha and the whole Drupal community!

Recent content