/** * @see * org.kuali.kra.proposaldevelopment.service.NarrativeAuthZService#getDefaultNarrativeRight(java.lang.String, * org.kuali.kra.proposaldevelopment.document.ProposalDevelopmentDocument) */ public NarrativeRight getDefaultNarrativeRight(String userId, ProposalDevelopmentDocument doc) { NarrativeRight right; if (kraAuthorizationService.hasPermission(userId, doc, PermissionConstants.MODIFY_NARRATIVE)) { right = NarrativeRight.MODIFY_NARRATIVE_RIGHT; } else if (kraAuthorizationService.hasPermission( userId, doc, PermissionConstants.VIEW_NARRATIVE)) { right = NarrativeRight.VIEW_NARRATIVE_RIGHT; } else { right = NarrativeRight.NO_NARRATIVE_RIGHT; } return right; }
/** * Does the given user have the given permission for the proposal? * * @param userId the user's username * @param doc the Proposal Development Document * @param permissionName the name of the permission * @return true if user has permission; otherwise false */ protected boolean hasPermission( String userId, ProposalDevelopmentDocument doc, String permissionName) { KraAuthorizationService kraAuthorizationService = KraServiceLocator.getService(KraAuthorizationService.class); return kraAuthorizationService.hasPermission(userId, doc, permissionName); }