imports/vx/server/code/vxapp.js
/**
     * Execute arbitrary function on server (only available to Super Administrators).
     *
     * @param {string} functionName Name of VXApp server-side function to invoke.
     * @param {array} args Additional arguments if any.
     */
Execute arbitrary function on server (only available to Super Administrators).
@param {string} functionName Name of VXApp server-side function to invoke.
@param {array} args Additional arguments if any.
Execute arbitrary function on server ( only available to Super Administrators ) . @param { string } functionName Name of VXApp server - side function to invoke . @param { array } args Additional arguments if any .
serverExecute(functionName, ...args) {
        try {
            if (!_.isString(functionName)) {
                OLog.error(`vxapp.js serverExecute parameter check failed functionName=${functionName}`)
                return { success : false, icon : "EYE", key : "common.alert_parameter_check_failed" }
            }
            const userId = Meteor.userId()
            if (!userId) {
                OLog.error("vxapp.js serverExecute security check failed user is not logged in")
                return { success : false, icon : "EYE", key : "common.alert_security_check_failed" }
            }
            if (!Util.isUserSuperAdmin(userId)) {
                OLog.error("vxapp.js serverExecute security check failed only Super Administrators can invoke server-side functions arbitrarily")
                return { success : false, icon : "EYE", key : "common.alert_security_check_failed" }
            }
            OLog.debug(`vxapp.js serverExecute *invoking* functionName=${functionName} args=${args}`)
            return VXApp[functionName](...args)
        }
        catch (error) {
            OLog.error(`vxapp.js serverExecute unexpected error=${error}`)
            return { success : false, icon : "BUG", key : "common.alert_unexpected_error", variables : { error : error.toString() } }
        }
    }
serverExecute ( functionName , ... args ) { try { if ( ! _ . isString ( functionName ) ) { OLog . error ( ` ${ functionName } ` ) return { success : false , icon : "EYE" , key : "common.alert_parameter_check_failed" } } const userId = Meteor . userId ( ) if ( ! userId ) { OLog . error ( "vxapp.js serverExecute security check failed user is not logged in" ) return { success : false , icon : "EYE" , key : "common.alert_security_check_failed" } } if ( ! Util . isUserSuperAdmin ( userId ) ) { OLog . error ( "vxapp.js serverExecute security check failed only Super Administrators can invoke server-side functions arbitrarily" ) return { success : false , icon : "EYE" , key : "common.alert_security_check_failed" } } OLog . debug ( ` ${ functionName } ${ args } ` ) return VXApp [ functionName ] ( ... args ) } catch ( error ) { OLog . error ( ` ${ error } ` ) return { success : false , icon : "BUG" , key : "common.alert_unexpected_error" , variables : { error : error . toString ( ) } } } }
Execute arbitrary function on server (only available to Super Administrators).
Execute arbitrary function on server ( only available to Super Administrators ) .