role/audit: Pre-populate backend name with the first one found

Otherwise a user who doesn't use a suggestion will see an error.
This commit is contained in:
Johannes Meyer 2021-04-07 15:10:01 +02:00
parent 5b970c79ad
commit d49962ac82
1 changed files with 9 additions and 2 deletions

View File

@ -151,8 +151,15 @@ class RoleController extends AuthBackendController
$name = $this->params->get($type);
$backend = null;
if ($name && $type === 'user') {
$backend = $this->params->getRequired('backend');
if ($type === 'user') {
if ($name) {
$backend = $this->params->getRequired('backend');
} else {
$backends = $this->loadUserBackends();
if (! empty($backends)) {
$backend = array_shift($backends)->getName();
}
}
}
$form = new SingleValueSearchControl();