When a form is set up so only custom role(s) can use it, anonymous users see "You do not have permission to view this form".
I think we should account for custom roles.
I ran into the same problem. Tested this and it works perfectly.
I'm sorry guys, I don't quite understand issue description. @pjcdawkins / @froboy, can one of you help me out here?
When anonymous users do not have access to something, they should be prompted to log in.
At the moment Webform only gives that prompt if the 'authenticated user' role has access. For Webforms restricted to custom roles, Webform shows this message to anonymous users: "You do not have permission to view this form". That's rather uninviting.
The patch in the OP gives the login prompt to anonymous users regardless of whether 'authenticated user' has access.
Yup. As an example, we have a form that we restrict to a custom role called "Student" but don't allow the generic "Authenticated User" to fill out.
Looks great to me. Thanks for the patch.
Automatically closed -- issue fixed for 2 weeks with no activity.
I didn't expect Webform to do this on its own, that's what modules such as Redirect 403 to Login exist for.
@barraponto but Webform doesn't issue a 403 - this is in cases where node access is granted but the webform is only available to authenticated users. Very useful for many cases, such as where you want to describe the form in the node body so that people might know that they want to use the form, or when you want a public View listing forms.
[edit: this isn't a redirect, simply a message with a link]
Drupal is a registered trademark of Dries Buytaert.