src/org/ohmage/service/UserCampaignServices.java
public void verifyUserCanUpdateCampaign(final String username, 
			final String campaignId) throws ServiceException {
		
		try {
		    	// Get the user's roles for this campaign.
			List<Campaign.Role> roles = userCampaignQueries.getUserCampaignRoles(username, campaignId);
			
			// If the user isn't a supervisor or an author, then they aren't 
			// allowed to update it.
			if(roles.contains(Campaign.Role.SUPERVISOR) ||
			   roles.contains(Campaign.Role.AUTHOR)) {
				return;
			}
			
			throw new ServiceException(
					ErrorCode.CAMPAIGN_INSUFFICIENT_PERMISSIONS, 
					"The user is not allowed to update the campaign.");
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Verifies that some user is allowed to update some campaign.
	 * 
	 * @param username The username of the user.
	 * 
	 * @param campaignId The unique identifier for the campaign.
	 * 
	 * @throws ServiceException Thrown if the user is not allowed to update 
	 * 							this campaign or if there is an error.
	 */
Verifies that some user is allowed to update some campaign.

@param username The username of the user.

@param campaignId The unique identifier for the campaign.

@throws ServiceException Thrown if the user is not allowed to update
this campaign or if there is an error.
Verifies that some user is allowed to update some campaign . @param username The username of the user . @param campaignId The unique identifier for the campaign . @throws ServiceException Thrown if the user is not allowed to update this campaign or if there is an error .
public void verifyUserCanUpdateCampaign(final String username, 
			final String campaignId) throws ServiceException {
		try {
			List<Campaign.Role> roles = userCampaignQueries.getUserCampaignRoles(username, campaignId);
			if(roles.contains(Campaign.Role.SUPERVISOR) ||
			   roles.contains(Campaign.Role.AUTHOR)) {
				return;
			}
			throw new ServiceException(
					ErrorCode.CAMPAIGN_INSUFFICIENT_PERMISSIONS, 
					"The user is not allowed to update the campaign.");
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyUserCanUpdateCampaign ( final String username , final String campaignId ) throws ServiceException { try { List < Campaign . Role > roles = userCampaignQueries . getUserCampaignRoles ( username , campaignId ) ; if ( roles . contains ( Campaign . Role . SUPERVISOR ) || roles . contains ( Campaign . Role . AUTHOR ) ) { return ; } throw new ServiceException ( ErrorCode . CAMPAIGN_INSUFFICIENT_PERMISSIONS , "The user is not allowed to update the campaign." ) ; } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Verifies that some user is allowed to update some campaign.
Verifies that some user is allowed to update some campaign .
// Get the user's roles for this campaign. // If the user isn't a supervisor or an author, then they aren't  // allowed to update it.