Search in sources :

Example 1 with RoleLite

use of org.kuali.kfs.kim.impl.role.RoleLite in project cu-kfs by CU-CommunityApps.

the class OrgReviewRole method setRoleId.

public void setRoleId(String roleId) {
    RoleLite roleInfo = KimApiServiceLocator.getRoleService().getRoleWithoutMembers(roleId);
    if (roleInfo != null) {
        setNamespaceCode(roleInfo.getNamespaceCode());
        setRoleName(roleInfo.getName());
        setKimTypeId(roleInfo.getKimTypeId());
    }
    this.roleId = roleId;
}
Also used : RoleLite(org.kuali.kfs.kim.impl.role.RoleLite)

Example 2 with RoleLite

use of org.kuali.kfs.kim.impl.role.RoleLite in project cu-kfs by CU-CommunityApps.

the class OrgReviewRoleServiceImpl method getRoleMembers.

protected List<RoleMember> getRoleMembers(OrgReviewRole orr) {
    List<RoleMember> objectsToSave = new ArrayList<>();
    List<String> roleNamesToSaveFor = getRolesToSaveFor(orr.getRoleNamesToConsider(), orr.getReviewRolesIndicator());
    for (String roleName : roleNamesToSaveFor) {
        RoleLite roleInfo = getRoleInfo(roleName);
        RoleMember roleMemberToSave = getRoleMemberToSave(roleInfo, orr);
        if (roleMemberToSave != null) {
            objectsToSave.add(roleMemberToSave);
        }
    }
    return objectsToSave;
}
Also used : RoleLite(org.kuali.kfs.kim.impl.role.RoleLite) ArrayList(java.util.ArrayList) RoleMember(org.kuali.kfs.kim.impl.role.RoleMember)

Example 3 with RoleLite

use of org.kuali.kfs.kim.impl.role.RoleLite 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)

Example 4 with RoleLite

use of org.kuali.kfs.kim.impl.role.RoleLite in project cu-kfs by CU-CommunityApps.

the class RassProjectDirectorConverter method doesPersonHaveProjectDirectorRole.

protected boolean doesPersonHaveProjectDirectorRole(Person person) {
    RoleLite orojectDirectRole = roleService.getRoleByNamespaceCodeAndName(KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR);
    if (ObjectUtils.isNull(orojectDirectRole)) {
        throw new RuntimeException("Unable to find Contracts and Greants project director role");
    }
    List<String> roleIds = new ArrayList<String>();
    roleIds.add(orojectDirectRole.getId());
    return roleService.principalHasRole(person.getPrincipalId(), roleIds, new HashMap<String, String>());
}
Also used : RoleLite(org.kuali.kfs.kim.impl.role.RoleLite) ArrayList(java.util.ArrayList)

Example 5 with RoleLite

use of org.kuali.kfs.kim.impl.role.RoleLite in project cu-kfs by CU-CommunityApps.

the class RassMockServiceFactory method buildMockRoleService.

public RoleService buildMockRoleService() {
    RoleLite projectDirectRole = new RoleLite();
    projectDirectRole.setId("123");
    projectDirectRole.setName(KFSConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR);
    projectDirectRole.setNamespaceCode(KFSConstants.CoreModuleNamespaces.KFS);
    projectDirectRole.setKimTypeId("R");
    RoleService roleService = Mockito.mock(RoleService.class);
    Mockito.when(roleService.getRoleByNamespaceCodeAndName(KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR)).thenReturn(projectDirectRole);
    Mockito.when(roleService.principalHasRole(Mockito.anyString(), Mockito.any(), Mockito.any())).thenReturn(true);
    return roleService;
}
Also used : RoleService(org.kuali.kfs.kim.api.role.RoleService) RoleLite(org.kuali.kfs.kim.impl.role.RoleLite)

Aggregations

RoleLite (org.kuali.kfs.kim.impl.role.RoleLite)5 ArrayList (java.util.ArrayList)2 SecurityProvisioning (edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)1 SecurityProvisioningGroup (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup)1 RoleService (org.kuali.kfs.kim.api.role.RoleService)1 KimTypeService (org.kuali.kfs.kim.framework.type.KimTypeService)1 RoleMember (org.kuali.kfs.kim.impl.role.RoleMember)1 KimType (org.kuali.kfs.kim.impl.type.KimType)1