use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup in project cu-kfs by CU-CommunityApps.
the class SecurityRequestDocumentServiceImpl method buildSecurityRequestRoles.
protected void buildSecurityRequestRoles(SecurityRequestDocument document) {
List<SecurityRequestRole> requestRoles = new ArrayList<SecurityRequestRole>();
long roleRequestId = 1;
for (SecurityGroupTab groupTab : document.getSecurityGroup().getSecurityGroupTabs()) {
if (groupTab.isActive()) {
for (SecurityProvisioningGroup provisioningGroup : groupTab.getSecurityProvisioningGroups()) {
if (provisioningGroup.isActive()) {
SecurityRequestRole requestRole = new SecurityRequestRole();
requestRole.setDocumentNumber(document.getDocumentNumber());
requestRole.setRoleId(provisioningGroup.getRoleId());
requestRole.setRoleRequestId(Long.valueOf(roleRequestId));
buildSecurityRequestRoleQualifications(requestRole, document.getPrincipalId());
roleRequestId++;
requestRoles.add(requestRole);
}
}
}
}
document.setSecurityRequestRoles(requestRoles);
}
use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup in project cu-kfs by CU-CommunityApps.
the class SecurityProvisioningGroupRule method hasSecurityProvisioningGroup.
private boolean hasSecurityProvisioningGroup(MaintenanceDocument document, SecurityProvisioningGroupDependentRoles dependentRole, int index, int indexRole) {
if (!dependentRole.isActive()) {
return true;
}
boolean success = false;
SecurityProvisioning securityProvisioning = (SecurityProvisioning) document.getDocumentDataObject();
List<SecurityProvisioningGroup> securityProvisioningGroups = securityProvisioning.getSecurityProvisioningGroups();
for (int i = 0; i < securityProvisioningGroups.size(); i++) {
SecurityProvisioningGroup securityProvisioningGroup = securityProvisioningGroups.get(i);
if (StringUtils.isNotBlank(securityProvisioningGroup.getRoleId()) && StringUtils.equals(securityProvisioningGroup.getRoleId(), dependentRole.getRoleId()) && securityProvisioningGroup.isActive()) {
success = true;
}
}
if (!success) {
String errorPath = (indexRole < 0 || index < 0) ? KSRPropertyConstants.PROVISIONING_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), buildIndexedProperty(KSRConstants.DEPENDENT_ROLES, indexRole), KSRPropertyConstants.PROVISIONING_ROLE_ID);
GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_DEPENDENT_ROLE_MATCH, getRoleNameForErrorMessage(dependentRole.getRole()));
}
return success;
}
use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup in project cu-kfs by CU-CommunityApps.
the class SecurityProvisioningGroupRule method isDuplicateSecurityProvisioningGroup.
private boolean isDuplicateSecurityProvisioningGroup(MaintenanceDocument document, SecurityProvisioningGroup securityProvisioningGroup, int index) {
boolean success = true;
SecurityProvisioning securityProvisioning = (SecurityProvisioning) document.getDocumentDataObject();
for (int i = 0; i < securityProvisioning.getSecurityProvisioningGroups().size(); i++) {
SecurityProvisioningGroup tempProvisioningGroup = securityProvisioning.getSecurityProvisioningGroups().get(i);
if (i == index) {
continue;
}
if (!tempProvisioningGroup.isActive() || StringUtils.isBlank(tempProvisioningGroup.getRoleId())) {
continue;
}
if (StringUtils.equals(tempProvisioningGroup.getRoleId(), securityProvisioningGroup.getRoleId())) {
success = false;
String errorPath = (index < 0) ? KSRPropertyConstants.PROVISIONING_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.PROVISIONING_ROLE_ID);
if ((index == -1) || (index > i)) {
GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_ROLE_UNIQUE, getRoleNameForErrorMessage(securityProvisioningGroup.getRole()));
}
}
}
return success;
}
use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup in project cu-kfs by CU-CommunityApps.
the class SecurityProvisioningGroupRule method buildDependentString.
private String buildDependentString(String roleID, Map<String, SecurityProvisioningGroup> provisioningMap) {
String temp = "|" + roleID + "|";
SecurityProvisioningGroup securityProvisioningGroup = provisioningMap.get(roleID);
provisioningMap.remove(roleID);
if ((securityProvisioningGroup != null) && (securityProvisioningGroup.getDependentRoles().size() > 0)) {
for (SecurityProvisioningGroupDependentRoles dependentRole : securityProvisioningGroup.getDependentRoles()) {
if (dependentRole.isActive() && StringUtils.isNotBlank(dependentRole.getRoleId())) {
String dependentRoleID = dependentRole.getRoleId();
temp += buildDependentString(dependentRoleID, provisioningMap);
}
}
}
return "," + temp;
}
use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup in project cu-kfs by CU-CommunityApps.
the class SecurityProvisioningGroupRule method processCustomAddCollectionLineBusinessRules.
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject line) {
boolean success = true;
if (line instanceof SecurityProvisioningGroupDependentRoles) {
SecurityProvisioningGroupDependentRoles dependentRole = (SecurityProvisioningGroupDependentRoles) line;
success = validateDependentRole(dependentRole);
} else if (line instanceof SecurityProvisioningGroup) {
SecurityProvisioningGroup securityProvisioningGroup = (SecurityProvisioningGroup) line;
success = validateSecurityProvisioningGroup(document, securityProvisioningGroup);
if (success && securityProvisioningGroup.isActive()) {
success = isDuplicateSecurityProvisioningGroup(document, (SecurityProvisioningGroup) line);
}
}
success &= super.processCustomAddCollectionLineBusinessRules(document, collectionName, line);
return success;
}
Aggregations