sync with Kerberos

This commit is contained in:
Roland Gruber 2012-02-18 13:47:49 +00:00
parent a8e0c7d8b0
commit 29cf39ee4d
2 changed files with 27 additions and 1 deletions

View File

@ -438,7 +438,7 @@ class sambaSamAccount extends baseModule implements passwordService {
'description' => _('Account expiration date'), 'description' => _('Account expiration date'),
'help' => 'expireDate', 'help' => 'expireDate',
'default' => '31-12-2030', 'default' => '31-12-2030',
'example' => '15-10-2006' 'example' => '15-10-2020'
), ),
array( array(
'name' => 'sambaSamAccount_group', 'name' => 'sambaSamAccount_group',
@ -978,18 +978,28 @@ class sambaSamAccount extends baseModule implements passwordService {
if (strpos($buttonName, '_change') !== false) { if (strpos($buttonName, '_change') !== false) {
// set new time // set new time
$this->setExpirationDate($_POST['expire_yea'], $_POST['expire_mon'], $_POST['expire_day']); $this->setExpirationDate($_POST['expire_yea'], $_POST['expire_mon'], $_POST['expire_day']);
// sync other modules
if (isset($_POST['syncShadow']) && ($_POST['syncShadow'] == 'on')) { if (isset($_POST['syncShadow']) && ($_POST['syncShadow'] == 'on')) {
$this->getAccountContainer()->getAccountModule('shadowAccount')->setExpirationDate( $this->getAccountContainer()->getAccountModule('shadowAccount')->setExpirationDate(
$_POST['expire_yea'], $_POST['expire_mon'], $_POST['expire_day']); $_POST['expire_yea'], $_POST['expire_mon'], $_POST['expire_day']);
} }
if (isset($_POST['syncHeimdal']) && ($_POST['syncHeimdal'] == 'on')) {
$this->getAccountContainer()->getAccountModule('heimdalKerberos')->setExpirationDate(
$_POST['expire_yea'], $_POST['expire_mon'], $_POST['expire_day']);
}
} }
elseif (strpos($buttonName, '_del') !== false) { elseif (strpos($buttonName, '_del') !== false) {
// remove attribute value // remove attribute value
unset($this->attributes[$attr]); unset($this->attributes[$attr]);
// sync other modules
if (isset($_POST['syncShadow']) && ($_POST['syncShadow'] == 'on')) { if (isset($_POST['syncShadow']) && ($_POST['syncShadow'] == 'on')) {
$this->getAccountContainer()->getAccountModule('shadowAccount')->setExpirationDate( $this->getAccountContainer()->getAccountModule('shadowAccount')->setExpirationDate(
null, null, null); null, null, null);
} }
if (isset($_POST['syncHeimdal']) && ($_POST['syncHeimdal'] == 'on')) {
$this->getAccountContainer()->getAccountModule('heimdalKerberos')->setExpirationDate(
null, null, null);
}
} }
return $return; return $return;
} }
@ -1389,6 +1399,9 @@ class sambaSamAccount extends baseModule implements passwordService {
if ($this->getAccountContainer()->getAccountModule('shadowAccount') != null) { if ($this->getAccountContainer()->getAccountModule('shadowAccount') != null) {
$return->addElement(new htmlTableExtendedInputCheckbox('syncShadow', false, _('Set also for Shadow')), true); $return->addElement(new htmlTableExtendedInputCheckbox('syncShadow', false, _('Set also for Shadow')), true);
} }
if ($this->getAccountContainer()->getAccountModule('heimdalKerberos') != null) {
$return->addElement(new htmlTableExtendedInputCheckbox('syncHeimdal', false, _('Set also for Kerberos')), true);
}
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addElement(new htmlSpacer(null, '10px'), true);
$buttons = new htmlTable(); $buttons = new htmlTable();
$buttons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'change' . $attr, _('Change'))); $buttons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'change' . $attr, _('Change')));

View File

@ -382,18 +382,28 @@ class shadowAccount extends baseModule implements passwordService {
// set expiration date // set expiration date
if (isset($_POST['form_subpage_shadowAccount_attributes_change'])) { if (isset($_POST['form_subpage_shadowAccount_attributes_change'])) {
$this->setExpirationDate($_POST['shadowExpire_yea'], $_POST['shadowExpire_mon'], $_POST['shadowExpire_day']); $this->setExpirationDate($_POST['shadowExpire_yea'], $_POST['shadowExpire_mon'], $_POST['shadowExpire_day']);
// sync other modules
if (isset($_POST['syncSamba']) && ($_POST['syncSamba'] == 'on')) { if (isset($_POST['syncSamba']) && ($_POST['syncSamba'] == 'on')) {
$this->getAccountContainer()->getAccountModule('sambaSamAccount')->setExpirationDate( $this->getAccountContainer()->getAccountModule('sambaSamAccount')->setExpirationDate(
$_POST['shadowExpire_yea'], $_POST['shadowExpire_mon'], $_POST['shadowExpire_day']); $_POST['shadowExpire_yea'], $_POST['shadowExpire_mon'], $_POST['shadowExpire_day']);
} }
if (isset($_POST['syncHeimdal']) && ($_POST['syncHeimdal'] == 'on')) {
$this->getAccountContainer()->getAccountModule('heimdalKerberos')->setExpirationDate(
$_POST['shadowExpire_yea'], $_POST['shadowExpire_mon'], $_POST['shadowExpire_day']);
}
} }
// remove expiration date // remove expiration date
elseif (isset($_POST['form_subpage_shadowAccount_attributes_del'])) { elseif (isset($_POST['form_subpage_shadowAccount_attributes_del'])) {
unset($this->attributes['shadowExpire']); unset($this->attributes['shadowExpire']);
// sync other modules
if (isset($_POST['syncSamba']) && ($_POST['syncSamba'] == 'on')) { if (isset($_POST['syncSamba']) && ($_POST['syncSamba'] == 'on')) {
$this->getAccountContainer()->getAccountModule('sambaSamAccount')->setExpirationDate( $this->getAccountContainer()->getAccountModule('sambaSamAccount')->setExpirationDate(
null, null, null); null, null, null);
} }
if (isset($_POST['syncHeimdal']) && ($_POST['syncHeimdal'] == 'on')) {
$this->getAccountContainer()->getAccountModule('heimdalKerberos')->setExpirationDate(
null, null, null);
}
} }
return $errors; return $errors;
} }
@ -423,6 +433,9 @@ class shadowAccount extends baseModule implements passwordService {
if ($this->getAccountContainer()->getAccountModule('sambaSamAccount') != null) { if ($this->getAccountContainer()->getAccountModule('sambaSamAccount') != null) {
$return->addElement(new htmlTableExtendedInputCheckbox('syncSamba', false, _('Set also for Samba 3')), true); $return->addElement(new htmlTableExtendedInputCheckbox('syncSamba', false, _('Set also for Samba 3')), true);
} }
if ($this->getAccountContainer()->getAccountModule('heimdalKerberos') != null) {
$return->addElement(new htmlTableExtendedInputCheckbox('syncHeimdal', false, _('Set also for Kerberos')), true);
}
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addElement(new htmlSpacer(null, '10px'), true);
$buttonTable = new htmlTable(); $buttonTable = new htmlTable();
$buttonTable->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'change', _('Change'))); $buttonTable->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'change', _('Change')));