From ce8261f629a74e3cfd41457d78553186854a3119 Mon Sep 17 00:00:00 2001 From: ulrich Date: Sun, 05 Feb 2017 16:38:50 +0000 Subject: [PATCH] Rollen des admin geaendert --- src/java/de/uhilger/um/web/Initialiser.java | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/java/de/uhilger/um/web/Initialiser.java b/src/java/de/uhilger/um/web/Initialiser.java index 41da73b..0feeecd 100644 --- a/src/java/de/uhilger/um/web/Initialiser.java +++ b/src/java/de/uhilger/um/web/Initialiser.java @@ -21,6 +21,7 @@ import de.uhilger.baselink.PersistenceManager; import de.uhilger.baselink.Record; import de.uhilger.um.api.UserMgr; +import de.uhilger.um.daten.User; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -127,6 +128,15 @@ if(!dbVorhanden(db, sql.getProperty(SQL_DB_VORHANDEN))) { logger.info("Datenbank ist nicht vorhanden"); int[] ergebnis = db.executeScript(getSqlSkript()); + User admin = new User(); + admin.setId("admin"); + admin.setPw("admin"); + admin.setFirstName("admin"); + admin.setLastName("admin"); + admin.setEmail("none"); + UserMgr um = new UserMgr(); + um.setServletContext(servletContext); + um.createUser(admin); } } catch(Exception ex) { logger.log(Level.INFO, ex.getMessage(), ex); @@ -137,7 +147,7 @@ private boolean dbVorhanden(PersistenceManager pm, String sql) { boolean istVorhanden = false; List<List<String>> list = pm.select(sql, Record.WITHOUT_BLOBS); - if(list.size() > 1) { + if(list != null && list.size() > 1) { istVorhanden = true; logger.fine("Datenbank ist vorhanden"); } -- Gitblit v1.9.3