support AstAccountType attribute
This commit is contained in:
parent
fb340d8fd8
commit
a162f9f654
|
@ -2,6 +2,7 @@ April 2011 3.4.0
|
||||||
- IMAP mailboxes: support to read user name from uid attribute
|
- IMAP mailboxes: support to read user name from uid attribute
|
||||||
- Personal: added additional options for account profiles
|
- Personal: added additional options for account profiles
|
||||||
- Mail aliases: sort receipients (RFE 3170336)
|
- Mail aliases: sort receipients (RFE 3170336)
|
||||||
|
- Asterisk: support AstAccountType attribute
|
||||||
- LAM Pro:
|
- LAM Pro:
|
||||||
-> support automount entries
|
-> support automount entries
|
||||||
-> Zarafa groups: allow combination with group of names
|
-> Zarafa groups: allow combination with group of names
|
||||||
|
|
|
@ -70,7 +70,7 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$return['objectClasses'] = array('AsteriskSIPUser');
|
$return['objectClasses'] = array('AsteriskSIPUser');
|
||||||
// managed attributes
|
// managed attributes
|
||||||
$return['attributes'] = array('AstAccountCallerID', 'AstAccountHost',
|
$return['attributes'] = array('AstAccountCallerID', 'AstAccountHost',
|
||||||
'AstAccountRealmedPassword', 'AstAccountContext');
|
'AstAccountRealmedPassword', 'AstAccountContext', 'AstAccountType');
|
||||||
// icon
|
// icon
|
||||||
$return['icon'] = 'asterisk.png';
|
$return['icon'] = 'asterisk.png';
|
||||||
// self service
|
// self service
|
||||||
|
@ -95,6 +95,10 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
"Headline" => _("Password"),
|
"Headline" => _("Password"),
|
||||||
"Text" => _("Please enter the password which you want to set for this account.")
|
"Text" => _("Please enter the password which you want to set for this account.")
|
||||||
),
|
),
|
||||||
|
'AstAccountType' => array(
|
||||||
|
"Headline" => _("Account type"),
|
||||||
|
"Text" => _("Please enter the account's type (e.g. \"friend\").")
|
||||||
|
),
|
||||||
'AsteriskRealm' => array(
|
'AsteriskRealm' => array(
|
||||||
"Headline" => _("Asterisk realm"),
|
"Headline" => _("Asterisk realm"),
|
||||||
"Text" => _("Authentication realm for Asterisk server (default: asterisk). This value set in sip.conf (option: \"realm\").")
|
"Text" => _("Authentication realm for Asterisk server (default: asterisk). This value set in sip.conf (option: \"realm\").")
|
||||||
|
@ -112,17 +116,20 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$profileContainer = new htmlTable();
|
$profileContainer = new htmlTable();
|
||||||
$profileContainer->addElement(new htmlTableExtendedInputField(_('Host'), 'asteriskAccount_AstAccountHost', null, 'AstAccountHost'), true);
|
$profileContainer->addElement(new htmlTableExtendedInputField(_('Host'), 'asteriskAccount_AstAccountHost', null, 'AstAccountHost'), true);
|
||||||
$profileContainer->addElement(new htmlTableExtendedInputField(_('Account context'), 'asteriskAccount_AstAccountContext', null, 'AstAccountContext'), true);
|
$profileContainer->addElement(new htmlTableExtendedInputField(_('Account context'), 'asteriskAccount_AstAccountContext', null, 'AstAccountContext'), true);
|
||||||
|
$profileContainer->addElement(new htmlTableExtendedInputField(_('Account type'), 'asteriskAccount_AstAccountType', null, 'AstAccountType'), true);
|
||||||
$return['profile_options'] = $profileContainer;
|
$return['profile_options'] = $profileContainer;
|
||||||
// profile mappings
|
// profile mappings
|
||||||
$return['profile_mappings'] = array(
|
$return['profile_mappings'] = array(
|
||||||
'asteriskAccount_AstAccountHost' => 'AstAccountHost',
|
'asteriskAccount_AstAccountHost' => 'AstAccountHost',
|
||||||
'asteriskAccount_AstAccountContext' => 'AstAccountContext'
|
'asteriskAccount_AstAccountContext' => 'AstAccountContext',
|
||||||
|
'asteriskAccount_AstAccountType' => 'AstAccountType',
|
||||||
);
|
);
|
||||||
// available PDF fields
|
// available PDF fields
|
||||||
$return['PDF_fields'] = array(
|
$return['PDF_fields'] = array(
|
||||||
'AstAccountCallerID' => _('Caller ID'),
|
'AstAccountCallerID' => _('Caller ID'),
|
||||||
'AstAccountContext' => _('Account context'),
|
'AstAccountContext' => _('Account context'),
|
||||||
'AstAccountHost' => _('Host'),
|
'AstAccountHost' => _('Host'),
|
||||||
|
'AstAccountType' => _('Account type'),
|
||||||
);
|
);
|
||||||
// upload dependencies
|
// upload dependencies
|
||||||
$return['upload_preDepends'] = array('posixAccount', 'inetOrgPerson');
|
$return['upload_preDepends'] = array('posixAccount', 'inetOrgPerson');
|
||||||
|
@ -155,6 +162,13 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
'help' => 'AstAccountRealmedPassword',
|
'help' => 'AstAccountRealmedPassword',
|
||||||
'example' => _('secret'),
|
'example' => _('secret'),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'asteriskAccount_AstAccountType',
|
||||||
|
'description' => _('Account type'),
|
||||||
|
'help' => 'AstAccountType',
|
||||||
|
'example' => 'friend',
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +187,9 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$this->messages['AstAccountHost'][0] = array('ERROR', _('Please enter the host name.'));
|
$this->messages['AstAccountHost'][0] = array('ERROR', _('Please enter the host name.'));
|
||||||
$this->messages['AstAccountHost'][1] = array('ERROR', _('The host name is invalid.'));
|
$this->messages['AstAccountHost'][1] = array('ERROR', _('The host name is invalid.'));
|
||||||
$this->messages['AstAccountHost'][2] = array('ERROR', _('Account %s:') . ' asteriskAccount_AstAccountHost', _('The host name is invalid.'));
|
$this->messages['AstAccountHost'][2] = array('ERROR', _('Account %s:') . ' asteriskAccount_AstAccountHost', _('The host name is invalid.'));
|
||||||
|
$this->messages['AstAccountType'][0] = array('ERROR', _('Please enter the account type.'));
|
||||||
|
$this->messages['AstAccountType'][1] = array('ERROR', _('The account type is invalid.'));
|
||||||
|
$this->messages['AstAccountType'][2] = array('ERROR', _('Account %s:') . ' asteriskAccount_AstAccountType', _('The account type is invalid.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,6 +228,14 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$contextInput = new htmlTableExtendedInputField(_("Account context"), 'AstAccountContext', $context, 'AstAccountContext');
|
$contextInput = new htmlTableExtendedInputField(_("Account context"), 'AstAccountContext', $context, 'AstAccountContext');
|
||||||
$contextInput->setRequired(true);
|
$contextInput->setRequired(true);
|
||||||
$return->addElement($contextInput, true);
|
$return->addElement($contextInput, true);
|
||||||
|
// account type
|
||||||
|
$accountType = '';
|
||||||
|
if (isset($this->attributes['AstAccountType'][0])) {
|
||||||
|
$accountType = $this->attributes['AstAccountType'][0];
|
||||||
|
}
|
||||||
|
$accountTypeInput = new htmlTableExtendedInputField(_("Account type"), 'AstAccountType', $accountType, 'AstAccountType');
|
||||||
|
$accountTypeInput->setRequired(true);
|
||||||
|
$return->addElement($accountTypeInput, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return->addElement(new htmlButton('addObjectClass', _('Add Asterisk account')));
|
$return->addElement(new htmlButton('addObjectClass', _('Add Asterisk account')));
|
||||||
|
@ -229,6 +254,7 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$this->attributes['AstAccountCallerID'] = array();
|
$this->attributes['AstAccountCallerID'] = array();
|
||||||
$this->attributes['AstAccountHost'] = array();
|
$this->attributes['AstAccountHost'] = array();
|
||||||
$this->attributes['AstAccountContext'] = array();
|
$this->attributes['AstAccountContext'] = array();
|
||||||
|
$this->attributes['AstAccountType'] = array();
|
||||||
if (isset($_POST['AstAccountCallerID'])) {
|
if (isset($_POST['AstAccountCallerID'])) {
|
||||||
$this->attributes['AstAccountCallerID'][0] = $_POST['AstAccountCallerID'];
|
$this->attributes['AstAccountCallerID'][0] = $_POST['AstAccountCallerID'];
|
||||||
// check if caller ID is empty
|
// check if caller ID is empty
|
||||||
|
@ -265,6 +291,15 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$errors[] = $this->messages['AstAccountContext'][1];
|
$errors[] = $this->messages['AstAccountContext'][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['AstAccountType'])) {
|
||||||
|
$this->attributes['AstAccountType'][0] = $_POST['AstAccountType'];
|
||||||
|
if($this->attributes['AstAccountType'][0] == '') {
|
||||||
|
$errors[] = $this->messages['AstAccountType'][0];
|
||||||
|
}
|
||||||
|
elseif (!get_preg($this->attributes['AstAccountType'][0], 'username')) {
|
||||||
|
$errors[] = $this->messages['AstAccountType'][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,6 +329,7 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
$return[get_class($this) . '_AstAccountCallerID'] = array('<block><key>' . _('Caller ID') . '</key><value>' . $this->attributes['AstAccountCallerID'][0] . '</value></block>');
|
$return[get_class($this) . '_AstAccountCallerID'] = array('<block><key>' . _('Caller ID') . '</key><value>' . $this->attributes['AstAccountCallerID'][0] . '</value></block>');
|
||||||
$return[get_class($this) . '_AstAccountContext'] = array('<block><key>' . _('Account context') . '</key><value>' . $this->attributes['AstAccountContext'][0] . '</value></block>');
|
$return[get_class($this) . '_AstAccountContext'] = array('<block><key>' . _('Account context') . '</key><value>' . $this->attributes['AstAccountContext'][0] . '</value></block>');
|
||||||
$return[get_class($this) . '_AstAccountHost'] = array('<block><key>' . _('Host') . '</key><value>' . $this->attributes['AstAccountHost'][0] . '</value></block>');
|
$return[get_class($this) . '_AstAccountHost'] = array('<block><key>' . _('Host') . '</key><value>' . $this->attributes['AstAccountHost'][0] . '</value></block>');
|
||||||
|
$return[get_class($this) . '_AstAccountType'] = array('<block><key>' . _('Account type') . '</key><value>' . $this->attributes['AstAccountType'][0] . '</value></block>');
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +378,15 @@ class asteriskAccount extends baseModule implements passwordService {
|
||||||
array_push($errMsg, array($i));
|
array_push($errMsg, array($i));
|
||||||
$messages[] = $errMsg;
|
$messages[] = $errMsg;
|
||||||
}
|
}
|
||||||
|
//add account type
|
||||||
|
if (($rawAccounts[$i][$ids['asteriskAccount_AstAccountType']] != "") && (get_preg($rawAccounts[$i][$ids['asteriskAccount_AstAccountType']], 'username')) ) {
|
||||||
|
$partialAccounts[$i]['AstAccountType'] = $rawAccounts[$i][$ids['asteriskAccount_AstAccountType']];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$errMsg = $this->messages['AstAccountType'][2];
|
||||||
|
array_push($errMsg, array($i));
|
||||||
|
$messages[] = $errMsg;
|
||||||
|
}
|
||||||
//add password
|
//add password
|
||||||
if ($rawAccounts[$i][$ids['asteriskAccount_AstAccountRealmedPassword']] != "") {
|
if ($rawAccounts[$i][$ids['asteriskAccount_AstAccountRealmedPassword']] != "") {
|
||||||
$attributes = array('AstAccountCallerID' => array($partialAccounts[$i]['AstAccountCallerID'])); // fake attribute list for password building
|
$attributes = array('AstAccountCallerID' => array($partialAccounts[$i]['AstAccountCallerID'])); // fake attribute list for password building
|
||||||
|
|
Loading…
Reference in New Issue