upload API change
This commit is contained in:
parent
264d8ea26c
commit
6bb5249bf1
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +60,16 @@ This is a list of API changes for all LAM releases.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<h2>6.0 -> 6.1</h2>
|
||||||
|
<ul>
|
||||||
|
<li>module API</li>
|
||||||
|
<ul>
|
||||||
|
<li>doUploadPreActions has new parameter $type</li>
|
||||||
|
<li>doUploadPostActions has new parameter $type</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
<h2>5.7 -> 6.0</h2>
|
<h2>5.7 -> 6.0</h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>All account types allow multiple configurations by default.</li>
|
<li>All account types allow multiple configurations by default.</li>
|
||||||
<li>the following methods in baseModule have a new parameter $typeId:</li>
|
<li>the following methods in baseModule have a new parameter $typeId:</li>
|
||||||
|
|
|
@ -1040,9 +1040,10 @@ abstract class baseModule {
|
||||||
* Runs any actions that need to be done before an LDAP entry is created.
|
* Runs any actions that need to be done before an LDAP entry is created.
|
||||||
*
|
*
|
||||||
* @param array $attributes LDAP attributes of this entry (attributes are provided as reference, handle modifications of $attributes with care)
|
* @param array $attributes LDAP attributes of this entry (attributes are provided as reference, handle modifications of $attributes with care)
|
||||||
|
* @param ConfiguredType $type account type
|
||||||
* @return array array which contains status messages. Each entry is an array containing the status message parameters.
|
* @return array array which contains status messages. Each entry is an array containing the status message parameters.
|
||||||
*/
|
*/
|
||||||
public function doUploadPreActions($attributes) {
|
public function doUploadPreActions($attributes, $type) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,8 +1069,9 @@ abstract class baseModule {
|
||||||
* <br> 'progress' => 0..100 // the progress of the operations in percent
|
* <br> 'progress' => 0..100 // the progress of the operations in percent
|
||||||
* <br> 'errors' => array // list of arrays which are used to generate StatusMessages
|
* <br> 'errors' => array // list of arrays which are used to generate StatusMessages
|
||||||
* <br> )
|
* <br> )
|
||||||
|
* @param ConfiguredType $type account type
|
||||||
*/
|
*/
|
||||||
public function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
public function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
return array(
|
return array(
|
||||||
'status' => 'finished',
|
'status' => 'finished',
|
||||||
'progress' => 100,
|
'progress' => 100,
|
||||||
|
|
|
@ -541,17 +541,17 @@ function buildUploadAccounts($type, $data, $ids, $selectedModules) {
|
||||||
/**
|
/**
|
||||||
* Runs any actions that need to be done before an LDAP entry is created.
|
* Runs any actions that need to be done before an LDAP entry is created.
|
||||||
*
|
*
|
||||||
* @param String $scope account type
|
* @param ConfiguredType $type account type
|
||||||
* @param array $selectedModules list of selected account modules
|
* @param array $selectedModules list of selected account modules
|
||||||
* @param array $attributes LDAP attributes of this entry (attributes are provided as reference, handle modifications of $attributes with care)
|
* @param array $attributes LDAP attributes of this entry (attributes are provided as reference, handle modifications of $attributes with care)
|
||||||
* @return array array which contains status messages. Each entry is an array containing the status message parameters.
|
* @return array array which contains status messages. Each entry is an array containing the status message parameters.
|
||||||
*/
|
*/
|
||||||
function doUploadPreActions($scope, $selectedModules, $attributes) {
|
function doUploadPreActions($type, $selectedModules, $attributes) {
|
||||||
$messages = array();
|
$messages = array();
|
||||||
for ($i = 0; $i < sizeof($selectedModules); $i++) {
|
for ($i = 0; $i < sizeof($selectedModules); $i++) {
|
||||||
$activeModule = $selectedModules[$i];
|
$activeModule = $selectedModules[$i];
|
||||||
$module = moduleCache::getModule($activeModule, $scope);
|
$module = moduleCache::getModule($activeModule, $type->getScope());
|
||||||
$messages = array_merge($messages, $module->doUploadPreActions($attributes));
|
$messages = array_merge($messages, $module->doUploadPreActions($attributes, $type));
|
||||||
}
|
}
|
||||||
return $messages;
|
return $messages;
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ function doUploadPreActions($scope, $selectedModules, $attributes) {
|
||||||
/**
|
/**
|
||||||
* This function executes one post upload action.
|
* This function executes one post upload action.
|
||||||
*
|
*
|
||||||
* @param string $scope account type
|
* @param ConfiguredType $type account type
|
||||||
* @param array $data array containing one account in each element
|
* @param array $data array containing one account in each element
|
||||||
* @param array $ids array(<column_name> => <column number>)
|
* @param array $ids array(<column_name> => <column number>)
|
||||||
* @param array $failed list of accounts which were not created successfully
|
* @param array $failed list of accounts which were not created successfully
|
||||||
|
@ -573,7 +573,7 @@ function doUploadPreActions($scope, $selectedModules, $attributes) {
|
||||||
* <br> 'errors' => array (<array of parameters for StatusMessage>)
|
* <br> 'errors' => array (<array of parameters for StatusMessage>)
|
||||||
* <br> )
|
* <br> )
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions($scope, &$data, $ids, $failed, $selectedModules, &$accounts) {
|
function doUploadPostActions($type, &$data, $ids, $failed, $selectedModules, &$accounts) {
|
||||||
// check if function is called the first time
|
// check if function is called the first time
|
||||||
if (! isset($_SESSION['mass_postActions']['remainingModules'])) {
|
if (! isset($_SESSION['mass_postActions']['remainingModules'])) {
|
||||||
// make list of remaining modules
|
// make list of remaining modules
|
||||||
|
@ -586,8 +586,8 @@ function doUploadPostActions($scope, &$data, $ids, $failed, $selectedModules, &$
|
||||||
$_SESSION['mass_postActions'][$activeModule] = array();
|
$_SESSION['mass_postActions'][$activeModule] = array();
|
||||||
}
|
}
|
||||||
// let first module do one post action
|
// let first module do one post action
|
||||||
$module = moduleCache::getModule($activeModule, $scope);
|
$module = moduleCache::getModule($activeModule, $type->getScope());
|
||||||
$return = $module->doUploadPostActions($data, $ids, $failed, $_SESSION['mass_postActions'][$activeModule], $accounts, $selectedModules);
|
$return = $module->doUploadPostActions($data, $ids, $failed, $_SESSION['mass_postActions'][$activeModule], $accounts, $selectedModules, $type);
|
||||||
// remove active module from list if already finished
|
// remove active module from list if already finished
|
||||||
if ($return['status'] == 'finished') {
|
if ($return['status'] == 'finished') {
|
||||||
unset($_SESSION['mass_postActions']['remainingModules'][0]);
|
unset($_SESSION['mass_postActions']['remainingModules'][0]);
|
||||||
|
|
|
@ -2364,7 +2364,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @see baseModule::doUploadPostActions()
|
* @see baseModule::doUploadPostActions()
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ class nisNetGroupUser extends baseModule {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @see baseModule::doUploadPostActions()
|
* @see baseModule::doUploadPostActions()
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2411,7 +2411,7 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @see baseModule::doUploadPostActions()
|
* @see baseModule::doUploadPostActions()
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,7 +699,7 @@ class quota extends baseModule {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @see baseModule::doUploadPostActions()
|
* @see baseModule::doUploadPostActions()
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// first call, get list of user names and quota values
|
// first call, get list of user names and quota values
|
||||||
if (!isset($temp['counter'])) {
|
if (!isset($temp['counter'])) {
|
||||||
|
|
|
@ -2283,7 +2283,7 @@ class windowsUser extends baseModule implements passwordService {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @see baseModule::doUploadPostActions()
|
* @see baseModule::doUploadPostActions()
|
||||||
*/
|
*/
|
||||||
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules) {
|
function doUploadPostActions(&$data, $ids, $failed, &$temp, &$accounts, $selectedModules, $type) {
|
||||||
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Uploader {
|
||||||
$preAttributes[$key] = &$attrs[$key];
|
$preAttributes[$key] = &$attrs[$key];
|
||||||
}
|
}
|
||||||
$preAttributes['dn'] = &$dn;
|
$preAttributes['dn'] = &$dn;
|
||||||
$preMessages = doUploadPreActions($this->type->getScope(), $_SESSION['mass_selectedModules'], $preAttributes);
|
$preMessages = doUploadPreActions($this->type, $_SESSION['mass_selectedModules'], $preAttributes);
|
||||||
$preActionOk = true;
|
$preActionOk = true;
|
||||||
for ($i = 0; $i < sizeof($preMessages); $i++) {
|
for ($i = 0; $i < sizeof($preMessages); $i++) {
|
||||||
if (($preMessages[$i][0] == 'ERROR') || ($preMessages[$i][0] == 'WARN')) {
|
if (($preMessages[$i][0] == 'ERROR') || ($preMessages[$i][0] == 'WARN')) {
|
||||||
|
@ -243,7 +243,7 @@ class Uploader {
|
||||||
* @return array status array
|
* @return array status array
|
||||||
*/
|
*/
|
||||||
private function runModulePostActions() {
|
private function runModulePostActions() {
|
||||||
$return = doUploadPostActions($this->type->getScope(), $this->data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $this->accounts);
|
$return = doUploadPostActions($this->type, $this->data, $_SESSION['mass_ids'], $_SESSION['mass_failed'], $_SESSION['mass_selectedModules'], $this->accounts);
|
||||||
if ($return['status'] == 'finished') {
|
if ($return['status'] == 'finished') {
|
||||||
$_SESSION['mass_postActions']['finished'] = true;
|
$_SESSION['mass_postActions']['finished'] = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue