Merge branch 'master' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot
This commit is contained in:
commit
37bd845c5d
|
@ -1,9 +1,9 @@
|
||||||
package dao.entities.security;
|
package dao.entities;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import dao.Dao;
|
import dao.Dao;
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
|
|
||||||
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package dao.entities.security;
|
package dao.entities;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -7,8 +7,8 @@ import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import dao.JpaDao;
|
import dao.JpaDao;
|
||||||
|
import entities.UserInfo;
|
||||||
import entities.security.UserAuth;
|
import entities.security.UserAuth;
|
||||||
import entities.security.UserInfo;
|
|
||||||
|
|
||||||
|
|
||||||
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoDao {
|
|
@ -88,6 +88,14 @@ public class DMP implements Serializable {
|
||||||
private Set<Researcher> researchers;
|
private Set<Researcher> researchers;
|
||||||
|
|
||||||
|
|
||||||
|
// @OneToMany(fetch = FetchType.EAGER)
|
||||||
|
// @JoinTable(name="\"UserDMP\"",
|
||||||
|
// joinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")},
|
||||||
|
// inverseJoinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")}
|
||||||
|
// )
|
||||||
|
// private Set<UserInfo> users;
|
||||||
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -168,6 +176,15 @@ public class DMP implements Serializable {
|
||||||
this.researchers = researchers;
|
this.researchers = researchers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public Set<UserInfo> getUsers() {
|
||||||
|
// return users;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setUsers(Set<UserInfo> users) {
|
||||||
|
// this.users = users;
|
||||||
|
// }
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
//package entities;
|
||||||
|
//
|
||||||
|
//import java.io.Serializable;
|
||||||
|
//import java.util.UUID;
|
||||||
|
//
|
||||||
|
//import javax.persistence.Column;
|
||||||
|
//import javax.persistence.Entity;
|
||||||
|
//import javax.persistence.GeneratedValue;
|
||||||
|
//import javax.persistence.Id;
|
||||||
|
//import javax.persistence.Table;
|
||||||
|
//
|
||||||
|
//import org.hibernate.annotations.GenericGenerator;
|
||||||
|
//import org.hibernate.annotations.Type;
|
||||||
|
//
|
||||||
|
//import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
//import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
//
|
||||||
|
//@Entity
|
||||||
|
//@Table(name="\"UserInfo\"")
|
||||||
|
//@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
||||||
|
//public class UserDMP implements Serializable{
|
||||||
|
//
|
||||||
|
// private static final long serialVersionUID = -4467370784003784660L;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Id
|
||||||
|
// @GeneratedValue
|
||||||
|
// @GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
|
// @Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
|
// private UUID id;
|
||||||
|
//
|
||||||
|
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||||
|
// @Column(name = "user", nullable = false)
|
||||||
|
// private UUID user;
|
||||||
|
//
|
||||||
|
// @Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||||
|
// @Column(name = "dmp", nullable = false)
|
||||||
|
// private UUID dmp;
|
||||||
|
//
|
||||||
|
// @Column(name = "role")
|
||||||
|
// private Integer role;
|
||||||
|
//
|
||||||
|
// public UUID getId() {
|
||||||
|
// return id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setId(UUID id) {
|
||||||
|
// this.id = id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public UUID getUser() {
|
||||||
|
// return user;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setUser(UUID user) {
|
||||||
|
// this.user = user;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public UUID getDmp() {
|
||||||
|
// return dmp;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setDmp(UUID dmp) {
|
||||||
|
// this.dmp = dmp;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Integer getRole() {
|
||||||
|
// return role;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setRole(Integer role) {
|
||||||
|
// this.role = role;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
|
@ -1,7 +1,8 @@
|
||||||
package entities.security;
|
package entities;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
@ -10,6 +11,8 @@ import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -21,10 +24,12 @@ import org.hibernate.annotations.Type;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
||||||
|
import entities.security.UserAuth;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"UserInfo\"")
|
@Table(name="\"UserInfo\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="autoid")
|
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||||
public class UserInfo implements Serializable{
|
public class UserInfo implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1225151430484658395L;
|
private static final long serialVersionUID = 1225151430484658395L;
|
||||||
|
@ -32,13 +37,10 @@ public class UserInfo implements Serializable{
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
@Column(name = "autoid", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID autoid;
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "identification", nullable = false)
|
|
||||||
private String identification = null;
|
|
||||||
|
|
||||||
@Column(name = "email", nullable = false)
|
@Column(name = "email", nullable = false)
|
||||||
private String email = null;
|
private String email = null;
|
||||||
|
|
||||||
|
@ -71,12 +73,37 @@ public class UserInfo implements Serializable{
|
||||||
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
||||||
private String additionalinfo;
|
private String additionalinfo;
|
||||||
|
|
||||||
public String getIdentification() {
|
// @OneToMany(fetch = FetchType.EAGER)
|
||||||
return identification;
|
// @JoinTable(name="\"UserDMP\"",
|
||||||
|
// joinColumns={@JoinColumn(name="user", referencedColumnName="\"ID\"")},
|
||||||
|
// inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
|
||||||
|
// )
|
||||||
|
// private Set<UserInfo> users;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentification(String identification) {
|
public void setId(UUID id) {
|
||||||
this.identification = identification;
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastloggedin() {
|
||||||
|
return lastloggedin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastloggedin(Date lastloggedin) {
|
||||||
|
this.lastloggedin = lastloggedin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
|
@ -21,10 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import dao.entities.UserInfoDao;
|
||||||
import dao.entities.security.UserAuthDao;
|
import dao.entities.security.UserAuthDao;
|
||||||
import dao.entities.security.UserInfoDao;
|
import entities.UserInfo;
|
||||||
import entities.security.UserAuth;
|
import entities.security.UserAuth;
|
||||||
import entities.security.UserInfo;
|
|
||||||
import security.TokenSessionManager;
|
import security.TokenSessionManager;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package rest.proxy;
|
package proxy;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -57,12 +57,12 @@ public class Proxy {
|
||||||
while ((inputLine = in.readLine()) != null)
|
while ((inputLine = in.readLine()) != null)
|
||||||
response.append(inputLine);
|
response.append(inputLine);
|
||||||
in.close();
|
in.close();
|
||||||
} else {
|
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
||||||
|
}
|
||||||
|
else {
|
||||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'Remote server responded with: "+responseCode+"'}");
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("{'reason': 'Remote server responded with: "+responseCode+"'}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(response.toString());
|
|
||||||
|
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{'reason': 'Could not proxy to given host'}");
|
||||||
}
|
}
|
|
@ -257,6 +257,7 @@ public class Datasets {
|
||||||
try {
|
try {
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class Projects {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import dao.entities.security.UserInfoDao;
|
import dao.entities.UserInfoDao;
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
import exceptions.NonValidTokenException;
|
import exceptions.NonValidTokenException;
|
||||||
import security.validators.GoogleTokenValidator;
|
import security.validators.GoogleTokenValidator;
|
||||||
import security.validators.NativeTokenValidator;
|
import security.validators.NativeTokenValidator;
|
||||||
|
@ -64,7 +64,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||||
else
|
else
|
||||||
throw new AuthenticationServiceException("Authentication failed");
|
throw new AuthenticationServiceException("Authentication failed");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.google.api.client.http.HttpTransport;
|
||||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||||
|
|
||||||
import entities.security.UserInfo;
|
import entities.UserInfo;
|
||||||
import exceptions.NonValidTokenException;
|
import exceptions.NonValidTokenException;
|
||||||
|
|
||||||
public class GoogleTokenValidator implements TokenValidator {
|
public class GoogleTokenValidator implements TokenValidator {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<bean id="nativeTokenValidator" class="security.validators.NativeTokenValidator" />
|
<bean id="nativeTokenValidator" class="security.validators.NativeTokenValidator" />
|
||||||
|
|
||||||
|
|
||||||
<bean id="proxy" class="rest.proxy.Proxy">
|
<bean id="proxy" class="proxy.Proxy">
|
||||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
||||||
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
||||||
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
||||||
<bean id="userInfoDao" class="dao.entities.security.UserInfoDaoImpl" />
|
<bean id="userInfoDao" class="dao.entities.UserInfoDaoImpl" />
|
||||||
<bean id="userAuthDao" class="dao.entities.security.UserAuthDaoImpl" />
|
<bean id="userAuthDao" class="dao.entities.security.UserAuthDaoImpl" />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||||
|
|
||||||
|
|
||||||
<!-- <context:property-placeholder location="classpath*:**/dmp.properties" /> -->
|
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||||
|
|
||||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||||
<mvc:annotation-driven />
|
<mvc:annotation-driven />
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||||
|
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||||
|
http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||||
|
|
||||||
|
|
||||||
|
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||||
|
|
||||||
|
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||||
|
<mvc:annotation-driven />
|
||||||
|
<context:component-scan base-package="proxy" />
|
||||||
|
|
||||||
|
|
||||||
|
<bean id="proxy" class="proxy.Proxy">
|
||||||
|
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="multipartResolver"
|
||||||
|
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
|
<property name="maxUploadSize" value="100000000" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="jsonConverter"
|
||||||
|
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||||
|
<property name="prefixJson" value="false" />
|
||||||
|
<property name="supportedMediaTypes" value="application/json" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean
|
||||||
|
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||||
|
<property name="messageConverters">
|
||||||
|
<list>
|
||||||
|
<ref bean="jsonConverter" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
|
@ -16,9 +16,7 @@
|
||||||
<mvc:annotation-driven />
|
<mvc:annotation-driven />
|
||||||
<context:component-scan base-package="rest" />
|
<context:component-scan base-package="rest" />
|
||||||
|
|
||||||
<bean id="proxy" class="rest.proxy.Proxy">
|
|
||||||
<constructor-arg type = "String" value = "${proxy.allowed.host}"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean
|
<bean
|
||||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||||
|
|
|
@ -3,7 +3,20 @@
|
||||||
|
|
||||||
<display-name>dmp-backend</display-name>
|
<display-name>dmp-backend</display-name>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||||
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>dmp-backend-proxy</servlet-name>
|
||||||
|
<url-pattern>/proxy/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>dmp-backend-login</servlet-name>
|
<servlet-name>dmp-backend-login</servlet-name>
|
||||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
|
|
@ -25,7 +25,10 @@ drop table if exists "Registry" cascade;
|
||||||
drop table if exists "DatasetService" cascade;
|
drop table if exists "DatasetService" cascade;
|
||||||
drop table if exists "DatasetRegistry" cascade;
|
drop table if exists "DatasetRegistry" cascade;
|
||||||
drop table if exists "DatasetDataRepository" cascade;
|
drop table if exists "DatasetDataRepository" cascade;
|
||||||
drop table if exists "UserInfo" cascade;
|
DROP table if exists "UserDMP" cascade;
|
||||||
|
DROP table if exists "UserInfo" cascade;
|
||||||
|
DROP table if exists "UserAuth" cascade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
-- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||||
|
@ -447,12 +450,13 @@ ALTER TABLE ONLY "DatasetService"
|
||||||
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
|
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
|
||||||
|
|
||||||
|
|
||||||
|
DROP table if exists "UserDMP";
|
||||||
DROP table if exists "UserInfo";
|
DROP table if exists "UserInfo";
|
||||||
|
DROP table if exists "UserAuth";
|
||||||
|
|
||||||
CREATE TABLE "UserInfo" (
|
CREATE TABLE "UserInfo" (
|
||||||
"autoid" uuid DEFAULT uuid_generate_v4() NOT NULL,
|
"id" uuid DEFAULT uuid_generate_v4() UNIQUE NOT NULL,
|
||||||
"identification" character varying(500) NOT NULL,
|
"email" character varying(250) UNIQUE NOT NULL,
|
||||||
"email" character varying(250) NOT NULL,
|
|
||||||
"authorization_level" smallint NOT NULL,
|
"authorization_level" smallint NOT NULL,
|
||||||
"usertype" smallint NOT NULL,
|
"usertype" smallint NOT NULL,
|
||||||
"authentication" uuid,
|
"authentication" uuid,
|
||||||
|
@ -461,15 +465,13 @@ CREATE TABLE "UserInfo" (
|
||||||
"created" timestamp,
|
"created" timestamp,
|
||||||
"lastloggedin" timestamp,
|
"lastloggedin" timestamp,
|
||||||
"additionalinfo" xml,
|
"additionalinfo" xml,
|
||||||
PRIMARY KEY (identification, email)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore';
|
COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore';
|
||||||
COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external';
|
COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external';
|
||||||
|
|
||||||
|
|
||||||
DROP table if exists "UserAuth";
|
|
||||||
|
|
||||||
CREATE TABLE "UserAuth" (
|
CREATE TABLE "UserAuth" (
|
||||||
"id" uuid DEFAULT uuid_generate_v4() NOT NULL UNIQUE,
|
"id" uuid DEFAULT uuid_generate_v4() NOT NULL UNIQUE,
|
||||||
"username" character varying(200) NOT NULL,
|
"username" character varying(200) NOT NULL,
|
||||||
|
@ -483,8 +485,21 @@ ALTER TABLE "UserInfo" ADD CONSTRAINT fkey_userinfo_userauth FOREIGN KEY ("authe
|
||||||
|
|
||||||
COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
|
COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
|
||||||
|
|
||||||
|
|
||||||
|
create table "UserDMP" (
|
||||||
|
"id" uuid DEFAULT uuid_generate_v4() NOT NULL,
|
||||||
|
"user" uuid NOT NULL,
|
||||||
|
"dmp" uuid NOT NUll,
|
||||||
|
"role" integer
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY ("user") REFERENCES "UserInfo"("id");
|
||||||
|
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY ("dmp") REFERENCES "DMP"("ID");
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE "UserInfo" OWNER TO dmptool;
|
ALTER TABLE "UserInfo" OWNER TO dmptool;
|
||||||
ALTER TABLE "UserAuth" OWNER TO dmptool;
|
ALTER TABLE "UserAuth" OWNER TO dmptool;
|
||||||
|
ALTER TABLE "UserDMP" OWNER TO dmptool;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue