moved host naming convention checks to Samba module
This commit is contained in:
parent
d85007120b
commit
bbb66734fe
|
@ -76,7 +76,7 @@ class posixAccount extends baseModule {
|
||||||
$this->messages['uid'][1] = array('WARN', _('User name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.'));
|
$this->messages['uid'][1] = array('WARN', _('User name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.'));
|
||||||
$this->messages['uid'][2] = array('ERROR', _('User name'), _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
|
$this->messages['uid'][2] = array('ERROR', _('User name'), _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
|
||||||
$this->messages['uid'][3] = array('WARN', _('Host name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.'));
|
$this->messages['uid'][3] = array('WARN', _('Host name'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.'));
|
||||||
$this->messages['uid'][4] = array('ERROR', _('Host name'), _('Host name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ ! Host name must end with $ !'));
|
$this->messages['uid'][4] = array('ERROR', _('Host name'), _('Host name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
|
||||||
$this->messages['uid'][5] = array('WARN', _('User name'), _('User name in use. Selected next free user name.'));
|
$this->messages['uid'][5] = array('WARN', _('User name'), _('User name in use. Selected next free user name.'));
|
||||||
$this->messages['uid'][6] = array('WARN', _('Host name'), _('Host name in use. Selected next free host name.'));
|
$this->messages['uid'][6] = array('WARN', _('Host name'), _('Host name in use. Selected next free host name.'));
|
||||||
$this->messages['uid'][7] = array('ERROR', _('Account %s:') . ' posixAccount_userName', _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
|
$this->messages['uid'][7] = array('ERROR', _('Account %s:') . ' posixAccount_userName', _('User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
|
||||||
|
@ -337,7 +337,7 @@ class posixAccount extends baseModule {
|
||||||
),
|
),
|
||||||
'minMaxHost' => array(
|
'minMaxHost' => array(
|
||||||
'Headline' => _('UID number'),
|
'Headline' => _('UID number'),
|
||||||
'Text' => _('These are the minimum and maximum numbers to use for machine IDs when creating new accounts for Samba hosts. The range should be different from that of users. New host accounts will always get the highest number in use plus one.')
|
'Text' => _('These are the minimum and maximum numbers to use for machine IDs when creating new accounts for hosts. The range should be different from that of users. New host accounts will always get the highest number in use plus one.')
|
||||||
),
|
),
|
||||||
'pwdHash' => array(
|
'pwdHash' => array(
|
||||||
"Headline" => _("Password hash type"),
|
"Headline" => _("Password hash type"),
|
||||||
|
@ -790,11 +790,6 @@ class posixAccount extends baseModule {
|
||||||
$errors[] = $this->messages['uid'][2];
|
$errors[] = $this->messages['uid'][2];
|
||||||
}
|
}
|
||||||
if ($this->get_scope()=='host') {
|
if ($this->get_scope()=='host') {
|
||||||
// add "$" to uid if needed
|
|
||||||
if (substr($this->attributes['uid'][0], -1, 1) != '$') {
|
|
||||||
$this->attributes['uid'][0] .= '$';
|
|
||||||
$_POST['uid'] .= '$';
|
|
||||||
}
|
|
||||||
// Check if Hostname contains only valid characters
|
// Check if Hostname contains only valid characters
|
||||||
if ( !get_preg($this->attributes['uid'][0], 'hostname'))
|
if ( !get_preg($this->attributes['uid'][0], 'hostname'))
|
||||||
$errors[] = $this->messages['uid'][4];
|
$errors[] = $this->messages['uid'][4];
|
||||||
|
|
|
@ -126,10 +126,6 @@ class sambaSamAccount extends baseModule {
|
||||||
$return['icon'] = 'samba.png';
|
$return['icon'] = 'samba.png';
|
||||||
// manages user and host accounts
|
// manages user and host accounts
|
||||||
$return["account_types"] = array("user", "host");
|
$return["account_types"] = array("user", "host");
|
||||||
if ($this->get_scope() == "host") {
|
|
||||||
// LDAP filter
|
|
||||||
$return["ldap_filter"] = array('and' => '(uid=*$)', 'or' => "(objectClass=posixAccount)");
|
|
||||||
}
|
|
||||||
// alias name
|
// alias name
|
||||||
$return["alias"] = _('Samba 3');
|
$return["alias"] = _('Samba 3');
|
||||||
// RDN attribute
|
// RDN attribute
|
||||||
|
@ -561,6 +557,27 @@ class sambaSamAccount extends baseModule {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is used to check if all settings for this module have been made.
|
||||||
|
*
|
||||||
|
* @see baseModule::module_complete
|
||||||
|
*
|
||||||
|
* @return boolean true, if settings are complete
|
||||||
|
*/
|
||||||
|
public function module_complete() {
|
||||||
|
if (!in_array('sambaSamAccount', $this->attributes['objectClass'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ($this->get_scope() == "host") {
|
||||||
|
$attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
||||||
|
if (substr($attrs['uid'][0], -1, 1) != '$') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function loads the LDAP attributes for this module.
|
* This function loads the LDAP attributes for this module.
|
||||||
*
|
*
|
||||||
|
@ -947,6 +964,12 @@ class sambaSamAccount extends baseModule {
|
||||||
}
|
}
|
||||||
$return = array();
|
$return = array();
|
||||||
if (in_array('sambaSamAccount', $this->attributes['objectClass'])) {
|
if (in_array('sambaSamAccount', $this->attributes['objectClass'])) {
|
||||||
|
if ($this->get_scope() == "host") {
|
||||||
|
$attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
||||||
|
if (substr($attrs['uid'][0], -1, 1) != '$') {
|
||||||
|
StatusMessage("ERROR", _('Host name must end with $!'), _('Please check your settings on the Unix page!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
// Get Domain SID from user SID
|
// Get Domain SID from user SID
|
||||||
$sambaDomains = search_domains();
|
$sambaDomains = search_domains();
|
||||||
if (sizeof($sambaDomains) == 0) {
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue