diff --git a/Rabbit-injector/createUserRole1-oldStyle.bmsg b/Rabbit-injector/createUserRole1-oldStyle.bmsg new file mode 100644 index 0000000..d224e14 --- /dev/null +++ b/Rabbit-injector/createUserRole1-oldStyle.bmsg @@ -0,0 +1,18 @@ +{ + "name": "Create user roles 1", + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "eventType": "created", + "payload": { + "eventType": "created", + "data": { + "PROJECT_Coordinator": {"description": "Project Coordinator role on a project in the ICMP application"}, + "SOE_ReadOnly": {"description": "SoE User with read-only access to the SoE Monitoring application"}, + "PROJECT_PO_Backup": {"description": "Backup Project Officer (PO) role in the ICMP application"}, + "BP_SPOC": {"description": "Domain Administrator (SPOC) role in the ByPass application"} + } + } + } +} diff --git a/Rabbit-injector/createUserRole2-oldStyle.bmsg b/Rabbit-injector/createUserRole2-oldStyle.bmsg new file mode 100644 index 0000000..49cc15e --- /dev/null +++ b/Rabbit-injector/createUserRole2-oldStyle.bmsg @@ -0,0 +1,17 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "eventType": "created", + "payload": { + "eventType": "created", + "data": { + "ML_Role1": { "description": "Hello world 2", "tintin":"toto2", "types": {"description":"string"} }, + "PROJECT_Coordinator": {"description": "Project Coordinator role on a project in the ICMP application"}, + "SOE_ReadOnly": {"description": "SoE User with read-only access to the SoE Monitoring application"}, + "PROJECT_PO_Backup": {"description": "Backup Project Officer (PO) role in the ICMP application"} + } + } +} +} diff --git a/Rabbit-injector/midas-time.bmsg b/Rabbit-injector/midas-time.bmsg new file mode 100644 index 0000000..045f06d --- /dev/null +++ b/Rabbit-injector/midas-time.bmsg @@ -0,0 +1 @@ +{"channel":"infraNotifs:midas","packet":{"action":"TIME","sender":"steinic","reqid":"9d3bcb2e-ef1d-4620-86ff-5c0b0f4063f7"}} diff --git a/Rabbit-injector/move_aget42-2.bmsg b/Rabbit-injector/move_aget42-2.bmsg new file mode 100644 index 0000000..3b79baa --- /dev/null +++ b/Rabbit-injector/move_aget42-2.bmsg @@ -0,0 +1,62 @@ +{ + "sequenceDelay": 500, + "sequenceLoop":10, + "sequence":[ + { + "channel":"gps:agents", + "packet":{ + "eventType": "moving", + "payload": { + "aid": "agent42", + "attrs": { + "x": "10", + "y": "10" + } + }, + "sender": "steinic" + } + }, + { + "channel":"gps:agents", + "packet":{ + "eventType": "moving", + "payload": { + "aid": "agent42", + "attrs": { + "x": "800", + "y": "30" + } + }, + "sender": "steinic" + } + }, + { + "channel":"gps:agents", + "packet":{ + "eventType": "moving", + "payload": { + "aid": "agent42", + "attrs": { + "x": "800", + "y": "500" + } + }, + "sender": "steinic" + } + }, + { + "channel":"gps:agents", + "packet":{ + "eventType": "moving", + "payload": { + "aid": "agent42", + "attrs": { + "x": "10", + "y": "500" + } + }, + "sender": "steinic" + } + } + ] +} diff --git a/Rabbit-injector/move_aget42.bmsg b/Rabbit-injector/move_aget42.bmsg new file mode 100644 index 0000000..652ba4c --- /dev/null +++ b/Rabbit-injector/move_aget42.bmsg @@ -0,0 +1,14 @@ +{ + "channel":"gps:agents", + "packet":{ + "eventType": "moving", + "payload": { + "aid": "agent42", + "attrs": { + "x": "950", + "y": "650" + } + }, + "sender": "steinic" + } +} diff --git a/Rabbit-injector/notificator-notify.bmsg b/Rabbit-injector/notificator-notify.bmsg new file mode 100644 index 0000000..518516d --- /dev/null +++ b/Rabbit-injector/notificator-notify.bmsg @@ -0,0 +1,8 @@ +{ + "channel":"services:notifications", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload":"{\"action\" : \"notify\",\"data\":{\"date\": \"2024-09-24T09:07:01.5528092+02:00\",\"uuid\": \"notification-K2FG--jvRWykweigEW01pQ\",\"templateId\": \"eff1e2eb-2e53-4ffe-b6d8-673906cb630b\",\"templateName\": \"TechDD - Expert access V1\",\"recipients\": [{\"email\": \"cadence.avila@mail.com\",\"recipientType\": \"TO\",\"euLoginId\": \"n003hxwb\",\"requestType\": \"testAvirer\",\"requestUuid\": \"12346578-242a-4d23-a418-9df966c7ea0b\",\"notificationType\": [ \"email\" ],\"tokens\": {\"expertLastName\": \"Avila\",\"proposalAcronym\": \"Nexdiag\",\"expertFirstName\": \"Cadence\",\"proposalId\": \"190186747\",\"expertFullName\": \"Cadence Avila\",\"reportURL\": \"/projects/190186747/techdd/dQEUCXptVQmidRV2zSerialNumber3UzvsQ\",\"proposalType\": \"Blended\"}},{\"email\": \"nico.labicoque@mail.com\",\"euLoginId\": \"steinic\",\"recipientType\": \"TO\",\"notificationType\": [ \"email\",\"sparcNotif\" ],\"tokens\": {\"expertFirstName\": \"Nico\",\"expertLastName\": \"Labicoque\",\"proposalAcronym\": \"JWST2\",\"proposalId\": \"190186748\",\"expertFullName\": \"Nico Labicoque\",\"reportURL\": \"/projects/190186748/techdd/dQEUCXptVQmxxxV2z3UzvsQ\",\"proposalType\": \"Blended\"}}]}}" + } +} diff --git a/Rabbit-injector/notificator-notify2.bmsg b/Rabbit-injector/notificator-notify2.bmsg new file mode 100644 index 0000000..cc79a78 --- /dev/null +++ b/Rabbit-injector/notificator-notify2.bmsg @@ -0,0 +1,8 @@ +{ + "channel":"services:notifications", + "packet":{ + "sender":"steinic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload":"{\"action\": \"notify\",\"data\": {\"date\": \"2024-09-24T09:07:01.5528092+02:00\",\"uuid\": \"notification-K2FG--jvRWykweigEW01pQ\",\"templateId\": \"1c5c78a3-40c4-468c-acc9-46e92f6a881a\",\"templateName\": \"test template 1\",\"recipients\": [{\"email\": \"franck.leple@amexiogroup.com\",\"recipientType\": \"TO\",\"euLoginId\": \"leplef\",\"notificationType\": [\"email\"],\"tokens\": {\"userName\": \"Franck\"}},{\"email\": \"nicolas.stein@internike.com\",\"euLoginId\": \"steinic\",\"recipientType\": \"TO\",\"notificationType\": [\"email\",\"sparcNotif\"],\"tokens\": {\"userName\": \"Nico\"}},{\"email\": \"niketufjo@gmail.com\",\"euLoginId\": \"steinic\",\"recipientType\": \"TO\",\"notificationType\": [\"email\",\"sparcNotif\"],\"tokens\": {\"userName\": \"Nike\"}}]}}" + } +} diff --git a/Rabbit-injector/notificator-notify3.bmsg b/Rabbit-injector/notificator-notify3.bmsg new file mode 100644 index 0000000..bb01280 --- /dev/null +++ b/Rabbit-injector/notificator-notify3.bmsg @@ -0,0 +1,9 @@ +{ + "channel":"services:notifications", + "packet":{ + "sender":"steinic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"action": "notify","data": {"date": "2024-09-24T09:07:01.5528092+02:00","uuid": "notification-K2FG--jvRWykweigEW01pQ","templateId": "1cf69669-4d23-4382-a2ac-f843e75500c6","templateName": "TechDD - report consultation V1","recipients": [{"email": "franck.leple@amexiogroup.com","recipientType": "TO","euLoginId": "leplef","notificationType": ["email"],"tokens": {"proposalAcronym": "Nexdiag1","proposalId": "190181111","FIOFullName": "Franck LEPLE","FIOLastName": "Leple","FIOFirstName": "Franck","reportURL": "/projects/190181111/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}},{"email": "nicolas.stein@internike.com","euLoginId": "steinic","recipientType": "TO","notificationType": ["email","sparcNotif"],"tokens": {"proposalAcronym": "Nexdiag2","proposalId": "190182222","FIOFullName": "Nicolas STEIN","FIOLastName": "STEIN","FIOFirstName": "Nicolas","reportURL": "/projects/190182222/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}},{"email": "niketufjo@gmail.com","euLoginId": "steinic","recipientType": "TO","notificationType": ["email","sparcNotif"],"tokens": {"proposalAcronym": "Nexdiag3","proposalId": "190183333","FIOFullName": "Nike TUFJO","FIOLastName": "TUFJO","FIOFirstName": "Nike","reportURL": "/projects/190183333/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}}]}} + } +} diff --git a/Rabbit-injector/notificator-notify4.bmsg b/Rabbit-injector/notificator-notify4.bmsg new file mode 100644 index 0000000..b3bb958 --- /dev/null +++ b/Rabbit-injector/notificator-notify4.bmsg @@ -0,0 +1,9 @@ +{ + "channel":"services:notifications", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"action": "notify","data": {"date": "2024-09-24T09:07:01.5528092+02:00","uuid": "notification-K2FG--jvRWykweigEW01pQ","templateId": "1cf69669-4d23-4382-a2ac-f843e75500c6","templateName": "TechDD - report consultation V1","recipients": [{"requestType":"testAvirer","requestUuid": "12346578-242a-4d23-a418-9df966c7ea0b","email": "franck.leple@amexiogroup.com","recipientType": "TO","euLoginId": "leplef","notificationType": ["email"],"tokens": {"proposalAcronym": "Nexdiag1","proposalId": "190181111","FIOFullName": "Franck LEPLE","FIOLastName": "Leple","FIOFirstName": "Franck","reportURL": "/projects/190181111/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}},{"requestType": "testAvirer","requestUuid": "87654321-242a-4d23-a418-9df966c7ea0b", "email": "nicolas.stein@internike.com","euLoginId": "steinic","recipientType": "TO","notificationType": ["email","sparcNotif"],"tokens": {"proposalAcronym": "Nexdiag2","proposalId": "190182222","FIOFullName": "Nicolas STEIN","FIOLastName": "STEIN","FIOFirstName": "Nicolas","reportURL": "/projects/190182222/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}},{"email": "niketufjo@gmail.com","euLoginId": "steinic","recipientType": "TO","notificationType": ["email","sparcNotif"],"tokens": {"proposalAcronym": "Nexdiag3","proposalId": "190183333","FIOFullName": "Nike TUFJO","FIOLastName": "TUFJO","FIOFirstName": "Nike","reportURL": "/projects/190183333/techdd/dQEUCXptVQmidRV2z3UzvsQ","proposalType": "Blended"}}]}} + } +} diff --git a/Rabbit-injector/pdfMaker1-batch.bmsg b/Rabbit-injector/pdfMaker1-batch.bmsg new file mode 100644 index 0000000..6f67363 --- /dev/null +++ b/Rabbit-injector/pdfMaker1-batch.bmsg @@ -0,0 +1,202 @@ +[ +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +}, +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +} +] \ No newline at end of file diff --git a/Rabbit-injector/pdfMaker1.bmsg b/Rabbit-injector/pdfMaker1.bmsg new file mode 100644 index 0000000..f2c26e6 --- /dev/null +++ b/Rabbit-injector/pdfMaker1.bmsg @@ -0,0 +1,20 @@ +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalAcronym": "MIDAS en folie", + "proposalId":"642" + } + } + } + } +} \ No newline at end of file diff --git a/Rabbit-injector/pdfMaker2.bmsg b/Rabbit-injector/pdfMaker2.bmsg new file mode 100644 index 0000000..151929a --- /dev/null +++ b/Rabbit-injector/pdfMaker2.bmsg @@ -0,0 +1,22 @@ +{ + "channel":"services:pdfs", + "packet":{ + "sender":"backend-smed", + "reqid":"048e081f-935f-4089-adf0-6fac6f652fd6", + "payload":{ + "action": "makepdf", + "data": { + "uuid":"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "templateId":"e0652993-a837-4749-9a58-40aaa22c9d3f", + "tokens": { + "expertFullName":"NIKE PIPERZEEL", + "proposalType": "wonderful", + "proposalId":"642" + } , + "base64Tokens": { + "proposalAcronym": "PHNwYW4gc3R5bGU9ImNvbG9yOiMwMEY7Zm9udC1zaXplOjJlbTsiIGF0dHJpYj0idmFsdWUiPk1JREFTIDxiPmVuIGZvbGllPC9iPjwvc3Bhbj4=" + } + } + } + } +} \ No newline at end of file diff --git a/Rabbit-injector/redisConnexion.js b/Rabbit-injector/redisConnexion.js new file mode 100644 index 0000000..807f2ed --- /dev/null +++ b/Rabbit-injector/redisConnexion.js @@ -0,0 +1,224 @@ +const redis = require('redis') +const sha256 = require('sha256') +const midasActions = require('../actions') +const AccesRights = require('../accesRights') +const crypto = require('crypto') + +module.exports = class RedisConnexion { + + constructor(options) { + Object.assign(this,midasActions.methods) + this.config = options.config + this.debug = options.debug + this.cfgh = options.cfgh + this.midasSubscriptions = [] + this.accessRights = new AccesRights(this.config, options.debug) + this.AWScodeCommitRole = 'arn:aws:iam::959160311435:role/EIC-CodeCommitReader' + + // Plugins related + this.plugins = {} + this.gitRepoName = 'myeic-midas-service' + this.gitRepoPath = `/tmp/${this.gitRepoName}` + this.repoPluginsPath = `${this.gitRepoPath}/plugins` + this.newPluginsPath = __dirname+'/newPlugins' + this.currentPluginsPath = __dirname+'/plugins' + this.pluginsReloadLock = false + + this.redisClient = redis.createClient({ + socket: { + tls: this.config.redis.tls, + host: this.config.redis.host, + port: this.config.redis.port + }, + scripts:{ + // Atomically deletes key only if correct value provided. + // Used by mutex as per https://redis.io/commands/set/#patterns + delKeyVal: redis.defineScript({ + NUMBER_OF_KEYS: 1, + SCRIPT:` + if redis.call("get",KEYS[1]) == ARGV[1] + then + return redis.call("del",KEYS[1]) + else + return 0 + end + `, + transformArguments(key, toAdd) { + return [key, toAdd.toString()]; + }, + transformReply(reply) { + return reply; + } + }) + } + }); + + this.redisSubscriber = null; + this.redisClient.on('error', (err) => { + console.error('Redis error: ', err); + }); + + if(this.debug) console.log('Redis started...') + } + + async redisLogin(){ + if(this.debug) console.log(`Connecting to Redis (${this.config.redis.host}:${this.config.redis.port}, tls:${this.config.redis.tls?'yes':'no'})...`); + await this.redisClient.connect(); + if(this.debug) console.log('Connected to Redis !'); + if(this.config.redis.user) { + await this.redisClient.sendCommand(['AUTH', this.config.redis.user, this.config.redis.pass]); + if(this.debug) console.log('Logged into Redis !'); + } else { + if(this.debug) console.log('Connected (anon) to Redis...'); + } + if(this.debug) { + var redisTime = await this.redisClient.time() + console.log('Redis time:', redisTime) + } + } + + async redisChansStart(){ // Second subscriber connexion + this.redisSubscriber = this.redisClient.duplicate(); + await this.redisSubscriber.connect(); + if(this.config.redis.user) { + await this.redisSubscriber.sendCommand(['AUTH', this.config.redis.user, this.config.redis.pass]); + } + + // Gather my chans of interest + this.refreshPluginsChans() + + if(this.debug) console.log('PSubscription OK ', this.config.redis.basePrefix + '*'); + } + + async redisSubscribe(chanName, callBack){ + if(!chanName.startsWith(this.config.redis.basePrefix)) chanName = this.config.redis.basePrefix + chanName + await this.redisSubscriber.subscribe(chanName, callBack); + } + + async redisPublish(chanName, msg){ + if(typeof (msg) != 'string') msg = JSON.stringify(msg); + if(!chanName.startsWith(this.config.redis.basePrefix)) chanName = this.config.redis.basePrefix + chanName + await this.redisClient.publish(chanName, msg); + } + + + async redisSet(k, v, exp = 0, customPrefix=null){ + if(typeof(v) != 'string') v = JSON.stringify(v); + if(customPrefix!==null) k = customPrefix + k + else if(!k.startsWith(this.config.redis.basePrefix)) k = this.config.redis.basePrefix + k + if(this.debug) console.log('Redis SET ', k) + try { await this.redisClient.set(k, v) } + catch(err) { console.error('Redis crash doing Redis set: ', k, v) } + if(exp > 0) { + try { await this.redisClient.expire(k, exp) } + catch(err) { console.error('Redis crash doing Redis expire: ', k, exp) } + } + } + + async redisGet(k, customPrefix=null){ + if(customPrefix!==null) k = customPrefix + k + else if(!k.startsWith(this.config.redis.basePrefix)) k = this.config.redis.basePrefix + k + if(this.debug) console.log('Redis GET ', k) + let v=null + try { v = await this.redisClient.get(k) } + catch(err) { console.error('Redis crash doing Redis get: ', k) } + return(v); + } + + async redisDel(k, customPrefix=null){ + if(customPrefix!==null) k = customPrefix + k + else if(!k.startsWith(this.config.redis.basePrefix)) k = this.config.redis.basePrefix + k + if(this.debug) console.log('Deleting ', k); + await this.redisClient.del(k); + } + + + async redisGetTtl(k, customPrefix=null){ + if(customPrefix!==null) k = customPrefix + k + else if(!k.startsWith(this.config.redis.basePrefix)) k = this.config.redis.basePrefix + k + if(this.debug) console.log('Redis Get TTL ', k) + let v=null + try { v = await this.redisClient.ttl(k) } + catch(err) { console.error('Redis crash doing Redis ttl: ', k) } + return(v); + } + + async redisSetTtl(k, ttl, customPrefix=null){ + if(customPrefix!==null) k = customPrefix + k + else if(!k.startsWith(this.config.redis.basePrefix)) k = this.config.redis.basePrefix + k + if(this.debug) console.log('Redis Set TTL ', k); + try { await this.redisClient.expire(k, ttl) } + catch(err) { console.error('Redis crash doing Redis expire: ', k, ttl) } + } + + async redisXadd(streamName, kvObj, max = ''){ + if(!streamName.startsWith(this.config.redis.basePrefix)) streamName = this.config.redis.basePrefix + streamName + if(this.debug) console.log('Redis XADD ', streamName, kvObj); + let arr = ['XADD', streamName] + if(max != '') arr = [...arr, ...['MAXLEN', '~', (1*max).toString()]] + arr.push('*') + let payload = '""' + try{ payload = JSON.stringify(kvObj) } + catch(e) { console.warn('cannot historize bad json: ',kvObj) } + arr.push('streamData') + arr.push(payload) + let sid = null + try { sid = await this.redisClient.sendCommand(arr); } + catch(err) { console.error('Redis crash doing Redis command: ', arr, err) } + return(sid); + } + + async redisXrange(streamName, start = '-', end = '+'){ + if(!streamName.startsWith(this.config.redis.basePrefix)) streamName = this.config.redis.basePrefix + streamName + if(this.debug) console.log('Redis XRANGE ', streamName); + if(typeof(start)!='string') start = start.toString() + if(typeof(end)!='string') end = end.toString() + let arr = ['XRANGE', streamName, start, end]; + let res = [] + try { res = await this.redisClient.sendCommand(arr) } + catch(err) { console.error('Redis crash doing Redis command: ', arr, err.msg) } + let o = {}; + for (let row of res) { // We'll take only the first content of the stream (the value of the key 'streamdata') + let payload = '' + try{ payload = JSON.parse(row[1][1]) } + catch(e) { console.warn('cannot unhistorize bad json: ',row[1][1]) } + o[row[0]] = payload + } + return(o); + } + + isHistorizedChan(chan){ + if(!chan.startsWith(this.config.redis.basePrefix)) chan = this.config.redis.basePrefix + chan + var matches = this.config.historize.historizeChannels.filter((e) => { + if(!e.startsWith(this.config.redis.basePrefix)) e = this.config.redis.basePrefix + e + if(e.indexOf('*') > -1) { + let r = new RegExp('^'+e.replace(/\*/g,'(.+)')+'$','g') + return(chan.match(r) != null); + } else return(chan == e); + }); + return(matches.length > 0); + } + + async getUserRoles(uid){ + let roles = [] + + //TODO : Maybe do better...? (check in DB ?) + if(uid.startsWith('backend-')){ + roles = [uid.substr(8)] + } else { + let rawPayload = await this.redisGet(uid, this.config.redis.authTokenPrefix) + let payload = JSON.parse(rawPayload) + if(payload && payload.roles) roles = payload.roles + } + if(this.debug) console.log(`Got roles for ${uid} => ${roles}`) + return(roles) + } + + +} + +/** + * TODOs: + * - Subscribe only to chans of interest (action chan + each plugin chan), not all-then-filter, we're not a gaeway ! + * + */ \ No newline at end of file diff --git a/Rabbit-injector/ri.js b/Rabbit-injector/ri.js new file mode 100644 index 0000000..1ebe1cf --- /dev/null +++ b/Rabbit-injector/ri.js @@ -0,0 +1,255 @@ +import yargs from 'yargs/yargs' +import { hideBin } from 'yargs/helpers' +import fs from 'fs' +import {RedisConnexion} from '../redisConnexion.js' +import riConfig from './riConfig.json' with { type: 'json' } +import pkg from 'enquirer'; +const { prompt } = pkg; + + +const dialogData = { + 'step1' : { + 'question': { + 'type': 'input', + 'name': 'uid', + 'message': 'Sender uid ? (Back-ends: backend-marklogic / backend-smed )' + }, + 'nextStep': 'step2' + }, + 'step2' : { + 'question': { + 'type': 'autocomplete', + 'name': 'channel', + 'message': 'Channel ?', + 'limit': 10, + 'initial': 2, + 'choices': [ + '[NEW]', + 'dataSync:userRoles', + 'system:notifs', + 'infraNotifs:httpGateway', + 'infraNotifs:midas', + 'services:notifications', + 'services:pdfs', + ] + }, + 'nextStep': 'step3' + }, + 'step3': { + 'question': { + 'type': 'select', + 'name': 'type', + 'message': 'Type of message ?', + 'choices': [ + { 'message': 'Event', 'value': 'event' }, + { 'message': 'Action', 'value': 'action' }, + { 'message': 'Other', 'value': 'other' }, + ] + }, + 'nextStep': 'step4-{{type}}' + }, + 'step4-event': { + 'question': { + 'type': 'select', + 'name': 'eventType', + 'message': 'Type of event ?', + 'choices': null, + }, + 'nextStep': 'step5' + }, + 'step4-action': { + 'question': { + 'type': 'select', + 'name': 'action', + 'message': 'Type of action ?', + 'choices': null + }, + 'nextStep': 'step5' + }, + 'step4-other': { + 'question': { + 'type': 'input', + 'name': 'payload', + 'message': 'Payload (json)' + }, + 'nextStep': 'step6' + }, + 'step5': { + 'question': { + 'type': 'input', + 'name': 'payload', + 'message': 'Payload (json), [enter for none]' + }, + 'nextStep': 'step6' + }, + 'step6': { + 'question': { + 'type': 'select', + 'name': 'confirm', + 'message': 'Confirm what you want:', + 'initial': 'send', + 'choices': [ + { 'message': 'Send on the bus', 'value': 'send' }, + { 'message': 'Save to file', 'value': 'save' }, + { 'message': 'Cancel', 'value': 'cancel' }, + ] + }, + 'nextStep': null + }, +} + +const selectors = { + 'chan2eventTypes': { + 'dataSync:userRoles': ['updated'], + 'system:notifs': ['growl'], + }, + 'chan2actions': { + 'infraNotifs:httpGateway': ['TIME', 'RELOADACCESSRIGHTS', 'GETACCESSRIGHTS'], + 'infraNotifs:midas': ['TIME', 'LISTPLUGINS', 'RELOADPLUGINS'], + 'services:notifications': [ 'notify' ], + } +} + + +class Dialog { + + constructor(dialogData, selectors){ + this.dialogData = dialogData + this.selectors = selectors + this.curStep = null + this.answers = {} + } + + async start(step){ + this.curStep = step + while(this.curStep && this.dialogData[this.curStep]){ + let latestAnswer = await(this.askStep(this.curStep)) + if(latestAnswer[this.dialogData[this.curStep].question.name]=='[NEW]'){ + latestAnswer = await prompt({ + 'type': 'input', + 'name': this.dialogData[this.curStep].question.name, + 'message': `(enter your new/custom value) ${this.dialogData[this.curStep].question.message}`, + }) + } + + this.curStep = this.dialogData[this.curStep].nextStep + Object.assign(this.answers, latestAnswer) + + if(this.curStep){ + this.curStep = this.curStep.replace(/{{(\w+)}}/, (_, token) => (this.answers[token] || '' ) ) + } + } + if(this.curStep) console.warn(`Stopped because cannot find step "${this.curStep}" !`) + return(this.answers) + } + + async askStep(step){ + // Fills empty selectors + let question = this.dialogData[step].question + if((question.type=='select') && (question.choices===null)){ + switch(question.name){ + case 'eventType': + question.choices = this.selectors.chan2eventTypes.hasOwnProperty(this.answers.channel) + ? ['[NEW]', ...this.selectors.chan2eventTypes[this.answers.channel]] + : question.choices = ['[NEW]'] + break + case 'action': + question.choices = this.selectors.chan2actions.hasOwnProperty(this.answers.channel) + ? ['[NEW]', ...this.selectors.chan2actions[this.answers.channel]] + : question.choices = ['[NEW]'] + break + default: question.choices = ['[NEW]'] + } + } + return(await prompt(this.dialogData[step].question)) + } + +} + +async function startRedis(midasConfig) { + let REDIScnx = new RedisConnexion({ + debug: true, + config: midasConfig, + }); + console.log('Starting REDIS...'); + await REDIScnx.redisLogin(); + console.log('REDIS Login OK'); + return (REDIScnx); +} + +async function inject(rediscnx, chan, packet){ + await rediscnx.redisPublish(chan, packet) +} + + +async function batchInject(rediscnx, batch, delay=0){ + const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)) + + for(let msg of batch){ + if(msg.channel && msg.packet){ + await rediscnx.redisPublish(msg.channel, msg.packet) + } else console.error('Bad message format, skipped !?', msg) + await sleep(delay) + } +} + +const argv = yargs(hideBin(process.argv)).command('Rabbit-Injector', 'Injects messages on bus', {}) + .options({ + 'file': { + description: 'Instead of asking question, directly inject from a .dmsg file', + alias: 'f', + type: 'string' + }, + }).help().version('1.0').argv + +if(argv.file){ + let fileName = argv.file + if(!fileName.endsWith('.bmsg')) fileName+='.bmsg' + if(fs.existsSync(fileName)){ + let fileData + try{ + fileData = JSON.parse(fs.readFileSync(fileName)) + } catch(err){ + console.error('Bad json in file !?') + process.exit(1) + } + + let rediscnx = await startRedis(riConfig) + if(Array.isArray(fileData)){ + await batchInject(rediscnx, fileData) + } else { + if(Array.isArray(fileData.sequence)){ + let batchIter = (parseInt(fileData.sequenceLoop)>1) ? parseInt(fileData.sequenceLoop) : 1 + for(let i=0; i0) await batchInject(rediscnx, fileData.sequence, parseInt(fileData.sequenceDelay)) + else await batchInject(rediscnx, fileData) + } + } else if(fileData.channel && fileData.packet){ + await inject(rediscnx, fileData.channel, fileData.packet) + } else console.error('Bad file format !?', fileData) + } + await rediscnx.redisClient.disconnect() + } +} else { + let dialog = new Dialog(dialogData, selectors) + dialog.start('step1').then(answers => { + let packet = {} + if(answers.type != 'other') packet[answers.type] = answers[answers.type] + packet.sender = answers.uid + packet.reqid = crypto.randomUUID() + if(answers.payload) packet.payload = answers.payload + + if(answers.confirm=="send"){ + inject(answers.channel, packet) + } else if(answers.confirm=="save"){ + prompt({'type': 'input', 'name': 'filename', 'message': 'Filename ?'}).then(answer =>{ + let fileName = answer.filename + if(!fileName.endsWith('.bmsg')) fileName+='.bmsg' + fs.writeFileSync(fileName, JSON.stringify({ channel: answers.channel, packet: packet})) + }) + } + + }) +} + + diff --git a/Rabbit-injector/riConfig.json b/Rabbit-injector/riConfig.json new file mode 100644 index 0000000..958a692 --- /dev/null +++ b/Rabbit-injector/riConfig.json @@ -0,0 +1,13 @@ +{ + "redis":{ + "host": "127.0.0.1", + "tls": false, + "port": 6379, + "Xuser": "msgbus", + "Xpass": "yj465sqfCTA0bKDw3zEYg8OqYl9Tv", + "user": "", + "pass": "", + "basePrefix": "messageBus:", + "authTokenPrefix": "authorizer:message_bus_user_" + } +} diff --git a/Rabbit-injector/textEval-coverage.bmsg b/Rabbit-injector/textEval-coverage.bmsg new file mode 100644 index 0000000..a21052c --- /dev/null +++ b/Rabbit-injector/textEval-coverage.bmsg @@ -0,0 +1,14 @@ +{ + "channel":"services:evalText", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"action": "coverage", + "data": { + "question": "Describe how this project benefits the team.", + "answer": "This project helps streamline communication and reduce redundancy between the members.\nIt will be particularly be helpfull in nowadays tele-working context.\nTo reach that goal, we intend to blend AI directly whithin the current team's chat." + } + } + } +} diff --git a/Rabbit-injector/textEval-moderate.bmsg b/Rabbit-injector/textEval-moderate.bmsg new file mode 100644 index 0000000..09934d8 --- /dev/null +++ b/Rabbit-injector/textEval-moderate.bmsg @@ -0,0 +1,9 @@ +{ + "channel":"services:evalText", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"action": "moderate","data": {"text": "This fucker should tell you it is bad content for pussies !"}} + } +} diff --git a/Rabbit-injector/tst.js b/Rabbit-injector/tst.js new file mode 100644 index 0000000..eacdaec --- /dev/null +++ b/Rabbit-injector/tst.js @@ -0,0 +1,23 @@ +const { prompt } = require('enquirer'); + +const questions = [ + { + 'type': 'input', + 'name': 'uid', + 'message': 'Sender uid ? (Back-ends: backend-marklogic / backend-smed )' + }, + { + 'type': 'select', + 'name': 'type', + 'message': 'Type of message ?', + 'choices': [ + { 'message': 'Event', 'value': 'event' }, + { 'message': 'Action', 'value': 'action' }, + { 'message': 'Other', 'value': 'other' }, + ], + } + ] + + prompt(questions).then(answers => { + console.log(answers) + }) \ No newline at end of file diff --git a/Rabbit-injector/updateUserRoleSteinic.bmsg b/Rabbit-injector/updateUserRoleSteinic.bmsg new file mode 100644 index 0000000..4bf75a6 --- /dev/null +++ b/Rabbit-injector/updateUserRoleSteinic.bmsg @@ -0,0 +1,22 @@ +{ + "packet": { + "payload": { + "eventType": "updated", + "data": { + "roles": [ + "BP_PO", + "SP_Admin", + "Org_Admin", + "Org_Member", + "Org_Pending", + "SOE_Admin", + "COACH_Coach_Pending", + "PROJECT_FIO" + ], + "euLoginId": "steinic" + } + }, + "sender": "backend-marklogic" + }, + "channel": "dataSync:userRoles" +} diff --git a/Rabbit-injector/updateUserRoles-batch.bmsg b/Rabbit-injector/updateUserRoles-batch.bmsg new file mode 100644 index 0000000..95c3bdf --- /dev/null +++ b/Rabbit-injector/updateUserRoles-batch.bmsg @@ -0,0 +1,1073 @@ +[ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +}, +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +} +] diff --git a/Rabbit-injector/updateUserRoles1-oldStyle.bmsg b/Rabbit-injector/updateUserRoles1-oldStyle.bmsg new file mode 100644 index 0000000..a966dc8 --- /dev/null +++ b/Rabbit-injector/updateUserRoles1-oldStyle.bmsg @@ -0,0 +1,29 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "eventType": "updated", + "payload":{ + "euLoginId": "steinic", + "roles": [ + "BP_PO", + "COACH_Coach", + "Org_Member", + "Org_Pending", + "PROJECT_PO", + "SOE_Admin", + "SP_Admin", + "EIC_Admin", + "EIC_Dev", + "MAIL_Editor", + "MAIL_Reviewer", + "MAIL_Sender", + "TEMPLATE_Editor" + ] + } + } +} + + + diff --git a/Rabbit-injector/updateUserRoles1.bmsg b/Rabbit-injector/updateUserRoles1.bmsg new file mode 100644 index 0000000..5b5d776 --- /dev/null +++ b/Rabbit-injector/updateUserRoles1.bmsg @@ -0,0 +1,28 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "BP_PO", + "COACH_Coach", + "Org_Member", + "Org_Pending", + "PROJECT_PO", + "SOE_Admin", + "SP_Admin", + "EIC_Admin", + "EIC_Dev", + "MAIL_Editor", + "MAIL_Reviewer", + "MAIL_Sender", + "TEMPLATE_Editor" + ] + } + } + } +} diff --git a/Rabbit-injector/updateUserRoles2.bmsg b/Rabbit-injector/updateUserRoles2.bmsg new file mode 100644 index 0000000..7326853 --- /dev/null +++ b/Rabbit-injector/updateUserRoles2.bmsg @@ -0,0 +1,21 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "EIC_Admin", + "EIC_Dev", + "MAIL_Editor", + "MAIL_Reviewer", + "MAIL_Sender", + "TEMPLATE_Editor" + ] + } + } + } +} diff --git a/Rabbit-injector/updateUserRoles3.bmsg b/Rabbit-injector/updateUserRoles3.bmsg new file mode 100644 index 0000000..2695219 --- /dev/null +++ b/Rabbit-injector/updateUserRoles3.bmsg @@ -0,0 +1,19 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-marklogic", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "BP_PO", + "COACH_Coach", + "Org_Member", + "Org_Pending" + ] + } + } + } +} diff --git a/Rabbit-injector/updateUserRoles4.bmsg b/Rabbit-injector/updateUserRoles4.bmsg new file mode 100644 index 0000000..ecd566d --- /dev/null +++ b/Rabbit-injector/updateUserRoles4.bmsg @@ -0,0 +1,17 @@ +{ + "channel":"dataSync:userRoles", + "packet":{ + "sender":"backend-smed", + "reqid":"18dd9317-a08c-4f0a-9f4c-5a30860e02e4", + "payload": + {"eventType": "updated", + "payload": { + "euLoginId": "steinic", + "roles": [ + "SMED_role1", + "EIC_Dev" + ] + } + } + } +} diff --git a/package.json b/package.json index b89beac..33cce75 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "redis": "^4.3.0", "urldecode": "^1.0.1", "ws": "^8.8.1", - "yargs": "^17.5.1" + "yargs": "^17.7.2" }, "devDependencies": { "wscat": "^6.1.0"