In this post we explained how to create users in IdCS with the REST API. Typically you would like to put an approval process in between, here we explain a simple solution for those use cases where you don’t have or don’t want to put in the picture other pieces such as BPM, workflow or other typical engines.
STEP ONE AND ONLY
Create a Node.js gadget that sends an email to an approval email account with a message body that exposes an Accept and a Reject Button. The Accept button should call the create user procedure explained here.
Replace the text in bold with your own values and change the default buttons actions to a call to an exposed service that implements the create user procedure mentioned.
const nodemailer = require('nodemailer'); let transporter = nodemailer.createTransport({ host: 'estibijaif.oracol.com', port: 465, secure: 'estibijaif.oracol.com', auth: { user: 'xxxxxx@oracol.com', pass: 'morefoolsthanbottles' } }); let message = { from: 'MRO <xxxxxx@oracol.com>', to: 'Recipient <xxxxxx@oracol.com>', subject: 'New user request', text: 'Hello!', html: '<head><style>.button {background-color: #4ecdc4;border-color: #45b7af;border-radius: 5px;text-align: center;padding: \ 10px;}.button a {color: #ffffff;display: block;font-size: 14px;text-decoration: none;text-transform: uppercase;}</style> \ </head>A new user alextorrijo@acme.com from Acme has been requested, please accept or reject with the buttons as follows<table> \ <tr><td style="background-color: #4ecdc4;border-color: #4c5764;border: 2px solid #45b7af;padding: 10px;text-align: center;"> <a style="display: block;color: #ffffff;font-size: 12px;text-decoration: none;text-transform: uppercase;" href="https://javiermugueta.wordpress.com">Accept</a></td></tr><tr><td style="background-color: #4ecdc4;border-color: #4c5764;border: 2px solid #45b7af;padding: 10px;text-align: center;"><a style="display: block;color: #ffffff;font-size: 12px;text-decoration: none;text-transform: uppercase;" href="https://javiermugueta.wordpress.com">Reject</a></td></tr></table>' }; transporter.sendMail(message, (err, info) => { if (err) { console.log('Error occurred. ' + err.message); return process.exit(1); } console.log('Message sent: %s', info.messageId); });

This Node.js procedure can be developed in Oracle Developer Cloud Service (DevCS) and deployed in Oracle Application Container Cloud Service (ACCS) easily.
See also this post
Enjoy 😉
One Comment