mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
parent
9cd419d330
commit
5ca0e981c4
@ -26,6 +26,32 @@ class DbUserGroupBackendForm extends Form
|
|||||||
*/
|
*/
|
||||||
public function createElements(array $formData)
|
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();
|
$resourceNames = $this->getDatabaseResourceNames();
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
@ -37,6 +63,15 @@ class DbUserGroupBackendForm extends Form
|
|||||||
'multiOptions' => empty($resourceNames) ? array() : array_combine($resourceNames, $resourceNames)
|
'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)
|
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();
|
$resourceNames = $this->getLdapResourceNames();
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
@ -89,6 +115,15 @@ class LdapUserGroupBackendForm extends Form
|
|||||||
|
|
||||||
$this->createGroupConfigElements($defaults, $groupConfigDisabled);
|
$this->createGroupConfigElements($defaults, $groupConfigDisabled);
|
||||||
$this->createUserConfigElements($defaults, $userConfigDisabled, $dnDisabled);
|
$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)
|
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!
|
// TODO(jom): We did not think about how to configure custom group backends yet!
|
||||||
$backendTypes = array(
|
$backendTypes = array(
|
||||||
'db' => $this->translate('Database'),
|
'db' => $this->translate('Database'),
|
||||||
@ -196,15 +170,6 @@ class UserGroupBackendForm extends ConfigForm
|
|||||||
$backendType = key($backendTypes);
|
$backendType = key($backendTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addElement(
|
|
||||||
'hidden',
|
|
||||||
'backend',
|
|
||||||
array(
|
|
||||||
'disabled' => true, // Prevents the element from being submitted, see #7717
|
|
||||||
'value' => $backendType
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'type',
|
'type',
|
||||||
|
@ -110,6 +110,7 @@ class UserGroupBackendPage extends Form
|
|||||||
$backendForm->create($formData);
|
$backendForm->create($formData);
|
||||||
$userBackendOptions = $backendForm->getElement('user_backend')->getMultiOptions();
|
$userBackendOptions = $backendForm->getElement('user_backend')->getMultiOptions();
|
||||||
unset($userBackendOptions['none']);
|
unset($userBackendOptions['none']);
|
||||||
|
$backendForm->getElement('name')->setValue('icingaweb2');
|
||||||
$backendForm->getElement('user_backend')->setMultiOptions($userBackendOptions);
|
$backendForm->getElement('user_backend')->setMultiOptions($userBackendOptions);
|
||||||
$this->addSubForm($backendForm, 'backend_form');
|
$this->addSubForm($backendForm, 'backend_form');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user