protected void isAuthorized() { // check permissions boolean userHasPermission = false; String permissionName = AwardPermissionConstants.VIEW_AWARD.getAwardPermission(); userHasPermission = getUnitAuthorizationService() .hasPermission( GlobalVariables.getUserSession().getPrincipalId(), "KC-AWARD", permissionName); if (!userHasPermission) { permissionName = AwardPermissionConstants.MODIFY_AWARD.getAwardPermission(); userHasPermission = getUnitAuthorizationService() .hasPermission( GlobalVariables.getUserSession().getPrincipalId(), "KC-AWARD", permissionName); } if (!userHasPermission) { permissionName = AwardPermissionConstants.MODIFY_AWARD_REPORT_TRACKING.getAwardPermission(); userHasPermission = getUnitAuthorizationService() .hasPermission( GlobalVariables.getUserSession().getPrincipalId(), "KC-AWARD", permissionName); } if (!userHasPermission) { throw new AuthorizationException( GlobalVariables.getUserSession().getPrincipalName(), "Search", "Report Tracking"); } }
/** * @see org.kuali.kra.award.document.authorizer.AwardAuthorizer#isAuthorized(java.lang.String, * org.kuali.kra.award.document.authorization.AwardTask) */ @Override public boolean isAuthorized(String userId, AwardTask task) { return !task.getAward().getAwardDocument().isViewOnly() && hasPermission( userId, task.getAward(), AwardPermissionConstants.MODIFY_AWARD.getAwardPermission()); }