All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lib.xp.examples.context.run.js Maven / Gradle / Ivy

The newest version!
var contextLib = require('/lib/xp/context');
var assert = require('/lib/xp/testing');

// BEGIN
// Define the callback to be executed.
function callback() {
    return 'Hello from context';
}

// Executes a function using different context.
var result = contextLib.run({
    repository: 'system-repo',
    branch: 'master',
    user: {
        login: 'su',
        idProvider: 'system'
    },
    principals: ['role:system.admin'],
    attributes: {
        'ignorePublishTimes': true
    }
}, callback);

log.info('Callback says "%s"', result);
// END

assert.assertEquals('Hello from context', result);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy