Module HowTo - Advanced upload options


The ieee802Device module only needs the basic upload functions for its functionality.
However there are more possibilities for the modules to control the file upload.

1. Module order

Your module might depend on the input values of another module. In this case you probably want that your module is called as the second one.

You can define dependencies to other modules with the function get_uploadPreDepends() or meta['upload_preDepends'].

Example:

The sambaGroupMapping module needs the group name to set the default displayName. Therefore it depends on the posixGroup module

    /**
    * Returns meta data that is interpreted by parent class
    *
    * @return array array with meta data
    */
    function get_metaData() {
        $return = array();
        // upload dependencies
        $return['upload_preDepends'] = array('posixGroup');
        [...]


2. Upload post actions

If your module does not only create an account but relates the account with other existing LDAP entries you can do these modifications after the account was created.
This is useful for adding users to groups or setting quotas.

You have to implement the function doUploadPostActions() in your module. Since post actions are very special there is no meta data for this.

Example:

The posixAccount module offers to put the user account in additional groups. This is done in the post actions.

    /**
    * This function executes one post upload action.
    *
    * @param array $data array containing one account in each element
    * @param array $ids array(<column_name> => <column number>)
    * @param array $failed list of accounts which were not created successfully
    * @param array $temp variable to store temporary data between two post actions
    * @return array current status
    * <br> array (
    * <br>  'status' => 'finished' | 'inProgress'
    * <br>  'progress' => 0..100
    * <br>  'errors' => array (<array of parameters for StatusMessage>)
    * <br> )
    */
    function doUploadPostActions($data, $ids, $failed, &$temp) {
         [...]
    }

Please make sure that the actions in one call of doUploadPostActions() are not very time consuming (only one LDAP operation). Your function will be called repeatedly until you give back the status "finished".
This allows LAM to avoid running longer than the maximum execution time by sending meta refreshes to the browser.