middleware/_modelIndex.js
function (cb) {

                if (!req.linz.model.list.recordActions.length) {
                    return cb(null);
                }

                async.each(req.linz.model.list.recordActions, function (action, actionDone) {

                    if (!action.disabled) {
                        return actionDone(null);
                    }

                    if (typeof action.disabled !== 'function') {
                        throw new Error('Invalid type for record.action.disabled. It must be a function');
                    }

                    async.each(Object.keys(records), function (index, recordDone) {

                        action.disabled(mongooseRecords[index], function (err, isDisabled, message) {

                            records[index].recordActions = records[index].recordActions || {};

                            records[index].recordActions[action.label] = {
                                disabled: isDisabled,
                                message: message
                            };

                            return recordDone(null);

                        });

                    }, function (err) {

                        return actionDone(err);

                    });


                }, function (err) {

                    return cb(err);

                });
            }
function (cb) {

                if (!req.linz.model.list.recordActions.length) {
                    return cb(null);
                }

                async.each(req.linz.model.list.recordActions, function (action, actionDone) {

                    if (!action.disabled) {
                        return actionDone(null);
                    }

                    if (typeof action.disabled !== 'function') {
                        throw new Error('Invalid type for record.action.disabled. It must be a function');
                    }

                    async.each(Object.keys(records), function (index, recordDone) {

                        action.disabled(mongooseRecords[index], function (err, isDisabled, message) {

                            records[index].recordActions = records[index].recordActions || {};

                            records[index].recordActions[action.label] = {
                                disabled: isDisabled,
                                message: message
                            };

                            return recordDone(null);

                        });

                    }, function (err) {

                        return actionDone(err);

                    });


                }, function (err) {

                    return cb(err);

                });
            }
function ( cb ) { if ( ! req . linz . model . list . recordActions . length ) { return cb ( null ) ; } async . each ( req . linz . model . list . recordActions , function ( action , actionDone ) { if ( ! action . disabled ) { return actionDone ( null ) ; } if ( typeof action . disabled !== 'function' ) { throw new Error ( 'Invalid type for record.action.disabled. It must be a function' ) ; } async . each ( Object . keys ( records ) , function ( index , recordDone ) { action . disabled ( mongooseRecords [ index ] , function ( err , isDisabled , message ) { records [ index ] . recordActions = records [ index ] . recordActions || { } ; records [ index ] . recordActions [ action . label ] = { disabled : isDisabled , message : message } ; return recordDone ( null ) ; } ) ; } , function ( err ) { return actionDone ( err ) ; } ) ; } , function ( err ) { return cb ( err ) ; } ) ; }
check if we need to process each record again record actions
check if we need to process each record again record actions