Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple JS Reappt client that updates the security and system authentication stores.
var diffusion = require('diffusion');
// Connect to Reappt with admin credentials
host : '',
port : 443,
secure : true,
principal : 'admin',
credentials : 'nimda'
}).then(function(session) {
// Change the security configuration to give the GATEKEEPER and REQUESTER roles the required permissions
var securityScriptBuilder =;
var script = securityScriptBuilder.setGlobalPermissions('GATEKEEPER', ['VIEW_SESSION', 'MODIFY_SESSION'])
.setTopicPermissions('GATEKEEPER', 'closed', ['SELECT_TOPIC'])
.setTopicPermissions('REQUESTER', 'closed', ['READ_TOPIC'])
.setTopicPermissions('REQUESTER', 'open', ['SELECT_TOPIC', 'READ_TOPIC'])
.setTopicPermissions('TOPIC_CONTROL', 'closed', ['MODIFY_TOPIC', 'UPDATE_TOPIC'])
.setTopicPermissions('TOPIC_CONTROL', 'open', ['MODIFY_TOPIC', 'UPDATE_TOPIC'])
// Update the server-side store with the generated script {
console.log('Security configuration updated successfully');
}, function(error) {
console.log('Failed to update security configuration: ', error);
// Change the system authentication store to add users and give them roles
var authenticationScriptBuilder =;
var addUserScript = authenticationScriptBuilder.addPrincipal('gatekeeper', 'repeeketag')
.assignRoles('gatekeeper', ['GATEKEEPER'])
.addPrincipal('requester', 'retseuqer')
.assignRoles('requester', ['REQUESTER'])
// Update the system authentication store {
console.log('Updated system authentication config');
}, function(error) {
console.log('Failed to update system authentication: ', error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment