@Override
	public boolean userIsAuthorizedForService(String user, Service service) {
		log.info("Checking user {}'s authorization for service {}", user, service);
		
		try {
			log.debug("Setting the statement parameters");
			
			int index = params.indexOf("user");
			if (index > -1)
				statement.setString(index + 1, user);

			index = params.indexOf("service-name");
			if (index > -1)
				statement.setString(index + 1, service.getName());

			index = params.indexOf("service-type");
			if (index > -1)
				statement.setString(index + 1, service.getType());
			
			log.debug("Executing the statement");
			ResultSet rs = statement.executeQuery();
			if (!rs.next())
				return false;
			return rs.getInt(1) > 0;
		} catch (SQLException e) {
			log.catching(Level.ERROR, e);
			return false;
		}
	}