/** Test the hasRole() service method. */ @Test public void testHasRole() throws Exception { ProposalDevelopmentDocument doc = createProposal("Proposal-7", "000001"); PrincipalContract userChew = identityManagementService.getPrincipalByPrincipalName("chew"); kraAuthService.addDocumentLevelRole( userChew.getPrincipalId(), RoleConstants.BUDGET_CREATOR, doc); assertTrue( kraAuthService.hasDocumentLevelRole( userChew.getPrincipalId(), RoleConstants.BUDGET_CREATOR, doc)); }
/** * Create the original set of Proposal Users for a new Proposal Development Document. The creator * the proposal is assigned to the AGGREGATOR role. */ protected void initializeProposalUsers(ProposalDevelopmentDocument doc) { // Assign the creator of the proposal to the AGGREGATOR role. String userId = GlobalVariables.getUserSession().getPrincipalId(); if (!kraAuthorizationService.hasDocumentLevelRole(userId, RoleConstants.AGGREGATOR, doc)) kraAuthorizationService.addDocumentLevelRole(userId, RoleConstants.AGGREGATOR, doc); // Add the users defined in the role templates for the proposal's lead unit proposalRoleTemplateService.addUsers(doc); }