// share the document with the contributor
String userId = ConversationState.getCurrent().getIdentity().getUserId();
User user = organizationService.getUserHandler().findUserByName(userId);
if(user == null) {
throw new GoogleDocsException("UIActionBar.msg.googledocs.user-not-found", "User " + userId + " not found");
}
String userEmail = user.getEmail();
if(userEmail == null || userEmail.isEmpty()) {
throw new GoogleDocsException("UIActionBar.msg.googledocs.no-user-email", "Email of user " + userId + " is empty");
}
googleDriveService.shareFileWith(googleDriveFileID, userEmail);
event.getRequestContext().getJavascriptManager().addCustomizedOnLoadScript("ajaxRedirect('" + googleDriveFile.getAlternateLink() + "');");