use of com.tremolosecurity.provisioning.scheduler.jobs.util.FailApproval in project OpenUnison by TremoloSecurity.
the class AutoFailApprovalListener method onMessage.
@Override
public void onMessage(ConfigManager cfg, Object payload, Message msg) throws ProvisioningException {
FailApproval fa = (FailApproval) payload;
GlobalEntries.getGlobalEntries().getConfigManager().getProvisioningEngine().doApproval(fa.getApprovalID(), fa.getApprover(), false, fa.getMsg());
}
use of com.tremolosecurity.provisioning.scheduler.jobs.util.FailApproval in project OpenUnison by TremoloSecurity.
the class AutoFail method execute.
@Override
public void execute(ConfigManager configManager, JobExecutionContext context) throws ProvisioningException {
if (configManager == null || configManager.getProvisioningEngine() == null) {
logger.warn("System not fully initialized");
return;
}
String queueName = context.getJobDetail().getJobDataMap().getString("queueName");
String approver = context.getJobDetail().getJobDataMap().getString("approver");
String msg = context.getJobDetail().getJobDataMap().getString("message");
ApprovalSummaries summaries = ServiceActions.listOpenApprovals(approver, "", configManager);
try {
this.createConnections(configManager, queueName);
Gson gson = new Gson();
for (ApprovalSummary sum : summaries.getApprovals()) {
FailApproval fa = new FailApproval();
fa.setApprovalID(sum.getApproval());
fa.setApprover(approver);
fa.setMsg(msg);
EncryptedMessage em = configManager.getProvisioningEngine().encryptObject(fa);
synchronized (sessionHolder) {
TextMessage tmsg = sessionHolder.getSession().createTextMessage(gson.toJson(em));
tmsg.setStringProperty("JMSXGroupID", "unison-autofail");
sessionHolder.getMessageProduceer().send(tmsg);
}
}
} catch (Throwable t) {
throw new ProvisioningException("Could not process open approvals", t);
}
}
Aggregations