Samba 3 part is now optional

This commit is contained in:
Roland Gruber 2007-11-18 11:16:03 +00:00
parent aedfdf029e
commit 0e44373ffb
2 changed files with 74 additions and 90 deletions

View File

@ -3,8 +3,10 @@
- account lists: added separate configuration page and store settings in cookies
- use suffix from account list as default for new accounts (patch 1823583)
- Security: passwords in configuration files are now saved as hash values
- Unix: allow to set host passwords (RFE 1754069)
- style fixes for Internet Explorer users
- Unix: allow to set host passwords (RFE 1754069)
- Samba 3 groups: Samba part is now optional
- Personal: add object classes person and organizationalPerson for new accounts (RFE 1830033)
07.11.2007 2.1.0

View File

@ -73,6 +73,7 @@ class sambaGroupMapping extends baseModule {
);
// call parent constructor
parent::baseModule($scope);
$this->autoAddObjectClasses = false;
}
/**
@ -169,6 +170,11 @@ class sambaGroupMapping extends baseModule {
* @return array HTML meta data
*/
function display_html_attributes() {
if (isset($_POST['form_subpage_sambaGroupMapping_attributes_addObjectClass'])) {
$this->attributes['objectClass'][] = 'sambaGroupMapping';
}
$return = array();
if (in_array('sambaGroupMapping', $this->attributes['objectClass'])) {
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
@ -226,7 +232,13 @@ class sambaGroupMapping extends baseModule {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Domain') ),
1 => array ( 'kind' => 'select', 'name' => 'sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => $selectedDomain),
2 => array ( 'kind' => 'help', 'value' => 'sambaDomainName' ));
}
else {
$return[] = array(
array('kind' => 'text', 'text' => ' '),
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_sambaGroupMapping_attributes_addObjectClass', 'value' => _('Add Samba 3 account'))
);
}
return $return;
}
@ -384,19 +396,6 @@ class sambaGroupMapping extends baseModule {
}
/**
* This functions is used to check if all settings for this module have been made.
*
* @return boolean true, if settings are complete
*/
function module_complete() {
if (!$this->module_ready()) return false;
if ($this->attributes['sambaSID'][0] == '') return false;
if ($this->attributes['sambaGroupType'][0] == '') return false;
return true;
}
/**
* This function is used to check if this module page can be displayed.
* It returns false if a module depends on data from other modules which was not yet entered.
@ -417,6 +416,9 @@ class sambaGroupMapping extends baseModule {
* @return array list of info/error messages
*/
function process_attributes() {
if (!in_array('sambaGroupMapping', $this->attributes['objectClass'])) {
return array();
}
$errors = array();
$sambaDomains = search_domains();
if (sizeof($sambaDomains) == 0) {
@ -474,30 +476,10 @@ class sambaGroupMapping extends baseModule {
* <br>"modify" are attributes which have to been modified in LDAP entry
*/
function save_attributes() {
// Get Domain SID from name
$sambaDomains = search_domains();
// Get Domain-SID from group SID
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
for ($i=0; $i<count($sambaDomains); $i++ ) {
if ($domainSID==$sambaDomains[$i]->SID) {
$SID = $sambaDomains[$i]->SID;
$RIDbase = $sambaDomains[$i]->RIDbase;
if (!in_array('sambaGroupMapping', $this->attributes['objectClass'])) {
return array();
}
}
$names = array_keys($this->rids);
$wrid=false;
for ($i=0; $i<count($names); $i++) {
if ($this->attributes['sambaSID'][0]==$SID."-".$this->rids[$names[$i]]) {
$wrid=true;
}
}
if (!$wrid) {
$attrs = $this->getAccountContainer()->getAccountModule('posixGroup')->getAttributes();
$this->attributes['sambaSID'][0] = $SID."-".($attrs['gidNumber'][0]*2+1+$RIDbase);
}
$return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
return $return;
return $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
}
}