Score:0

Can I set default access settings?

mx flag

The Webform module defaults to allowing anonymous and authenticated users to submit a form.

The vast majority of the webforms we use are for internal staff that have a particular Drupal role.

Is there a setting for defaulting to a particular role/roles when creating a new form? There seems to be for everything else.

We are using Drupal 9.5.x and Webform 6.1.x.

id flag
Based on https://www.drupal.org/project/webform/issues/2875833 it is likely someone here has to invent a way.
Score:3
cn flag

Looking at webform.api.php there is a specific hook for that:

/**
 * Implements hook_webform_access_rules_alter().
 */
function mymodule_webform_access_rules_alter(array &$access_rules) {
  if (isset($access_rules['create'])) {
    $access_rules['create']['roles'] = ['editor', 'moderator'];
  }
}
ChumKui avatar
mx flag
Many thanks - so the solution to this would be to write a module. OK, one for the backlog...!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.