Benuterverwaltung mit KorAPUser
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
index 5c23916..6217c89 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
@@ -11,6 +11,7 @@
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
 import de.ids_mannheim.korap.user.KorAPUser;
 import de.ids_mannheim.korap.user.ShibUser;
+import de.ids_mannheim.korap.user.DemoUser;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.BooleanUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
@@ -49,8 +50,57 @@
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+    // usersettings are fetched plus basic account info, no details, since i rarely use them anyway! (by Hanl)
+    /* Version mit LDAP Authentication - 09.05.17/FB
+     * getAccount(): KorAPUser:  Account muss vorhanden sein.
+     *               DemoUser, DefaultUser: Account nicht vorhanden.
+     */
+    @Override
+    public User getAccount (String username) throws KustvaktException {
+    	
+    	Map<String, String> namedParameters = Collections.singletonMap("username", username);
+        final String sql = "select a.* from korap_users as a where a.username=:username;";
+        User user = null;
+        
+        try {
+            user = this.jdbcTemplate.queryForObject(sql, namedParameters,
+                    new RowMapperFactory.UserMapper());
+            return user;
+        	}
+        catch (EmptyResultDataAccessException ae) {
+            jlog.warn("No user found for name '{}'", username);
+            // if no username, so return a DemoUser , FB.
+            // return User.UserFactory.getDemoUser();
+        	}
+        catch (DataAccessException e) {
+            jlog.warn("Could not retrieve user for name: " + username, e);
+            
+            /* DemoUser and DefaultUser have no account,
+             * so it's ok they are not found.
+            throw new DatabaseException(username, "korap_users",
+                    StatusCodes.DB_GET_FAILED,
+                    "Could not retrieve the user with username: " + username,
+                    username);
+             */
+            }
 
-    // usersettings are fetched plus basic account info, no details, since i rarely use them anyway!
+        // DemoUser or DefaultUser?
+        
+        {	// User cannot be found in SQL DB since LDAP Authentication,
+        	// so create a User Object here.
+        	// TODO: what more data should be stored into it?
+        	// 28.04.17/FB
+        	user = new KorAPUser(); // oder eigentlich new DemoUser oder new DefaultUser.
+        	user.setUsername(username);
+        	return user;
+        }
+        
+        
+    }
+
+    // usersettings are fetched plus basic account info, no details, since i rarely use them anyway! (by Hanl)
+    /* Version before LDAP Authentication - 09.05.17/FB
+    @Deprecated
     @Override
     public User getAccount (String username) throws KustvaktException {
     	
@@ -59,22 +109,7 @@
                 .singletonMap("username", username);
         final String sql = "select a.* from korap_users as a where a.username=:username;";
         User user;
-        
-        // Debug by FB
-        if ( bDEBUG == true )
-        {	// User cannot be found in SQL DB since LDAP Authentication,
-        	// so create a User Object here.
-        	// TODO: what more data should be stored into it?
-        	// 28.04.17/FB
-        	user = new KorAPUser();
-        	user.setUsername(username);
-        	return user;
-        }
-        if( username.equalsIgnoreCase("bodmer") == true )
-        {
-        	return null;
-        }
-        //
+       
         try {
             user = this.jdbcTemplate.queryForObject(sql, namedParameters,
                     new RowMapperFactory.UserMapper());
@@ -92,7 +127,7 @@
         }
         return user;
     }
-
+	*/
 
     @Override
     public int updateAccount (User user) throws KustvaktException {
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
index 380481d..0d3f495 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
@@ -153,7 +153,7 @@
 
         if (sets.isEmpty()){
             throw new KustvaktException(StatusCodes.NO_VALUE_FOUND, 
-                    "Cannot found public resources with ids: "+id_set.toString());
+                    "Cannot found public "+clazz.toString()+" with ids: "+id_set.toString());
         }
         return sets;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index 483f292..16745bb 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -412,6 +412,8 @@
             }
 
         // Create a User
+        // TODO: KorAPUser für solche mit einem bestehenden Account
+        //       DefaultUser sonst.
         User user = new KorAPUser();
         user.setUsername(username);
         unknown = user;