Mailman Integration
This module allows Drupal Administrator to create, subscribe and unsubscribe a Mailing List from Drupal.

Requirements
* Access to Mailman
* You need to have the Mailman URL and Mailman site password

Features
The primary features include:

* Administrator to manually create a new Mailing List from Drupal.
* Administrator can subscribe/subscribe a Mailing List for users from Mailman Integration module admin page.
* Administrator can create a role based Mailing List from Drupal.
* When a Member is assigned this new Role, the Member should automatically become part of the corresponding Mailing List.
* When a Member is removed from a particular Role, the Member should be removed from the corresponding Mailing List as well.
* When a Role is removed from Drupal, the corresponding Mailing List, if any, should be removed from Mailman.
* User can subscribe/unsubscribe a mailing list from my profile if admin check the User can Subscribe option in the mailing lists.
* When the Cron runs all the mailman lists migrated into Drupal.

Installation
1. Copy the mailman_integration folder to your module directory.
2. At Administer -> Modules (admin/modules) enable the module.
3. Configure the module settings at Administer -> Configuration -> User Interface -> Mailman Integration (admin/config/user-interface/mailman-integration).
4. Mailman Integration module page link at Administer -> Configuration -> System -> Mailman Mailing Lists (admin/config/system/mailman_integration/list).

Sandbox project page link:
https://www.drupal.org/sandbox/gaja_daran/2530690

Differences from similar projects:
This module can create a two types of lists, Manual and Role based. Mailman List creation and subscription reflected instantly into Mailman, the GNU Mailing List. Automated mailman sync-up

1. https://www.drupal.org/project/mailman_manager - Administrator can create a role based Mailing List from Drupal. When a Member is assigned this new Role, the Member should automatically become part of the corresponding Mailing List.

2. https://www.drupal.org/project/user_mailman_register - Admin can set a subscribe option for user and user can subscribe/unsubscribe a mailing list from my profile. Automated mailman sync-up.
When a Role is removed from Drupal, the corresponding role based Mailing List, if any, removed from Mailman instantly

3. https://www.drupal.org/project/mlist - This module provides simple subscribe/unsubscribe functionality for mailing lists running on a Mailman. Supporting View for getting Mail List and Subscription list.

Pareview results:
http://pareview.sh/pareview/httpgitdrupalorgsandboxgajadaran2530690git

To clone the project:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/gaja_daran/2530690.git mailman_integration
cd mailman_integration

Manual Reviews of other projects
https://www.drupal.org/node/2560621#comment-10291559
https://www.drupal.org/node/2543346#comment-10179170
https://www.drupal.org/node/2541320#comment-10179324
https://www.drupal.org/node/2511268#comment-10179372
https://www.drupal.org/node/2544180#comment-10179544
https://www.drupal.org/node/2544524#comment-10191696
https://www.drupal.org/node/2536654#comment-10194641
https://www.drupal.org/node/2522102#comment-10194887
https://www.drupal.org/node/2548683#comment-10203313
https://www.drupal.org/node/2554797#comment-10244321
https://www.drupal.org/node/2558421#comment-10270761
https://www.drupal.org/node/2564055#comment-10397765
https://www.drupal.org/node/2593331#comment-10462427

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

gaja_daran’s picture

Issue summary: View changes
falc0’s picture

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Followsthe guidelines for 3rd party assets/code.
README.txt/README.md
No: Does not follow the guidelines for in-project documentation and/or the README Template.
There is no hook_help().
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Coding style & Drupal API usage
  1. (*) You don't need to explicitly uninstall your database schema. install-schema
  2. mailman_integration.module:30:
        'template path' => drupal_get_path('module', 'mailman_integration') . '/views',
    

    no need to implement template path when you don't use templates

  3. mailman_integration.module:38:
    /**
     * Implements hook_init().
     */
    function mailman_integration_init() {
      module_load_include('inc', 'mailman_integration', 'mailman_integration_admin');
    }
    

    I don't think it's a good idea to add this in a hook_init. I think it's better to add it only where you need it because hook_init gets called for every page.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

falc0’s picture

Status: Needs review » Needs work
gaja_daran’s picture

Hi falc0,

Thanks for your comment.

I have removed following items from your valuable feedback.
1. drupal_uninstall_schema
2. template path in hook_views_api
3. module_load_includ in hook_init.

And also added the hook_help and necessary changes in readme file.

gaja_daran’s picture

Status: Needs work » Needs review
FileSize
41.32 KB
gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Issue tags: +PAreview: review bonus
Vignesh Puliyadi Raja’s picture

My review:

Manual Reviews:

When I create a role based mailman list, I am getting warning : array_flip().

Warning: array_flip(): Can only flip STRING and INTEGER values! in mailman_integration_add_rolelist_form_validate() (line 619 of /var/www/vigneshpr/sites/all/modules/mailman_integration/mailman_integration_admin.inc).

Need to be fix this issue.

Vignesh Puliyadi Raja’s picture

Status: Needs review » Needs work
gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Hi vigneshpr87,

Thanks for you review and your suggestion.

I have fix the array_flip warning. Kindly review again.

Thanks.

gaja_daran’s picture

Status: Needs work » Needs review
gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Issue summary: View changes
Sudhakar Dhanapalan’s picture

Status: Needs review » Needs work

Manual Reviews:

mailmanMakeCurlCall(), why cURL is using here instead of drupal_http_request()?

mailman_integration.inc - > line no 155 : curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

verifyhost should always be 2

This is a security problem and is the blocking issue in this application.

Need to be address this issue.

gaja_daran’s picture

Status: Needs work » Needs review

Hi Sudhakar Dhanapalan,

Thanks for your valuable feedback.

I have changed the curl function into drupal http header. Kindly review again.

Thanks.

gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Issue summary: View changes
klausi’s picture

Assigned: Unassigned » Manjit.Singh
Status: Needs review » Needs work
Issue tags: +PAreview: security

Git errors:

Review of the 7.x-1.x branch (commit 6c64fe9):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/mailman_integration.inc
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     150 | ERROR | [x] Whitespace found at end of line
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /home/klausi/pareview_temp/mailman_integration_admin.inc
    ---------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------
      611 | WARNING | Do not concatenate strings to translatable strings, they
          |         | should be part of the t() argument and you should use
          |         | placeholders
      876 | WARNING | Do not concatenate strings to translatable strings, they
          |         | should be part of the t() argument and you should use
          |         | placeholders
     1022 | WARNING | Do not concatenate strings to translatable strings, they
          |         | should be part of the t() argument and you should use
          |         | placeholders
    ---------------------------------------------------------------------------
    
  • DrupalPractice has found some issues with your code, but could be false positives.
    
    FILE: /home/klausi/pareview_temp/mailman_integration.inc
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     135 | WARNING | Unused variable $return_transfer.
     136 | WARNING | Unused variable $custom_request.
    ----------------------------------------------------------------------
    
  • Codespell has found some spelling errors in your code.
    ./mailman_integration.module:61: Dont  ==> Don't
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. project page: what are the differences to the 5 already existing mailman modules? https://www.drupal.org/project/mailman https://www.drupal.org/project/mailman_manager https://www.drupal.org/project/user_mailman_register https://www.drupal.org/project/mailman_groups https://www.drupal.org/project/mlist ? Please add that to the project page. Module duplication and fragmentation is a huge problem on drupal.org and we prefer collaboration over competition. Please improve an existing project on drupal.org instead if creating yet another new one.
  2. mailman_integration_cron(): why do you check the mailman connection on every cron run? So this will run every 5 minutes on my site, what for? Please add a comment.
  3. mailman_integration_form_alter(): if you ar eonly targeting one specific form ID then you should use hook_form_FORM_ID_alter() instead.
  4. mailman_integration_form_alter(): why do you need to store this in the session? Please add a comment. hook_user_role_delete() is invoked for every role anyway, so you have the role ID available there?
  5. mailman_integration_404_page(): why do you need this function and cannot use drupal_not_found()? Please add a comment.
  6. mailman_integration_list_page_callback(): this function can be removed if you use "drupal_get_form" as page callback directly in hook_menu(). See https://api.drupal.org/api/drupal/modules!system!system.api.php/function...
  7. This module has a security vulnerability and as part of our git admin training I'm assigning this to Manjit so that he can take a look. If he does not find anything within a week I'm going to post the vulnerability details. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.
gaja_daran’s picture

Issue summary: View changes
Status: Needs work » Needs review

Hi klausi,

Thanks for your valuable review and your feedback.

My comments about your feedback:

Git errors:
Git default branch is set.

PAReview:
Fixed

Manual Review:
1. Added Project features and differences from existing module in project page
This two modules not relevant to drupal 7
https://www.drupal.org/project/mailman_groups - Drupal 6
https://www.drupal.org/project/mailman - Drupal 4

2. Cron is for Mailman List sync-up. I have added a configuration for if auto sync cron is needed or not. If enabled, then only mail list sync-up cron is running.

3. Changed hook_form_alter into hook_form_FORM_ID_alter, because it's targeting only one form.

4. Yes, Needed. Every role deletes, want to remove the deleting role based mail list and subscription, if any.

5. Replaced drupal_not_found() function.

6. Removed mailman_integration_list_page_callback function and get it from drupal_get_form.

gaja_daran’s picture

Issue summary: View changes
klausi’s picture

Assigned: Manjit.Singh » Unassigned
Status: Needs review » Needs work

Since Manjit didin't get to it - now revealing the security vulernability:

mailman_integration_search_list_form() is vulnerable to XSS exploits. The list description is printed unsanitized to HTML in the table. If I enter <script>alert('XSS');</script> as list description I can trigger a nasty javascript popup on the page. You need to sanitize user provided text before printing, make sure to read https://www.drupal.org/node/28984 again.

gaja_daran’s picture

Status: Needs work » Needs review

Hi Klausi,
Thanks for finding the major issue. It's very helpful for improve this project.
Issue fixed.

Thanks.

klausi’s picture

Status: Needs review » Needs work

manual review:

  1. "Code Review Changes" is not a useful git commit message. You should describe what you did, see https://www.drupal.org/node/52287
  2. Warning: Missing argument 1 for mailman_integration_add_user_callback() in mailman_integration_add_user_callback() (line 953 of mailman_integration/mailman_integration_admin.inc). I think you forgot the "%" placeholder in hook_menu() for this?
  3. mailman_integration_subscribe_user_form_validate(): this is vulnerable to XSS exploits. "form_set_error('list_mail_address', $mail . ' - ' . t('Email address appears to be invalid.'));" is not using safe placeholders with t(), thereby printing arbitrary user input to HTML.
  4. mailman_integration_list_users(): don't call theme() here, just return the nested render array. Drupal core will render later for you, see https://www.drupal.org/node/930760
gaja_daran’s picture

Status: Needs work » Needs review

Hi klausi,

Thank you so much once again. You are amazing.
Issue Fixed.
1. Follow git commit
2. Added % in hook_menu
3. t() function using properly
4. Return the render array.
Earlier, I am followed this page for getting pager https://www.drupal.org/node/1365736.

Thanks.

gaja_daran’s picture

Issue summary: View changes
klausi’s picture

Status: Needs review » Needs work

Review of the 7.x-1.x branch (commit 3c2bf5b):

  • Codespell has found some spelling errors in your code.
    ./mailman_integration.module:61: Dont  ==> Don't
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  • mailman_integration_admin.inc: still contains "form_set_error('list_mail_address', $mail . ' - ' . t('Email address appears to be invalid.'));" where you use t() wrong and print an email address unsanitized. Please check all your t() calls.
gaja_daran’s picture

Status: Needs work » Needs review

Hi klausi,

This is my great mistake. I am forgot to move this code. You have already mentioned this.
Thanks a lot.

gaja_daran’s picture

Issue summary: View changes
gaja_daran’s picture

Priority: Normal » Major
klausi’s picture

Assigned: Unassigned » er.pushpinderrana
Status: Needs review » Reviewed & tested by the community

Looks good to me now, assigning to er.pushpinderrana as he might have time to take a final look at this.

gaja_daran’s picture

Thanks a lot Klausi.

er.pushpinderrana’s picture

Assigned: er.pushpinderrana » Unassigned
Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. None

Review of the 7.x-1.x branch (commit 90d9a87):

  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

Manual Review

mailman_integration_list_users_submit(): Using drupal_goto() in a form submission handler() is hacky, and it should be avoided, since it stops the other form submission handlers from being called.. See http://drupal.stackexchange.com/questions/94578/drupal-goto-usage

mailman_integration_select_list_data(): why do you call check_plain() here, if I understand correctly entity_id always hold integer value so no XSS danger? Same for mailman_integration_select_list_roles() for role_id.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

Nothing major jumped out to me as it's already set to RTBC so....

Thanks for your contribution, Selva Gajendran!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

gaja_daran’s picture

Thanks you so much Pushpinderrana .

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.