mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
parent
9cd419d330
commit
5ca0e981c4
@ -26,6 +26,32 @@ class DbUserGroupBackendForm extends Form
|
||||
*/
|
||||
public function createElements(array $formData)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'name',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => $this->translate('Backend Name'),
|
||||
'description' => $this->translate(
|
||||
'The name of this user group backend that is used to differentiate it from others'
|
||||
),
|
||||
'validators' => array(
|
||||
array(
|
||||
'Regex',
|
||||
false,
|
||||
array(
|
||||
'pattern' => '/^[^\\[\\]:]+$/',
|
||||
'messages' => array(
|
||||
'regexNotMatch' => $this->translate(
|
||||
'The name cannot contain \'[\', \']\' or \':\'.'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$resourceNames = $this->getDatabaseResourceNames();
|
||||
$this->addElement(
|
||||
'select',
|
||||
@ -37,6 +63,15 @@ class DbUserGroupBackendForm extends Form
|
||||
'multiOptions' => empty($resourceNames) ? array() : array_combine($resourceNames, $resourceNames)
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'hidden',
|
||||
'backend',
|
||||
array(
|
||||
'disabled' => true, // Prevents the element from being submitted, see #7717
|
||||
'value' => 'db'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,32 @@ class LdapUserGroupBackendForm extends Form
|
||||
*/
|
||||
public function createElements(array $formData)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'name',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => $this->translate('Backend Name'),
|
||||
'description' => $this->translate(
|
||||
'The name of this user group backend that is used to differentiate it from others'
|
||||
),
|
||||
'validators' => array(
|
||||
array(
|
||||
'Regex',
|
||||
false,
|
||||
array(
|
||||
'pattern' => '/^[^\\[\\]:]+$/',
|
||||
'messages' => array(
|
||||
'regexNotMatch' => $this->translate(
|
||||
'The name cannot contain \'[\', \']\' or \':\'.'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$resourceNames = $this->getLdapResourceNames();
|
||||
$this->addElement(
|
||||
'select',
|
||||
@ -89,6 +115,15 @@ class LdapUserGroupBackendForm extends Form
|
||||
|
||||
$this->createGroupConfigElements($defaults, $groupConfigDisabled);
|
||||
$this->createUserConfigElements($defaults, $userConfigDisabled, $dnDisabled);
|
||||
|
||||
$this->addElement(
|
||||
'hidden',
|
||||
'backend',
|
||||
array(
|
||||
'disabled' => true, // Prevents the element from being submitted, see #7717
|
||||
'value' => $formData['type']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,32 +158,6 @@ class UserGroupBackendForm extends ConfigForm
|
||||
*/
|
||||
public function createElements(array $formData)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'name',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => $this->translate('Backend Name'),
|
||||
'description' => $this->translate(
|
||||
'The name of this user group backend that is used to differentiate it from others'
|
||||
),
|
||||
'validators' => array(
|
||||
array(
|
||||
'Regex',
|
||||
false,
|
||||
array(
|
||||
'pattern' => '/^[^\\[\\]:]+$/',
|
||||
'messages' => array(
|
||||
'regexNotMatch' => $this->translate(
|
||||
'The name cannot contain \'[\', \']\' or \':\'.'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// TODO(jom): We did not think about how to configure custom group backends yet!
|
||||
$backendTypes = array(
|
||||
'db' => $this->translate('Database'),
|
||||
@ -196,15 +170,6 @@ class UserGroupBackendForm extends ConfigForm
|
||||
$backendType = key($backendTypes);
|
||||
}
|
||||
|
||||
$this->addElement(
|
||||
'hidden',
|
||||
'backend',
|
||||
array(
|
||||
'disabled' => true, // Prevents the element from being submitted, see #7717
|
||||
'value' => $backendType
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'type',
|
||||
|
@ -110,6 +110,7 @@ class UserGroupBackendPage extends Form
|
||||
$backendForm->create($formData);
|
||||
$userBackendOptions = $backendForm->getElement('user_backend')->getMultiOptions();
|
||||
unset($userBackendOptions['none']);
|
||||
$backendForm->getElement('name')->setValue('icingaweb2');
|
||||
$backendForm->getElement('user_backend')->setMultiOptions($userBackendOptions);
|
||||
$this->addSubForm($backendForm, 'backend_form');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user