code: function getUserGroups(user) {
    var groups = {};
  
    if (user && user.permissions) {
      user.permissions.forEach(function(permission) {
        var reg = new RegExp('^(get|update|delete)-group-(.+)$');
        var permissionChunks = reg.exec(permission);
        if (permissionChunks) {
          var operation = permissionChunks[1];
          var groupId = permissionChunks[2];
  
          if (!groups[groupId])
            groups[groupId] = [];
  
          groups[groupId].push(operation);
        }
      });
    }
  
    return groups;
  }
docs: Gets user permissions by groups.
  
  @example
  
  // Example of user permissions
  ['get-group-Jekrn20Rl', 'update-group-Jekrn20Rl', 'delete-group-YldO3Jie3']
  
  // Example of returned groups
  {
  'Jekrn20Rl': ['get', 'update'], // User only has get / update permissions on group 'Jekrn20Rl'
  'YldO3Jie3': ['delete'], // User only has delete permission on group 'YldO3Jie3'
  ...
  }
  
  @method getUserGroups
  @private
  @param {Object} user The user to extract groups from
  @return {Object} Groups organized by ids