fixed running tests
diff --git a/src/main/resources/db/mysql/V0.1__userdatabase.sql b/src/main/resources/db/mysql/V0.1__userdatabase.sql
index cfe31a1..09b1591 100644
--- a/src/main/resources/db/mysql/V0.1__userdatabase.sql
+++ b/src/main/resources/db/mysql/V0.1__userdatabase.sql
@@ -1,3 +1,4 @@
+
-- rename all columns in new way!
CREATE TABLE IF NOT EXISTS korap_users (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
diff --git a/src/main/resources/db/mysql/V0.3__securitydatabase.sql b/src/main/resources/db/mysql/V0.3__securitydatabase.sql
index c8f6816..5406156 100644
--- a/src/main/resources/db/mysql/V0.3__securitydatabase.sql
+++ b/src/main/resources/db/mysql/V0.3__securitydatabase.sql
@@ -111,25 +111,4 @@
aud_failure VARCHAR(100)
);
-
--- indices
-create trigger delete_policy after delete on resource_store
-for each row delete from policy_store where target_id=OLD.id;
-
-DELIMITER //
-CREATE TRIGGER tree_entry_insert AFTER INSERT ON resource_store FOR EACH ROW BEGIN
- INSERT INTO resource_tree (parent_id, child_id, depth, name_path)
- VALUES (NEW.id, NEW.id, 0, NEW.name);
- INSERT INTO resource_tree (parent_id, child_id, depth, name_path)
- SELECT parent_id, NEW.id, depth + 1, concat(name_path,"/",NEW.name) FROM resource_tree WHERE child_id = NEW.parent_id;
-END; //
-
-DELIMITER ;
-
--- todo: are this automatically adapted when refactoring?
-CREATE INDEX group_index ON group_users(user_id, group_id);
-CREATE INDEX policy_index ON group_ref(policy_id);
-CREATE UNIQUE INDEX resource_tree_index ON resource_tree (parent_id, depth, child_id);
-CREATE UNIQUE INDEX param_unique ON param_store (p_key, p_value);
-
-- foreign key constraints
diff --git a/src/main/resources/db/sqlite/V1__Initial_version.sql b/src/main/resources/db/sqlite/V1__Initial_version.sql
index 06663e7..d109779 100644
--- a/src/main/resources/db/sqlite/V1__Initial_version.sql
+++ b/src/main/resources/db/sqlite/V1__Initial_version.sql
@@ -24,13 +24,19 @@
CREATE TABLE IF NOT EXISTS user_details (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER UNIQUE NOT NULL,
-data BLOB NOT NULL
+data BLOB NOT NULL,
+foreign key (user_id)
+references korap_users (id)
+on delete cascade
);
CREATE TABLE IF NOT EXISTS user_settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER UNIQUE NOT NULL,
-data BLOB NOT NULL
+data BLOB NOT NULL,
+foreign key (user_id)
+references korap_users (id)
+on delete cascade
);
@@ -262,8 +268,8 @@
-- deletes a group if the group has no longer members!
create trigger if not exists group_ref_del after delete on group_ref
-when (select count(*) from group_ref where groupId=OLD.group_id) = 0
-begin delete from groupolicy_store where name=OLD.group_id; end;
+when (select count(*) from group_ref where group_id=OLD.group_id) = 0
+begin delete from group_store where name=OLD.group_id; end;
-- create trigger relCr after insert on resource_store
-- when (select count(*) from r_tree where parent_id==NEW.id and
diff --git a/src/main/resources/default-config.xml b/src/main/resources/default-config.xml
index 86a5cba..1b0c72c 100644
--- a/src/main/resources/default-config.xml
+++ b/src/main/resources/default-config.xml
@@ -76,7 +76,7 @@
<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
<property name="baselineOnMigrate" value="false"/>
<property name="locations"
- value="classpath:${jdbc.schemaPath}"/>
+ value="${jdbc.schemaPath}"/>
<property name="dataSource" ref="dataSource"/>
</bean>
@@ -161,7 +161,7 @@
ref="kustvakt_encryption"/>
</bean>
- <util:list id="auth_providers"
+ <util:list id="kustvakt_authproviders"
value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface">
<ref bean="basic_auth"/>
<ref bean="session_auth"/>
@@ -169,6 +169,26 @@
<ref bean="openid_auth"/>
</util:list>
+
+ <bean id="userdata_details"
+ class="de.ids_mannheim.korap.handlers.UserDetailsDao">
+ <constructor-arg
+ type="de.ids_mannheim.korap.interfaces.db.PersistenceClient"
+ ref="kustvakt_db"/>
+ </bean>
+ <bean id="userdata_settings"
+ class="de.ids_mannheim.korap.handlers.UserDetailsDao">
+ <constructor-arg
+ type="de.ids_mannheim.korap.interfaces.db.PersistenceClient"
+ ref="kustvakt_db"/>
+ </bean>
+
+ <util:list id="kustvakt_userdata"
+ value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface">
+ <ref bean="userdata_details"/>
+ <ref bean="userdata_settings"/>
+ </util:list>
+
<!-- specify type for constructor argument -->
<bean id="kustvakt_authenticationmanager"
class="de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager">
@@ -181,8 +201,9 @@
<constructor-arg
type="de.ids_mannheim.korap.interfaces.db.AuditingIface"
ref="kustvakt_auditing"/>
+ <constructor-arg ref="kustvakt_userdata"/>
<!-- inject authentication providers to use -->
- <property name="providers" ref="auth_providers"/>
+ <property name="providers" ref="kustvakt_authproviders"/>
</bean>
<!-- todo: if db interfaces not loaded via spring, does transaction even work then? -->
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index c9186f6..39e040a 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,7 +1,7 @@
# Root logger option
#log4j.threshold=ALL
-log4j.rootLogger=DEBUG, stdout, debugLog
+log4j.rootLogger=WARN, stdout, debugLog
log4j.logger.log=ERROR, errorLog
# Direct log messages to stdout
diff --git a/src/main/resources/validation.properties b/src/main/resources/validation.properties
old mode 100755
new mode 100644
diff --git a/src/main/resources/version.prop b/src/main/resources/version.prop
deleted file mode 100644
index e5683df..0000000
--- a/src/main/resources/version.prop
+++ /dev/null
@@ -1 +0,0 @@
-version=${project.version}
\ No newline at end of file