src/org/sonews/storage/impl/DrupalDatabase.java
changeset 120 bb1c8a7b774c
parent 106 dc04a3c2c557
     1.1 --- a/src/org/sonews/storage/impl/DrupalDatabase.java	Sun Oct 23 23:37:39 2011 +0200
     1.2 +++ b/src/org/sonews/storage/impl/DrupalDatabase.java	Wed Dec 31 12:07:40 2014 +0100
     1.3 @@ -401,10 +401,8 @@
     1.4  	 */
     1.5  	@Override
     1.6  	public void addArticle(Article article) throws StorageBackendException {
     1.7 -		if (article.getAuthenticatedUser() == null) {
     1.8 -			log.log(Level.SEVERE, "User was not authenticated, so his article was rejected.");
     1.9 -			throw new StorageBackendException("User must be authenticated to post articles");
    1.10 -		} else {
    1.11 +		if (article.getUser() != null && article.getUser().isAuthenticated()) {
    1.12 +			
    1.13  			try {
    1.14  				DrupalMessage m = new DrupalMessage(article);
    1.15  
    1.16 @@ -426,12 +424,16 @@
    1.17  						}
    1.18  					}
    1.19  
    1.20 -					insertArticle(article.getAuthenticatedUser(), subject, text, parentID, groupID);
    1.21 -					log.log(Level.INFO, "User ''{0}'' has posted an article", article.getAuthenticatedUser());
    1.22 +					insertArticle(article.getUser().getUserName(), subject, text, parentID, groupID);
    1.23 +					log.log(Level.INFO, "User ''{0}'' has posted an article", article.getUser().getUserName());
    1.24  				}
    1.25  			} catch (Exception e) {
    1.26  				throw new StorageBackendException(e);
    1.27  			}
    1.28 +			
    1.29 +		} else {
    1.30 +			log.log(Level.SEVERE, "User was not authenticated, so his article was rejected.");
    1.31 +			throw new StorageBackendException("User must be authenticated to post articles");
    1.32  		}
    1.33  	}
    1.34