custom scripts for file upload

This commit is contained in:
Roland Gruber 2012-01-15 14:15:56 +00:00
parent 51ddef1b19
commit 026a6ac77f
5 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,7 @@
March 2012 3.7 March 2012 3.7
- Login: support bind user for login search - Login: support bind user for login search
- Personal: added labeledURI and cosmetic changes, description is now multi-valued (RFE 3446363) - Personal: added labeledURI and cosmetic changes, description is now multi-valued (RFE 3446363)
- File upload: support custom scripts postCreate (LAM Pro)
- New translation: Slovakian - New translation: Slovakian
- LAM Pro: - LAM Pro:
-> Password self reset can send password notification mails -> Password self reset can send password notification mails

View File

@ -3021,7 +3021,8 @@ Run slapindex to rebuild the index.
<entry>preCreate</entry> <entry>preCreate</entry>
<entry>executed before creating a new account (cancels operation <entry>executed before creating a new account (cancels operation
if a script returns an exit code &gt; 0)</entry> if a script returns an exit code &gt; 0, not available for file
upload)</entry>
</row> </row>
<row> <row>

View File

@ -1734,6 +1734,7 @@ class posixAccount extends baseModule implements passwordService {
// password // password
if (($rawAccounts[$i][$ids['posixAccount_password']] != "") && (get_preg($rawAccounts[$i][$ids['posixAccount_password']], 'password'))) { if (($rawAccounts[$i][$ids['posixAccount_password']] != "") && (get_preg($rawAccounts[$i][$ids['posixAccount_password']], 'password'))) {
$partialAccounts[$i]['userPassword'] = pwd_hash($rawAccounts[$i][$ids['posixAccount_password']], $pwd_enabled, $this->moduleSettings['posixAccount_pwdHash'][0]); $partialAccounts[$i]['userPassword'] = pwd_hash($rawAccounts[$i][$ids['posixAccount_password']], $pwd_enabled, $this->moduleSettings['posixAccount_pwdHash'][0]);
$partialAccounts[$i]['INFO.userPasswordClearText'] = $rawAccounts[$i][$ids['posixAccount_password']]; // for custom scripts etc.
} }
elseif ($rawAccounts[$i][$ids['posixAccount_password']] != "") { elseif ($rawAccounts[$i][$ids['posixAccount_password']] != "") {
$errMsg = str_replace('%', '%%', $this->messages['userPassword'][4]); // double "%" because of later sprintf $errMsg = str_replace('%', '%%', $this->messages['userPassword'][4]); // double "%" because of later sprintf

View File

@ -69,6 +69,9 @@ if (isset($_GET['showldif'])) {
unset($accounts[$i]['dn']); unset($accounts[$i]['dn']);
$keys = array_keys($accounts[$i]); $keys = array_keys($accounts[$i]);
for ($k = 0; $k < sizeof($keys); $k++) { for ($k = 0; $k < sizeof($keys); $k++) {
if (strpos($keys[$k], 'INFO.') === 0) {
continue;
}
if (is_array($accounts[$i][$keys[$k]])) { if (is_array($accounts[$i][$keys[$k]])) {
for ($x = 0; $x < sizeof($accounts[$i][$keys[$k]]); $x++) { for ($x = 0; $x < sizeof($accounts[$i][$keys[$k]]); $x++) {
echo $keys[$k] . ": " . $accounts[$i][$keys[$k]][$x] . "\n"; echo $keys[$k] . ": " . $accounts[$i][$keys[$k]][$x] . "\n";

View File

@ -87,6 +87,12 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
$attrs = $accounts[$_SESSION['mass_counter']]; $attrs = $accounts[$_SESSION['mass_counter']];
$dn = $attrs['dn']; $dn = $attrs['dn'];
unset($attrs['dn']); unset($attrs['dn']);
// remove informational attributes
foreach ($attrs as $key => $value) {
if (strpos($key, 'INFO.') === 0) {
unset($attrs[$key]);
}
}
$success = @ldap_add($_SESSION['ldap']->server(), $dn, $attrs); $success = @ldap_add($_SESSION['ldap']->server(), $dn, $attrs);
if (!$success) { if (!$success) {
$errorMessage = array( $errorMessage = array(
@ -135,7 +141,11 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
if ($return['status'] == 'finished') { if ($return['status'] == 'finished') {
$_SESSION['mass_postActions']['finished'] = true; $_SESSION['mass_postActions']['finished'] = true;
} }
for ($i = 0; $i < sizeof($return['errors']); $i++) $_SESSION['mass_errors'][] = $return['errors'][$i]; if (isset($return['errors'])) {
for ($i = 0; $i < sizeof($return['errors']); $i++) {
$_SESSION['mass_errors'][] = $return['errors'][$i];
}
}
} }
} }
// refresh with JavaScript // refresh with JavaScript