role/audit: Require a backend name for user audits
This commit is contained in:
parent
f4da973f68
commit
8ff88cd6f1
|
@ -141,9 +141,14 @@ class RoleController extends AuthBackendController
|
||||||
$type = $this->params->has('group') ? 'group' : 'user';
|
$type = $this->params->has('group') ? 'group' : 'user';
|
||||||
$name = $this->params->get($type);
|
$name = $this->params->get($type);
|
||||||
|
|
||||||
|
$backend = null;
|
||||||
|
if ($name && $type === 'user') {
|
||||||
|
$backend = $this->params->getRequired('backend');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new SingleValueSearchControl();
|
$form = new SingleValueSearchControl();
|
||||||
$form->setMetaDataNames('type');
|
$form->setMetaDataNames('type', 'backend');
|
||||||
$form->populate(['q' => $name, 'q-type' => $type]);
|
$form->populate(['q' => $name, 'q-type' => $type, 'q-backend' => $backend]);
|
||||||
$form->setInputLabel(t('Enter user or group name'));
|
$form->setInputLabel(t('Enter user or group name'));
|
||||||
$form->setSubmitLabel(t('Inspect'));
|
$form->setSubmitLabel(t('Inspect'));
|
||||||
$form->setSuggestionUrl(Url::fromPath(
|
$form->setSuggestionUrl(Url::fromPath(
|
||||||
|
@ -152,9 +157,14 @@ class RoleController extends AuthBackendController
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->on(SingleValueSearchControl::ON_SUCCESS, function ($form) {
|
$form->on(SingleValueSearchControl::ON_SUCCESS, function ($form) {
|
||||||
$this->redirectNow(Url::fromPath('role/audit', [
|
$type = $form->getValue('q-type') ?: 'user';
|
||||||
$form->getValue('q-type') ?: 'user' => $form->getValue('q')
|
$params = [$type => $form->getValue('q')];
|
||||||
]));
|
|
||||||
|
if ($type === 'user') {
|
||||||
|
$params['backend'] = $form->getValue('q-backend');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->redirectNow(Url::fromPath('role/audit', $params));
|
||||||
})->handleRequest(ServerRequest::fromGlobals());
|
})->handleRequest(ServerRequest::fromGlobals());
|
||||||
|
|
||||||
$this->content->add($form);
|
$this->content->add($form);
|
||||||
|
@ -185,7 +195,10 @@ class RoleController extends AuthBackendController
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($names as $name) {
|
foreach ($names as $name) {
|
||||||
$users[$name] = ['type' => 'user'];
|
$users[$name] = [
|
||||||
|
'type' => 'user',
|
||||||
|
'backend' => $backend->getName()
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit -= count($names);
|
$limit -= count($names);
|
||||||
|
|
Loading…
Reference in New Issue