src/org/ohmage/service/UserClassServices.java
public void userIsAdminOrPrivilegedInAllClasses(
			final String username, final Collection<String> classIds) 
			throws ServiceException {
		
		try {
			// If the user is an admin, return.
			if(userQueries.userIsAdmin(username)) {
				return;
			}
			
			// For each of the classes in the list, the user must be 
			// privileged.
			for(String classId : classIds) {
				if(! Clazz.Role.PRIVILEGED.equals(userClassQueries.getUserClassRole(classId, username))) {
					throw new ServiceException(
							ErrorCode.CLASS_INSUFFICIENT_PERMISSIONS, 
							"The user is not and admin nor privileged in a class: " + 
								classId);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Ensures that the user is an admin or that they are privileged in all of 
	 * the classes in the class list.
	 * 
	 * @param username The username of the user that must be an admin or 
	 * 				   privileged in all of the classes in the list.
	 * 
	 * @param classIds A List of class identifiers.
	 * 
	 * @throws ServiceException Thrown if the user isn't an admin and isn't 
	 * 							privileged in one of the classes or there is an
	 * 							error.
	 */
Ensures that the user is an admin or that they are privileged in all of
the classes in the class list.

@param username The username of the user that must be an admin or
privileged in all of the classes in the list.

@param classIds A List of class identifiers.

@throws ServiceException Thrown if the user isn't an admin and isn't
privileged in one of the classes or there is an
error.
Ensures that the user is an admin or that they are privileged in all of the classes in the class list . @param username The username of the user that must be an admin or privileged in all of the classes in the list . @param classIds A List of class identifiers . @throws ServiceException Thrown if the user isn ' t an admin and isn ' t privileged in one of the classes or there is an error .
public void userIsAdminOrPrivilegedInAllClasses(
			final String username, final Collection<String> classIds) 
			throws ServiceException {
		try {
			if(userQueries.userIsAdmin(username)) {
				return;
			}
			for(String classId : classIds) {
				if(! Clazz.Role.PRIVILEGED.equals(userClassQueries.getUserClassRole(classId, username))) {
					throw new ServiceException(
							ErrorCode.CLASS_INSUFFICIENT_PERMISSIONS, 
							"The user is not and admin nor privileged in a class: " + 
								classId);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void userIsAdminOrPrivilegedInAllClasses ( final String username , final Collection < String > classIds ) throws ServiceException { try { if ( userQueries . userIsAdmin ( username ) ) { return ; } for ( String classId : classIds ) { if ( ! Clazz . Role . PRIVILEGED . equals ( userClassQueries . getUserClassRole ( classId , username ) ) ) { throw new ServiceException ( ErrorCode . CLASS_INSUFFICIENT_PERMISSIONS , "The user is not and admin nor privileged in a class: " + classId ) ; } } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Ensures that the user is an admin or that they are privileged in all of
 the classes in the class list.
Ensures that the user is an admin or that they are privileged in all of the classes in the class list .
// If the user is an admin, return. // For each of the classes in the list, the user must be  // privileged.