use of org.finra.gatekeeper.services.accessrequest.model.UserRole in project Gatekeeper by FINRAOS.
the class RevokeAccessServiceTask method execute.
/**
* @param execution - the request to execute on
* @throws Exception - if the revocation fails
*/
public void execute(DelegateExecution execution) throws Exception {
Job job = managementService.createJobQuery().processInstanceId(execution.getProcessInstanceId()).singleResult();
AccessRequest accessRequest = (AccessRequest) execution.getVariable("accessRequest");
try {
logger.info("Revoking access for Users, Attempts remaining: " + job.getRetries());
for (User user : accessRequest.getUsers()) {
for (UserRole role : accessRequest.getRoles()) {
databaseConnectionService.revokeAccess(accessRequest.getAwsRdsInstances(), RoleType.valueOf(role.getRole().toUpperCase()), user.getUserId());
}
}
} catch (Exception e) {
if (job.getRetries() - 1 == 0) {
logger.error("Maximum attempt limit reached. Notify Ops team for manual removal");
emailServiceWrapper.notifyOps(accessRequest);
emailServiceWrapper.notifyAdminsOfFailure(accessRequest, e);
} else {
throw e;
}
}
}
use of org.finra.gatekeeper.services.accessrequest.model.UserRole in project Gatekeeper by FINRAOS.
the class GatekeeperOverrideProperties method getMaxDaysForRequest.
public Integer getMaxDaysForRequest(GatekeeperRdsRole requestorRole, List<UserRole> roleList, String sdlc) {
Integer currMax = maxDays;
// For each role let's check if there was some override value set.
for (UserRole role : roleList) {
Map<String, Map<String, Integer>> overridePolicy = getOverridePolicy(requestorRole);
// if there's a policy then lets keep going
if (overridePolicy != null && overridePolicy.containsKey(role.getRole()) && overridePolicy.containsValue(overridePolicy.get(role.getRole()))) {
Map<String, Integer> env = overridePolicy.get(role.getRole());
Integer max = env.get(sdlc) != null ? env.get(sdlc) : maxDays;
currMax = max < currMax ? max : currMax;
}
}
return currMax;
}
Aggregations