src/org/ohmage/service/UserSurveyResponseServices.java
public void verifyUserCanUpdateOrDeleteSurveyResponse(
			final String requesterUsername, final UUID surveyResponseId) 
			throws ServiceException {
		
		try {
			// Get the response's campaign.
			String campaignId = campaignSurveyResponseQueries.getCampaignIdFromSurveyId(surveyResponseId);
			
			if(userCampaignQueries.getUserCampaignRoles(requesterUsername, campaignId).contains(Campaign.Role.SUPERVISOR)) {
				return;
			}
			
			if(Campaign.RunningState.RUNNING.equals(campaignQueries.getCampaignRunningState(campaignId))) {
				if(requesterUsername.equals(userSurveyResponseQueries.getSurveyResponseOwner(surveyResponseId))) {
					return;
				}
			}
			
			throw new ServiceException(
					ErrorCode.SURVEY_INSUFFICIENT_PERMISSIONS, 
					"The user does not have sufficient permissions to modify this survey response.");
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Verifies that the requesting user has sufficient permissions to delete
	 * the survey response.
	 * 
	 * @param requesterUsername The username of the user that is attempting to
	 * 							delete the point.
	 * 
	 * @param surveyResponseId The survey response's unique identifier.
	 * 
	 * @throws ServiceException Thrown if there is an error or if the user 
	 * 							doesn't have sufficient permissions to delete
	 * 							the survey response.
	 */
Verifies that the requesting user has sufficient permissions to delete
the survey response.

@param requesterUsername The username of the user that is attempting to
delete the point.

@param surveyResponseId The survey response's unique identifier.

@throws ServiceException Thrown if there is an error or if the user
doesn't have sufficient permissions to delete
the survey response.
Verifies that the requesting user has sufficient permissions to delete the survey response . @param requesterUsername The username of the user that is attempting to delete the point . @param surveyResponseId The survey response ' s unique identifier . @throws ServiceException Thrown if there is an error or if the user doesn ' t have sufficient permissions to delete the survey response .
public void verifyUserCanUpdateOrDeleteSurveyResponse(
			final String requesterUsername, final UUID surveyResponseId) 
			throws ServiceException {
		try {
			String campaignId = campaignSurveyResponseQueries.getCampaignIdFromSurveyId(surveyResponseId);
			if(userCampaignQueries.getUserCampaignRoles(requesterUsername, campaignId).contains(Campaign.Role.SUPERVISOR)) {
				return;
			}
			if(Campaign.RunningState.RUNNING.equals(campaignQueries.getCampaignRunningState(campaignId))) {
				if(requesterUsername.equals(userSurveyResponseQueries.getSurveyResponseOwner(surveyResponseId))) {
					return;
				}
			}
			throw new ServiceException(
					ErrorCode.SURVEY_INSUFFICIENT_PERMISSIONS, 
					"The user does not have sufficient permissions to modify this survey response.");
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyUserCanUpdateOrDeleteSurveyResponse ( final String requesterUsername , final UUID surveyResponseId ) throws ServiceException { try { String campaignId = campaignSurveyResponseQueries . getCampaignIdFromSurveyId ( surveyResponseId ) ; if ( userCampaignQueries . getUserCampaignRoles ( requesterUsername , campaignId ) . contains ( Campaign . Role . SUPERVISOR ) ) { return ; } if ( Campaign . RunningState . RUNNING . equals ( campaignQueries . getCampaignRunningState ( campaignId ) ) ) { if ( requesterUsername . equals ( userSurveyResponseQueries . getSurveyResponseOwner ( surveyResponseId ) ) ) { return ; } } throw new ServiceException ( ErrorCode . SURVEY_INSUFFICIENT_PERMISSIONS , "The user does not have sufficient permissions to modify this survey response." ) ; } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Verifies that the requesting user has sufficient permissions to delete
 the survey response.
Verifies that the requesting user has sufficient permissions to delete the survey response .
// Get the response's campaign.