@Override protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); if ( (dataObject instanceof PositionBo) || (dataObject instanceof PositionContract) || (dataObject instanceof Position)) { PositionBo positionObj = (PositionBo) dataObject; if (positionObj != null) { Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(positionObj.getPrimaryDepartment(), positionObj.getGroupKeyCode(), positionObj.getEffectiveLocalDate()); if (departmentObj != null) { attributes.put(KPMERoleMemberAttribute.INSTITUION.getRoleMemberAttributeName(), departmentObj.getGroupKey().getInstitutionCode()); attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), departmentObj.getDept()); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), departmentObj.getGroupKey().getLocationId()); attributes.put(KPMERoleMemberAttribute.ORGANIZATION.getRoleMemberAttributeName(), departmentObj.getOrg()); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), departmentObj.getGroupKeyCode()); } else { attributes.put(KPMERoleMemberAttribute.INSTITUION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.ORGANIZATION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%"); } } } }
protected List<ClockLogBo> filterLookupResults(List<ClockLogBo> rawResults, String userPrincipalId) { List<ClockLogBo> results = new ArrayList<ClockLogBo>(); for (ClockLogBo clockLogObj : rawResults) { String department = clockLogObj.getDept(); String groupKeyCode = clockLogObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, clockLogObj.getClockDateTime().toLocalDate()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(clockLogObj); } } return results; }
public List<DailyOvertimeRule> getDailyOvertimeRules(String userPrincipalId, List <DailyOvertimeRule> dailyOvertimeRuleObjs){ List<DailyOvertimeRule> results = new ArrayList<DailyOvertimeRule>(); if ( dailyOvertimeRuleObjs != null ){ for (DailyOvertimeRule dailyOvertimeRuleObj : dailyOvertimeRuleObjs) { String department = dailyOvertimeRuleObj.getDept(); String groupKeyCd = dailyOvertimeRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCd, dailyOvertimeRuleObj.getEffectiveLocalDate()); String loc = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCd); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), loc); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(dailyOvertimeRuleObj); } } } return results; } }
public List<ClockLocationRule> getClockLocationRules(String userPrincipalId, List <ClockLocationRule> clockLocationRuleObjs) { List<ClockLocationRule> results = new ArrayList<ClockLocationRule>(); if ( clockLocationRuleObjs != null ){ for (ClockLocationRule clockLocationRuleObj : clockLocationRuleObjs) { String department = clockLocationRuleObj.getDept(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, clockLocationRuleObj.getGroupKeyCode(), clockLocationRuleObj.getEffectiveLocalDate()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; String groupKeyCode = departmentObj != null ? departmentObj.getGroupKeyCode() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(clockLocationRuleObj); } } } return results; } }
@Override public List<DeptLunchRule> getDepartmentLunchRules(String userPrincipalId, List<DeptLunchRule> departmentLunchRuleObjs) { List<DeptLunchRule> results = new ArrayList<DeptLunchRule>(); if (departmentLunchRuleObjs != null ){ for (DeptLunchRule departmentLunchRuleObj : departmentLunchRuleObjs) { String department = departmentLunchRuleObj.getDept(); String grpKeyCode = departmentLunchRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, grpKeyCode, departmentLunchRuleObj.getEffectiveLocalDate()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), grpKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(departmentLunchRuleObj); } } } return results; } }
public List<TimeCollectionRule> getTimeCollectionRules(String userPrincipalId, List <TimeCollectionRule> timeCollectionRuleObjs){ List<TimeCollectionRule> results = new ArrayList<TimeCollectionRule>(); if ( timeCollectionRuleObjs != null ){ for (TimeCollectionRule timeCollectionRuleObj : timeCollectionRuleObjs) { String department = timeCollectionRuleObj.getDept(); String grpKeyCode = timeCollectionRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, grpKeyCode, timeCollectionRuleObj.getEffectiveLocalDate()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> permissionDetails = new HashMap<String, String>(); permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, KRADServiceLocatorWeb.getDocumentDictionaryService().getMaintenanceDocumentTypeName(TimeCollectionRule.class)); Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), grpKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), permissionDetails) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), permissionDetails, roleQualification)) { results.add(timeCollectionRuleObj); } } } return results; } }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof TimeCollectionRule) { TimeCollectionRule timeCollectionRuleObj = (TimeCollectionRule) dataObject; if (timeCollectionRuleObj != null) { department = timeCollectionRuleObj.getDept(); groupKeyCode = timeCollectionRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, timeCollectionRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof ClockLocationRule) { ClockLocationRule clockLocationRuleObj = (ClockLocationRule) dataObject; if (clockLocationRuleObj != null) { department = clockLocationRuleObj.getDept(); groupKeyCode = clockLocationRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, clockLocationRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof DeptLunchRule) { DeptLunchRule departmentLunchRuleObj = (DeptLunchRule) dataObject; if (departmentLunchRuleObj != null) { department = departmentLunchRuleObj.getDept(); groupKeyCode = departmentLunchRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, departmentLunchRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
private List<MissedPunchBo> filterByPrincipalId(List<MissedPunchBo> missedPunches, String principalId) { List<MissedPunchBo> results = new ArrayList<MissedPunchBo>(); //TODO - performance too many db calls in loop for (MissedPunchBo missedPunch : missedPunches) { JobContract jobObj = HrServiceLocator.getJobService().getJob(missedPunch.getPrincipalId(), missedPunch.getJobNumber(), LocalDate.fromDateFields(missedPunch.getActionDate())); String department = jobObj != null ? jobObj.getDept() : null; String groupKeyCode = jobObj != null ? jobObj.getGroupKeyCode() : null; Department departmentObj = jobObj != null ? HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.fromDateFields(missedPunch.getActionDate())) : null; String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, GlobalVariables.getUserSession().getPrincipalId()); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(principalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(missedPunch); } } return results; }
private List<TimeBlockBo> filterByPrincipalId(List<TimeBlockBo> timeBlocks, String principalId) { List<TimeBlockBo> results = new ArrayList<TimeBlockBo>(); //TODO - performance too many db calls in loop for (TimeBlockBo timeBlock : timeBlocks) { JobContract jobObj = HrServiceLocator.getJobService().getJob(timeBlock.getPrincipalId(), timeBlock.getJobNumber(), LocalDate.fromDateFields(timeBlock.getBeginDate()), false); String department = jobObj != null ? jobObj.getDept() : null; String groupKeyCode = jobObj != null ? jobObj.getGroupKeyCode() : null; Department departmentObj = jobObj != null ? HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.fromDateFields(timeBlock.getBeginDate())) : null; String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, GlobalVariables.getUserSession().getPrincipalId()); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(principalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(timeBlock); } } return results; }
private List<TimeBlockHistory> filterByPrincipalId(List<TimeBlockHistory> timeBlockHistories, String principalId) { List<TimeBlockHistory> results = new ArrayList<TimeBlockHistory>(); //TODO - performance too many db calls in loop for (TimeBlockHistory timeBlockHistory : timeBlockHistories) { JobContract jobObj = HrServiceLocator.getJobService().getJob(timeBlockHistory.getPrincipalId(), timeBlockHistory.getJobNumber(), LocalDate.fromDateFields(timeBlockHistory.getBeginDate()), false); String department = jobObj != null ? jobObj.getDept() : null; String groupKeyCode = jobObj != null ? jobObj.getGroupKeyCode() : null; Department departmentObj = jobObj != null ? HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.fromDateFields(timeBlockHistory.getBeginDate())) : null; String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, GlobalVariables.getUserSession().getPrincipalId()); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(principalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(timeBlockHistory); } } return results; }
String groupKeyCode = job.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, effectiveLocalDate); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; if (LmServiceLocator.getLMPermissionService().isAuthorizedInDepartment(userPrincipalId, "View Leave Payout", department, groupKeyCode, effectiveDate) || LmServiceLocator.getLMPermissionService().isAuthorizedInLocation(userPrincipalId, "View Leave Payout", location, effectiveDate)) {
String groupKeyCode = job.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, effectiveLocalDate); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null;
if(aDept != null) { if(HrServiceLocator.getKPMERoleService() .principalHasRoleInLocation(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_ADMINISTRATOR.getRoleName(), aDept.getGroupKey().getLocationId(), asOfDate) || HrServiceLocator.getKPMERoleService() .principalHasRoleInLocation(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.LEAVE_LOCATION_ADMINISTRATOR.getRoleName(), aDept.getGroupKey().getLocationId(), asOfDate)) { loggedInUserassignments.add(anAssignment); continue;
@Override public boolean userHasTimeSysLocationAdminRoles(String principalId,TimeBlockContract aTimeBlock) { DateTime asOfDate = LocalDate.now().toDateTimeAtStartOfDay(); // system admin or TimeSysAdmin has full permissions when they are not working on their own timesheet, no need to check earnCodeSecurity in this case if(HrServiceLocator.getKPMEGroupService().isMemberOfSystemAdministratorGroup(principalId, asOfDate ) || HrServiceLocator.getKPMERoleService().principalHasRole(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_SYSTEM_ADMINISTRATOR.getRoleName(), asOfDate)) { return true; } // use job to find the department, then use the location from Department to get the location roles JobContract aJob = HrServiceLocator.getJobService().getJob(aTimeBlock.getPrincipalId(), aTimeBlock.getJobNumber(), aTimeBlock.getEndDateTime().toLocalDate()); if(aJob != null) { Department aDept = HrServiceLocator.getDepartmentService().getDepartment(aJob.getDept(), aJob.getGroupKeyCode(), aJob.getEffectiveLocalDate()); if(aDept != null) { // TimeLocationAdmin if(HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_ADMINISTRATOR.getRoleName(), aDept.getGroupKey().getLocationId(), asOfDate)) return true; } } return false; }
String groupKeyCode = clockLocationRule.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.now()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null;
String groupKeyCode = clockLocationRule.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.now()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null;
private boolean isAdministratorForPerson(String principalId, LocalDate aDate) { List<Job> jobs = HrServiceLocator.getJobService().getJobs(principalId, aDate); for (Job job : jobs) { String department = job != null ? job.getDept() : null; String groupKeyCode = job != null ? job.getGroupKeyCode() : null; Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.now()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; if (HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_DEPARTMENT_ADMINISTRATOR.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_DEPARTMENT_ADMINISTRATOR.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_ADMINISTRATOR.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_LOCATION_ADMINISTRATOR.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay())) { return true; } } return false; }
private boolean isViewOnlyForPerson(String principalId, LocalDate aDate) { List<Job> jobs = HrServiceLocator.getJobService().getJobs(principalId, aDate); for (Job job : jobs) { String department = job != null ? job.getDept() : null; String groupKeyCode = job != null ? job.getGroupKeyCode() : null; Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.now()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; if (HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_DEPARTMENT_VIEW_ONLY.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_DEPARTMENT_VIEW_ONLY.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_VIEW_ONLY.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_LOCATION_VIEW_ONLY.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay())) { return true; } } //check if user has a recently changed assignment for (Assignment assignment : HrServiceLocator.getAssignmentService().getRecentAssignments(principalId)){ if (HrServiceLocator.getKPMERoleService().principalHasRoleInWorkArea(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.APPROVER_DELEGATE.getRoleName(), assignment.getWorkArea(), LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInWorkArea(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.APPROVER.getRoleName(), assignment.getWorkArea(), LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.PAYROLL_PROCESSOR.getRoleName(), assignment.getDept(), assignment.getGroupKeyCode(), LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.PAYROLL_PROCESSOR_DELEGATE.getRoleName(), assignment.getDept(), assignment.getGroupKeyCode(), LocalDate.now().toDateTimeAtStartOfDay())) { return true; } } return false; }