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.

Patch attached.

Members fund testing for the Drupal project. Drupal Association Learn more


pjcdawkins’s picture

Status: Active » Needs review
froboy’s picture

Status: Needs review » Reviewed & tested by the community

I ran into the same problem. Tested this and it works perfectly.

carwin’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

I'm sorry guys, I don't quite understand issue description. @pjcdawkins / @froboy, can one of you help me out here?

pjcdawkins’s picture

Title: Confusing "You do not have permission to view this form" shown to anonymous users » Anonymous users are not prompted to log in when only custom roles can use a webform

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.

froboy’s picture

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.

carwin’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks great to me. Thanks for the patch.

Status: Fixed » Closed (fixed)

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

barraponto’s picture

I didn't expect Webform to do this on its own, that's what modules such as Redirect 403 to Login exist for.

pjcdawkins’s picture

@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]