Here's my setup: most recent versions of mailcomment and mailhandler. I want people to send a mail to "discuss@example.com" to start a thread, and when mail goes out the responses should be to "discuss@example.com" as well. So, the Mailhandler mailbox setting for discuss@example.com is to use mailcomment default authentication and the mailcomment setting is set to use "Passthru to mailhandler module."

The problem seems to be that when the message is passed through it tries to do a node_access test, but that returns false b/c the $node->uid is 0. I think that we need an option in "Passthru to mailhandler module" to select the mailhandler authentication mode to use.

I was able to get around this by calling mailhandler_authenticate_default right before the node is returned in mailcomment.module line 349 for the passthrough option.

Is there a better way of doing this? Should I provide a dropdown in the the Mailcomment "Passthrough" area to select the backup auth method?

Comments

Ian Ward’s picture

Greg, I see what you're saying. This is some regression. The default authentication method for MC uses mailhandler's tokenauth plugin. I thought about the idea of having authentication methods stackable on mailhandler mailboxes. You could choose one or more authentication methods, weight them, and they would get run if the previous fails. There'd need to be a failure flag. I was hesitant because it's an additional level of complexity in terms of user configuration, but seems straight-forward in terms of implementation. This would make it possible to strip out the hard-coded tokenauth fallback in the mailcomment authentication plugin. What do you think about this?

Ian Ward’s picture

StatusFileSize
new1.9 KB

On second thought, stackable authentication plugins is more complication than worth dealing w/ on the current mailhandler API. We could make this an additional setting in mailcomment that allows for using the default mailhandler authentication (email address verification). Basically what you're suggesting, Greg, but not giving the option to choose other methods. I'd like to get mailhandler running on ctools and use its plugin API and then look at doing the option of multiple, stackable authentication plugins per mailbox. What do you think of the attached patch?

greggles’s picture

Status: Active » Needs review

Your proposed patch in #2 seems pretty good to me and in my testing it works fine.

I'm not as sure whether it should be a "yes/no" radio button as now or a dropdown that follows the contents/behavior of "Message authentication method" from admin/content/mailhandler/edit/1

Ian Ward’s picture

StatusFileSize
new2.52 KB

It may as well just be a select list as you originally wrote. I've attached a patch.

greggles’s picture

Status: Needs review » Reviewed & tested by the community

Visually this looks great and in my testing (of the default Mailhandler auth method, nothing fancy) it works.

Ian Ward’s picture

Status: Reviewed & tested by the community » Fixed

Thanks again Greg, marking fixed.

Status: Fixed » Closed (fixed)

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