Search in sources :

Example 6 with SecurityProvisioningGroup

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);
}
Also used : SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) SecurityGroupTab(edu.cornell.kfs.ksr.businessobject.SecurityGroupTab) ArrayList(java.util.ArrayList) SecurityRequestRole(edu.cornell.kfs.ksr.businessobject.SecurityRequestRole)

Example 7 with SecurityProvisioningGroup

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;
}
Also used : SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) SecurityProvisioning(edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)

Example 8 with SecurityProvisioningGroup

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;
}
Also used : SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) SecurityProvisioning(edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)

Example 9 with SecurityProvisioningGroup

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;
}
Also used : SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) SecurityProvisioningGroupDependentRoles(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroupDependentRoles)

Example 10 with SecurityProvisioningGroup

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;
}
Also used : SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) SecurityProvisioningGroupDependentRoles(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroupDependentRoles)

Aggregations

SecurityProvisioningGroup (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup)12 SecurityProvisioning (edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)6 SecurityProvisioningGroupDependentRoles (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroupDependentRoles)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)3 SecurityGroupTab (edu.cornell.kfs.ksr.businessobject.SecurityGroupTab)2 SecurityRequestRole (edu.cornell.kfs.ksr.businessobject.SecurityRequestRole)2 SecurityRequestDocument (edu.cornell.kfs.ksr.document.SecurityRequestDocument)1 KimTypeService (org.kuali.kfs.kim.framework.type.KimTypeService)1 RoleLite (org.kuali.kfs.kim.impl.role.RoleLite)1 KimType (org.kuali.kfs.kim.impl.type.KimType)1 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)1