Search in sources :

Example 6 with SecurityProvisioning

use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioning 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 7 with SecurityProvisioning

use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioning 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 8 with SecurityProvisioning

use of edu.cornell.kfs.ksr.businessobject.SecurityProvisioning in project cu-kfs by CU-CommunityApps.

the class SecurityProvisioningGroupRule method validateSecurityProvisioningGroup.

@SuppressWarnings("deprecation")
private boolean validateSecurityProvisioningGroup(MaintenanceDocument document, SecurityProvisioningGroup securityProvisioningGroup, int index) {
    boolean success = true;
    RoleLite role = StringUtils.isBlank(securityProvisioningGroup.getRoleId()) ? null : getRoleService().getRoleWithoutMembers(securityProvisioningGroup.getRoleId());
    if (role != null) {
        KimType kimType = getKimTypeInfoService().getKimType(role.getKimTypeId());
        KimTypeService kimTypeService = getKimTypeService(kimType);
        if (kimTypeService != null && kimTypeService instanceof org.kuali.kfs.kns.kim.role.DerivedRoleTypeServiceBase) {
            success = false;
            String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ROLE_NAME : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ROLE_NAME);
            GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_ROLE_DERIVED, getRoleNameForErrorMessage(securityProvisioningGroup.getRole()));
        }
    }
    if (success) {
        // check second against last.
        if (StringUtils.isNotBlank(securityProvisioningGroup.getDistributedAuthorizerRoleId())) {
            if (StringUtils.isNotBlank(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
                if (securityProvisioningGroup.getDistributedAuthorizerRoleId().equals(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL });
                }
            }
            if (StringUtils.isNotBlank(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                if (securityProvisioningGroup.getDistributedAuthorizerRoleId().equals(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL });
                }
            }
        }
        if (StringUtils.isNotBlank(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
            if (StringUtils.isNotBlank(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                if (securityProvisioningGroup.getAdditionalAuthorizerRoleId().equals(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL });
                }
            }
        }
    }
    SecurityProvisioning securityProvisioning = (SecurityProvisioning) document.getDocumentDataObject();
    List<SecurityProvisioningGroup> securityProvisioningGroupList = securityProvisioning.getSecurityProvisioningGroups();
    for (int i = 0; i < securityProvisioningGroupList.size(); i++) {
        if (i == index) {
            continue;
        }
        if (securityProvisioningGroup.getTabId() == null) {
            break;
        }
        if (securityProvisioningGroup.getTabId().equals(securityProvisioningGroupList.get(i).getTabId())) {
            if (securityProvisioningGroup.getRoleTabOrder() != null && securityProvisioningGroup.getRoleTabOrder().equals(securityProvisioningGroupList.get(i).getRoleTabOrder())) {
                success = false;
                String errorPath = (index < 0) ? KSRPropertyConstants.PROVISIONING_ROLE_TAB_ORDER : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.PROVISIONING_ROLE_TAB_ORDER);
                GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_TAB_ORDER_UNIQUE, getRoleNameForErrorMessage(securityProvisioningGroup.getRole()));
            }
        }
    }
    return success;
}
Also used : KimType(org.kuali.kfs.kim.impl.type.KimType) SecurityProvisioning(edu.cornell.kfs.ksr.businessobject.SecurityProvisioning) SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) KimTypeService(org.kuali.kfs.kim.framework.type.KimTypeService) RoleLite(org.kuali.kfs.kim.impl.role.RoleLite)

Aggregations

SecurityProvisioning (edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)8 SecurityProvisioningGroup (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup)6 HashMap (java.util.HashMap)3 SecurityProvisioningGroupDependentRoles (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroupDependentRoles)2 SecurityGroupTab (edu.cornell.kfs.ksr.businessobject.SecurityGroupTab)1 ArrayList (java.util.ArrayList)1 ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)1 KeyValue (org.kuali.kfs.core.api.util.KeyValue)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 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)1 KualiForm (org.kuali.kfs.kns.web.struts.form.KualiForm)1 Document (org.kuali.kfs.krad.document.Document)1