From 813254f33583e2a278cc1fd9ea07e23cf3e14f3d Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 2 Oct 2010 12:30:35 +0000 Subject: [PATCH] fixed problems when profile is loaded and extension is not activated --- lam/lib/modules/asteriskVoicemail.inc | 19 +++++++++++++++++++ lam/lib/modules/kolabUser.inc | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lam/lib/modules/asteriskVoicemail.inc b/lam/lib/modules/asteriskVoicemail.inc index 81e71e97..bcfd17d9 100644 --- a/lam/lib/modules/asteriskVoicemail.inc +++ b/lam/lib/modules/asteriskVoicemail.inc @@ -495,6 +495,25 @@ class asteriskVoicemail extends baseModule implements passwordService { return true; } + /** + * Returns a list of modifications which have to be made to the LDAP account. + * + * @return array list of modifications + *
This function returns an array with 3 entries: + *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) + *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) + *
"add" are attributes which have to be added to LDAP entry + *
"remove" are attributes which have to be removed from LDAP entry + *
"modify" are attributes which have to been modified in LDAP entry + */ + function save_attributes() { + if (!in_array('AsteriskVoiceMail', $this->attributes['objectClass']) && !in_array('AsteriskVoiceMail', $this->orig['objectClass'])) { + // skip saving if the extension was not added/modified + return array(); + } + return $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig); + } + /** * This method specifies if a module manages password attributes. * @see passwordService::managesPasswordAttributes diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 51151b09..7e3363dc 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -596,6 +596,25 @@ class kolabUser extends baseModule { return true; } + /** + * Returns a list of modifications which have to be made to the LDAP account. + * + * @return array list of modifications + *
This function returns an array with 3 entries: + *
array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) + *
DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid) + *
"add" are attributes which have to be added to LDAP entry + *
"remove" are attributes which have to be removed from LDAP entry + *
"modify" are attributes which have to been modified in LDAP entry + */ + function save_attributes() { + if (!in_array('kolabInetOrgPerson', $this->attributes['objectClass']) && !in_array('kolabInetOrgPerson', $this->orig['objectClass'])) { + // skip saving if the extension was not added/modified + return array(); + } + return $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig); + } + /** * In this function the LDAP account is built up. *