do not use cache

This commit is contained in:
Roland Gruber 2010-08-09 17:38:49 +00:00
parent 2bd24982a3
commit 8b955ebe61
2 changed files with 15 additions and 25 deletions

View File

@ -1119,6 +1119,11 @@ class inetOrgPerson extends baseModule implements passwordService {
*/ */
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts, $selectedModules) { function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts, $selectedModules) {
$errors = array(); $errors = array();
// get list of existing users
$existingUsers = searchLDAPByAttribute(null, null, 'inetOrgPerson', array('uid'), array('user'));
for ($e = 0; $e < sizeof($existingUsers); $e++) {
$existingUsers[$e] = $existingUsers[$e]['uid'][0];
}
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
if (!in_array("inetOrgPerson", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetOrgPerson"; if (!in_array("inetOrgPerson", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetOrgPerson";
// last name // last name
@ -1336,12 +1341,6 @@ class inetOrgPerson extends baseModule implements passwordService {
} }
} }
// uid // uid
// get list of existing users
$dnUsers = $_SESSION['cache']->get_cache('uid', 'inetOrgPerson', 'user');
$existingUsers = array();
foreach ($dnUsers as $dn) {
$existingUsers[] = $dn[0];
}
if (in_array($rawAccounts[$i][$ids['inetOrgPerson_userName']], $existingUsers)) { if (in_array($rawAccounts[$i][$ids['inetOrgPerson_userName']], $existingUsers)) {
$errMsg = $this->messages['uid'][3]; $errMsg = $this->messages['uid'][3];
array_push($errMsg, array($i)); array_push($errMsg, array($i));

View File

@ -247,7 +247,7 @@ class kolabUser extends baseModule {
$this->messages['homeServer'][0] = array('ERROR', _('Mailbox home server name is invalid!')); // third array value is set dynamically $this->messages['homeServer'][0] = array('ERROR', _('Mailbox home server name is invalid!')); // third array value is set dynamically
$this->messages['homeServer'][1] = array('ERROR', _('Account %s:') . ' kolabUser_homeServer', _('Mailbox home server name is invalid!')); $this->messages['homeServer'][1] = array('ERROR', _('Account %s:') . ' kolabUser_homeServer', _('Mailbox home server name is invalid!'));
$this->messages['homeServer'][2] = array('ERROR', _('Mailbox home server name is empty!'), ''); $this->messages['homeServer'][2] = array('ERROR', _('Mailbox home server name is empty!'), '');
$this->messages['delegate'][0] = array('ERROR', _('Account %s:') . ' kolabUser_delegate', _('Delegates has invalid format!')); $this->messages['delegate'][0] = array('ERROR', _('Account %s:') . ' kolabUser_delegate', _('Unknown delegate address: %s'));
$this->messages['freeBusy'][0] = array('ERROR', _('Free/Busy interval must be a number!')); // third array value is set dynamically $this->messages['freeBusy'][0] = array('ERROR', _('Free/Busy interval must be a number!')); // third array value is set dynamically
$this->messages['freeBusy'][1] = array('ERROR', _('Account %s:') . ' kolabUser_freeBusy', _('Free/Busy interval must be a number!')); $this->messages['freeBusy'][1] = array('ERROR', _('Account %s:') . ' kolabUser_freeBusy', _('Free/Busy interval must be a number!'));
$this->messages['quota'][0] = array('ERROR', _('Mail quota must be a number!')); // third array value is set dynamically $this->messages['quota'][0] = array('ERROR', _('Mail quota must be a number!')); // third array value is set dynamically
@ -381,15 +381,11 @@ class kolabUser extends baseModule {
); );
$return[] = $returnAliases; $return[] = $returnAliases;
// delegates // delegates
$delegates = array(); $delegates = searchLDAPByAttribute(null, null, 'inetOrgPerson', array('mail'), array('user'));
$delegatesTemp = $_SESSION['cache']->get_cache('mail', 'inetOrgPerson', 'user'); for ($i = 0; $i < sizeof($delegates); $i++) {
if (is_array($delegatesTemp)) { $delegates[$i] = $delegates[$i]['mail'][0];
$DNs = array_keys($delegatesTemp);
foreach ($DNs as $DN) {
$delegates[] = $delegatesTemp[$DN][0];
}
sort($delegates);
} }
sort($delegates);
$returnDelegates = array(); $returnDelegates = array();
if (isset($this->attributes['kolabDelegate'])) { if (isset($this->attributes['kolabDelegate'])) {
for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) { for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) {
@ -636,6 +632,10 @@ class kolabUser extends baseModule {
*/ */
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts, $selectedModules) { function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts, $selectedModules) {
$messages = array(); $messages = array();
$delegates = searchLDAPByAttribute(null, null, 'inetOrgPerson', array('mail'), array('user'));
for ($d = 0; $d < sizeof($delegates); $d++) {
$delegates[$d] = $delegates[$d]['mail'][0];
}
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
// add object class // add object class
if (!in_array("kolabInetOrgPerson", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "kolabInetOrgPerson"; if (!in_array("kolabInetOrgPerson", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "kolabInetOrgPerson";
@ -718,15 +718,6 @@ class kolabUser extends baseModule {
} }
// add delegates // add delegates
if ($rawAccounts[$i][$ids['kolabUser_delegates']] != "") { if ($rawAccounts[$i][$ids['kolabUser_delegates']] != "") {
$delegates = array();
$delegatesTemp = $_SESSION['cache']->get_cache('mail', 'inetOrgPerson', 'user');
if (is_array($delegatesTemp)) {
$DNs = array_keys($delegatesTemp);
foreach ($DNs as $DN) {
$delegates[] = $delegatesTemp[$DN][0];
}
sort($delegates);
}
$newDelegates = explode(',', $rawAccounts[$i][$ids['kolabUser_delegates']]); $newDelegates = explode(',', $rawAccounts[$i][$ids['kolabUser_delegates']]);
// check format // check format
for ($d = 0; $d < sizeof($newDelegates); $d++) { for ($d = 0; $d < sizeof($newDelegates); $d++) {
@ -736,7 +727,7 @@ class kolabUser extends baseModule {
// invalid format // invalid format
else { else {
$errMsg = $this->messages['delegate'][0]; $errMsg = $this->messages['delegate'][0];
array_push($errMsg, array($i)); array_push($errMsg, array($i, $newDelegates[$d]));
$messages[] = $errMsg; $messages[] = $errMsg;
} }
} }