Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
commit
36ef691e1e
@ -0,0 +1 @@
|
||||
PROFILE=staging
|
@ -1,11 +1,23 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
RUN apk add --update \
|
||||
curl \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
VOLUME /tmp
|
||||
ARG PROFILE=production
|
||||
ENV PROF $PROFILE
|
||||
ADD web/src/main/resources/ProjectConfiguration.xml /tmp/ProjectConfiguration.xml
|
||||
ADD web/src/main/resources/ExternalUrls.xml /tmp/ExternalUrls.xml
|
||||
ADD web/target/web-1.0-SNAPSHOT.jar app.jar
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROF}","-jar","/app.jar"]
|
||||
FROM maven:3-jdk-8-alpine AS MAVEN_BUILD
|
||||
|
||||
|
||||
|
||||
COPY pom.xml /build/
|
||||
COPY data /build/data/
|
||||
COPY elastic /build/elastic/
|
||||
COPY logging /build/logging/
|
||||
COPY queryable /build/queryable/
|
||||
COPY web /build/web/
|
||||
|
||||
|
||||
|
||||
WORKDIR /build/
|
||||
RUN mvn package
|
||||
|
||||
|
||||
|
||||
FROM openjdk:8-jre-alpine
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app/app.jar
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROFILE}","-jar","/app/app.jar"]
|
@ -0,0 +1,11 @@
|
||||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.DoiFunder;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface DoiFunderDao extends DatabaseAccessLayer<DoiFunder, UUID> {
|
||||
|
||||
DoiFunder findFunderByName(String name);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.DoiFunder;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("DoiFunderDao")
|
||||
public class DoiFunderDaoImpl extends DatabaseAccess<DoiFunder> implements DoiFunderDao {
|
||||
|
||||
@Autowired
|
||||
public DoiFunderDaoImpl(DatabaseService<DoiFunder> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoiFunder findFunderByName(String name) {
|
||||
return this.asQueryable().toList().stream().filter(doiFunder -> name.contains(doiFunder.getName()) || doiFunder.getName().contains(name)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoiFunder createOrUpdate(DoiFunder item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, DoiFunder.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<DoiFunder> createOrUpdateAsync(DoiFunder item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoiFunder find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(DoiFunder.class).where(((builder, root) -> builder.equal(root.get("id"), id))).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoiFunder find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DoiFunder item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<DoiFunder> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(DoiFunder.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.UserAssociation;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface UserAssociationDao extends DatabaseAccessLayer<UserAssociation, UUID> {
|
||||
|
||||
public List<UserAssociation> getAssociated(UserInfo userId);
|
||||
|
||||
public Boolean areAssociated(UserInfo firstUser, UserInfo secondUser);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package eu.eudat.data.dao.entities;
|
||||
|
||||
import eu.eudat.data.dao.DatabaseAccess;
|
||||
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
|
||||
import eu.eudat.data.entities.UserAssociation;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("UserAssociationDao")
|
||||
public class UserAssociationDaoImpl extends DatabaseAccess<UserAssociation> implements UserAssociationDao {
|
||||
|
||||
@Autowired
|
||||
public UserAssociationDaoImpl(DatabaseService<UserAssociation> databaseService) {
|
||||
super(databaseService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAssociation createOrUpdate(UserAssociation item) {
|
||||
return this.getDatabaseService().createOrUpdate(item, UserAssociation.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<UserAssociation> createOrUpdateAsync(UserAssociation item) {
|
||||
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAssociation find(UUID id) {
|
||||
return this.getDatabaseService().getQueryable(UserAssociation.class).where(((builder, root) -> builder.equal(root.get("id"), id))).getSingle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAssociation find(UUID id, String hint) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(UserAssociation item) {
|
||||
this.getDatabaseService().delete(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryableList<UserAssociation> asQueryable() {
|
||||
return this.getDatabaseService().getQueryable(UserAssociation.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAssociation> getAssociated(UserInfo userId) {
|
||||
return this.getDatabaseService().getQueryable(UserAssociation.class).where(((builder, root) ->
|
||||
builder.or(builder.equal(root.get("firstUser"), userId), builder.equal(root.get("secondUser"), userId)))).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean areAssociated(UserInfo firstUser, UserInfo secondUser) {
|
||||
return this.getDatabaseService().getQueryable(UserAssociation.class).where(((builder, root) ->
|
||||
builder.or(
|
||||
builder.and(
|
||||
builder.equal(root.get("firstUser"), firstUser),
|
||||
builder.equal(root.get("secondUser"), secondUser)
|
||||
),
|
||||
builder.and(
|
||||
builder.equal(root.get("secondUser"), firstUser),
|
||||
builder.equal(root.get("firstUser"), secondUser)
|
||||
)
|
||||
))).count() > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"DoiFunder\"")
|
||||
public class DoiFunder implements DataEntity<DoiFunder, UUID> {
|
||||
|
||||
@Id
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "doi")
|
||||
private String doi;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DoiFunder entity) {
|
||||
this.name = entity.name;
|
||||
this.doi = entity.doi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoiFunder buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package eu.eudat.data.entities;
|
||||
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"UserAssociation\"")
|
||||
public class UserAssociation implements DataEntity<UserAssociation, UUID> {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"firstUser\"")
|
||||
private UserInfo firstUser;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "\"secondUser\"")
|
||||
private UserInfo secondUser;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UserInfo getFirstUser() {
|
||||
return firstUser;
|
||||
}
|
||||
|
||||
public void setFirstUser(UserInfo firstUser) {
|
||||
this.firstUser = firstUser;
|
||||
}
|
||||
|
||||
public UserInfo getSecondUser() {
|
||||
return secondUser;
|
||||
}
|
||||
|
||||
public void setSecondUser(UserInfo secondUser) {
|
||||
this.secondUser = secondUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserAssociation entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getKeys() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAssociation buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package eu.eudat.exceptions.security;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.FORBIDDEN)
|
||||
public class ForbiddenException extends RuntimeException {
|
||||
public ForbiddenException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ForbiddenException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ForbiddenException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
ADMIN_USERNAME=admin
|
||||
ADMIN_PASSWORD=CHANGEME
|
||||
POSTGRES_DB=dmptool
|
||||
POSTGRES_USER=dmptool
|
||||
POSTGRES_PASSWORD=CHANGEME
|
@ -0,0 +1,7 @@
|
||||
psql -d dmptool -U dmptool -f main/DataManagementPlanDB.sql;
|
||||
for j in $(ls updates); do
|
||||
for i in $(ls updates/$j/*.sql); do
|
||||
echo $i
|
||||
psql --set=ADMIN_USERNAME="$ADMIN_USERNAME" --set=ADMIN_PASSWORD="$ADMIN_PASSWORD" -d dmptool -U dmptool -f $i;
|
||||
done
|
||||
done
|
@ -1,6 +1,6 @@
|
||||
ALTER TABLE public."DMP"
|
||||
ADD "PublishedAt" timestamp(6) with time zone
|
||||
ADD "PublishedAt" timestamp(6) WITH time zone;
|
||||
|
||||
UPDATE public."DMP"
|
||||
SET "PublishedAt" = "FinalizedDat"
|
||||
where "isPublic" = True
|
||||
where "isPublic" = True;
|
@ -1,2 +1,2 @@
|
||||
ALTER TABLE public."DMP"
|
||||
ADD COLUMN "DOI" text
|
||||
ADD COLUMN "DOI" text;
|
@ -0,0 +1,15 @@
|
||||
CREATE TABLE public."Content" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Filename" character varying NOT NULL,
|
||||
"Extension" character varying NOT NULL,
|
||||
"ParentType" numeric NOT NULL,
|
||||
"Uri" character varying NOT NULL,
|
||||
"LocationType" numeric NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."Content" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."Content"
|
||||
ADD CONSTRAINT "Content_pkey" PRIMARY KEY ("Id");
|
||||
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE public."Dataset"
|
||||
DROP COLUMN "IsPublic"
|
@ -0,0 +1,9 @@
|
||||
ALTER TABLE public."Grant"
|
||||
ADD COLUMN "Content" uuid;
|
||||
|
||||
|
||||
ALTER TABLE public."Grant"
|
||||
ADD CONSTRAINT fk_grant_content FOREIGN KEY ("Content")
|
||||
REFERENCES public."Content" ("Id") MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION;
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE public."Grant"
|
||||
RENAME CONSTRAINT "fk_project_content" TO "fk_grant_content";
|
@ -0,0 +1,18 @@
|
||||
ALTER TABLE public."Grant"
|
||||
ALTER COLUMN "Reference" TYPE character varying(255);
|
||||
|
||||
ALTER TABLE public."Grant"
|
||||
ALTER COLUMN "Definition" TYPE character varying;
|
||||
|
||||
ALTER TABLE public."Registry"
|
||||
ALTER COLUMN "Reference" TYPE character varying;
|
||||
|
||||
ALTER TABLE public."Service"
|
||||
ALTER COLUMN "Reference" TYPE character varying;
|
||||
|
||||
ALTER TABLE public."Researcher"
|
||||
ALTER COLUMN "Reference" TYPE character varying;
|
||||
|
||||
ALTER TABLE public."DataRepository"
|
||||
ALTER COLUMN "Reference" TYPE character varying;
|
||||
|
@ -0,0 +1,2 @@
|
||||
ALTER TABLE "Funder"
|
||||
ADD COLUMN "CreationUser" uuid;
|
@ -1,4 +1,4 @@
|
||||
Update "Funder" as funder
|
||||
set "CreationUser" = grant1."CreationUser"
|
||||
from "Grant" as grant1
|
||||
where funder."ID" = grant1."Funder"
|
||||
where funder."ID" = grant1."Funder" ;
|
@ -0,0 +1,15 @@
|
||||
CREATE TABLE public."ExternalDataset" (
|
||||
"Id" uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||
"Label" character varying NOT NULL,
|
||||
"Abbreviation" character varying,
|
||||
"Reference" character varying NOT NULL,
|
||||
"Created" timestamp(4) with time zone NOT NULL,
|
||||
"Modified" timestamp(4) with time zone NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."ExternalDataset" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."ExternalDataset"
|
||||
ADD CONSTRAINT "ExternalDataset_pkey" PRIMARY KEY ("Id");
|
||||
|
@ -0,0 +1,11 @@
|
||||
ALTER TABLE "DataRepository"
|
||||
ADD COLUMN "CreationUser" uuid;
|
||||
|
||||
ALTER TABLE "ExternalDataset"
|
||||
ADD COLUMN "CreationUser" uuid;
|
||||
|
||||
ALTER TABLE "Registry"
|
||||
ADD COLUMN "CreationUser" uuid;
|
||||
|
||||
ALTER TABLE "Service"
|
||||
ADD COLUMN "CreationUser" uuid;
|
@ -0,0 +1,2 @@
|
||||
ALTER TABLE "Researcher"
|
||||
ADD COLUMN "CreationUser" uuid;
|
@ -1,11 +0,0 @@
|
||||
ALTER TABLE "DataRepository"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "ExternalDataset"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "Registry"
|
||||
ADD COLUMN "CreationUser" uuid
|
||||
|
||||
ALTER TABLE "Service"
|
||||
ADD COLUMN "CreationUser" uuid
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE "Funder"
|
||||
ADD COLUMN "CreationUser" uuid
|
@ -1,2 +0,0 @@
|
||||
ALTER TABLE "Researcher"
|
||||
ADD COLUMN "CreationUser" uuid
|
@ -1,6 +0,0 @@
|
||||
UPDATE "Researcher"
|
||||
SET "Reference" = CONCAT(LOWER(LEFT("Reference", 1)), SUBSTRING("Reference", 2))
|
||||
WHERE "ID" in (
|
||||
SELECT "ID" FROM "Researcher"
|
||||
WHERE ASCII(LEFT("Reference", 1)) BETWEEN ASCII('A') AND ASCII('Z')
|
||||
)
|
@ -0,0 +1,23 @@
|
||||
ALTER TABLE public."DMP"
|
||||
ADD COLUMN "DmpProperties" text;
|
||||
|
||||
ALTER TABLE public."DMP"
|
||||
ADD COLUMN "GroupId" uuid;
|
||||
|
||||
ALTER TABLE public."DMP"
|
||||
ADD COLUMN "Properties" text;
|
||||
|
||||
ALTER TABLE public."DatasetProfile"
|
||||
ADD COLUMN "GroupId" uuid;
|
||||
|
||||
ALTER TABLE public."DatasetProfile"
|
||||
ADD COLUMN "Version" integer;
|
||||
|
||||
ALTER TABLE public."Grant"
|
||||
ADD COLUMN "Type" numeric NOT NULL;
|
||||
|
||||
ALTER TABLE public."DatasetDataRepository"
|
||||
ADD COLUMN "Data" character varying;
|
||||
|
||||
ALTER TABLE public."DatasetService"
|
||||
ADD COLUMN "Data" character varying;
|
@ -0,0 +1,25 @@
|
||||
CREATE TABLE public."Credential" (
|
||||
"Id" uuid NOT NULL,
|
||||
"Status" numeric NOT NULL,
|
||||
"Provider" numeric NOT NULL,
|
||||
"Public" character varying NOT NULL,
|
||||
"Secret" character varying NOT NULL,
|
||||
"CreationTime" timestamp(4) with time zone NOT NULL,
|
||||
"LastUpdateTime" timestamp(4) with time zone NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"ExternalId" character varying NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."Credential" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."Credential"
|
||||
ADD CONSTRAINT "Credential_pkey" PRIMARY KEY ("Id");
|
||||
|
||||
ALTER TABLE ONLY public."Credential"
|
||||
ADD CONSTRAINT fkey_credential_user FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||
|
||||
INSERT INTO public."UserInfo"(email, authorization_level, usertype, name, created, additionalinfo) VALUES ('fake@email.org', 1, 1, :'ADMIN_USERNAME', now(), '{}');
|
||||
|
||||
INSERT INTO public."Credential" VALUES (uuid_generate_v4(), 0, 5, :'ADMIN_USERNAME', :'ADMIN_PASSWORD', now(), now(), (SELECT public."UserInfo"."id" FROM public."UserInfo" WHERE name = 'admin'), 'dmp');
|
||||
|
@ -0,0 +1,16 @@
|
||||
CREATE TABLE public."UserToken" (
|
||||
"Token" uuid NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"IssuedAt" timestamp(4) with time zone NOT NULL,
|
||||
"ExpiresAt" timestamp(4) with time zone NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."UserToken" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."UserToken"
|
||||
ADD CONSTRAINT "UserToken_pkey" PRIMARY KEY ("Token");
|
||||
|
||||
ALTER TABLE ONLY public."UserToken"
|
||||
ADD CONSTRAINT fkey_usetoken_user FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||
|
@ -0,0 +1,18 @@
|
||||
CREATE TABLE public."UserRole" (
|
||||
"Id" uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||
"Role" numeric DEFAULT 0 NOT NULL,
|
||||
"UserId" uuid NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."UserRole" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."UserRole"
|
||||
ADD CONSTRAINT "UserRole_pkey" PRIMARY KEY ("Id");
|
||||
|
||||
ALTER TABLE ONLY public."UserRole"
|
||||
ADD CONSTRAINT "UserRole_userId_fkey" FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
||||
|
||||
|
||||
INSERT INTO public."UserRole"("Role", "UserId") VALUES (2, (SELECT public."UserInfo"."id" FROM public."UserInfo" WHERE name = 'admin'));
|
||||
|
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS "UserAuth" CASCADE;
|
@ -0,0 +1,2 @@
|
||||
AlTER TABLE "DMP"
|
||||
ALTER COLUMN "Creator" DROP NOT NULL;
|
@ -0,0 +1,19 @@
|
||||
CREATE TABLE public."DatasetExternalDataset" (
|
||||
"Id" uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||
"Dataset" uuid NOT NULL,
|
||||
"ExternalDataset" uuid NOT NULL,
|
||||
"Role" numeric,
|
||||
"Data" character varying
|
||||
);
|
||||
|
||||
ALTER TABLE public."DatasetExternalDataset" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."DatasetExternalDataset"
|
||||
ADD CONSTRAINT "DatasetExternalDataset_pkey" PRIMARY KEY ("Id");
|
||||
|
||||
ALTER TABLE ONLY public."DatasetExternalDataset"
|
||||
ADD CONSTRAINT fkey_datasetexternaldataset_dataset FOREIGN KEY ("Dataset") REFERENCES public."Dataset"("ID");
|
||||
|
||||
ALTER TABLE ONLY public."DatasetExternalDataset"
|
||||
ADD CONSTRAINT fkey_datasetexternaldataset_externaldataset FOREIGN KEY ("ExternalDataset") REFERENCES public."ExternalDataset"("Id");
|
||||
|
@ -0,0 +1,23 @@
|
||||
CREATE TABLE public."Invitation" (
|
||||
"Id" uuid NOT NULL,
|
||||
"InvitationEmail" character varying NOT NULL,
|
||||
"Token" uuid NOT NULL,
|
||||
"CreationUser" uuid NOT NULL,
|
||||
"Dmp" uuid NOT NULL,
|
||||
"Properties" xml,
|
||||
"AcceptedInvitation" boolean
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."Invitation" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."Invitation"
|
||||
ADD CONSTRAINT "Invitation_pkey" PRIMARY KEY ("Id");
|
||||
|
||||
|
||||
ALTER TABLE ONLY public."Invitation"
|
||||
ADD CONSTRAINT fk_invitation_creator FOREIGN KEY ("CreationUser") REFERENCES public."UserInfo"(id);
|
||||
|
||||
|
||||
ALTER TABLE ONLY public."Invitation"
|
||||
ADD CONSTRAINT fk_invitation_dmp FOREIGN KEY ("Dmp") REFERENCES public."DMP"("ID");
|
@ -0,0 +1,16 @@
|
||||
CREATE TABLE public."UserPreference" (
|
||||
"Id" uuid NOT NULL,
|
||||
"UserId" uuid NOT NULL,
|
||||
"Data" json NOT NULL,
|
||||
"PreferenceType" smallint NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."UserPreference" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."UserPreference"
|
||||
ADD CONSTRAINT "UserPreference_pkey" PRIMARY KEY ("Id");
|
||||
|
||||
|
||||
ALTER TABLE ONLY public."UserPreference"
|
||||
ADD CONSTRAINT userpreference_user_fk FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id);
|
@ -0,0 +1,21 @@
|
||||
CREATE TABLE public."UserAssociation" (
|
||||
id uuid NOT NULL,
|
||||
"firstUser" uuid NOT NULL,
|
||||
"secondUser" uuid NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public."UserAssociation" OWNER TO dmptool;
|
||||
|
||||
ALTER TABLE ONLY public."UserAssociation"
|
||||
ADD CONSTRAINT pk_user_association PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE ONLY public."UserAssociation"
|
||||
ADD CONSTRAINT fk_userinfo_user_association_1 FOREIGN KEY ("firstUser") REFERENCES public."UserInfo"(id);
|
||||
|
||||
ALTER TABLE ONLY public."UserAssociation"
|
||||
ADD CONSTRAINT fk_userinfo_user_association_2 FOREIGN KEY ("secondUser") REFERENCES public."UserInfo"(id);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.002', '2020-05-04 13:42:00.000000+03', now(), 'Add User Association');
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
CREATE TABLE public."DoiFunder" (
|
||||
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
|
||||
name character varying,
|
||||
doi character varying
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE ONLY public."DoiFunder"
|
||||
ADD CONSTRAINT "DoiFunder_pkey" PRIMARY KEY (id);
|
||||
|
||||
ALTER TABLE public."DoiFunder" OWNER TO dmptool;
|
||||
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Australian Research Council', '10.13039/501100000923');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('European Commission', '10.13039/501100000780');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Fundação para a Ciência e a Tecnologia', '10.13039/501100001871');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Ministarstvo Prosvete, Nauke i Tehnološkog Razvoja', '10.13039/501100004564');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Ministarstvo Znanosti, Obrazovanja i Sporta', '10.13039/501100006588');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('National Health and Medical Research Council', '10.13039/501100000925');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('National Science Foundation','10.13039/100000001');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Nederlandse Organisatie voor Wetenschappelijk Onderzoek', '10.13039/501100003246');
|
||||
INSERT INTO public."DoiFunder"(name, doi) VALUES ('Wellcome Trust', '10.13039/100004440');
|
||||
|
||||
|
||||
|
@ -1,17 +1,32 @@
|
||||
FROM johnpapa/angular-cli as angular
|
||||
WORKDIR /app
|
||||
COPY package.json /app/
|
||||
RUN npm cache clear --force && npm install
|
||||
|
||||
COPY ./ /app/
|
||||
ARG env=dev
|
||||
ARG aot=--no-aot
|
||||
RUN echo $env
|
||||
RUN echo $aot
|
||||
RUN if [ "$env" = "prod" ]; then ng build --$env --$aot; else ng build --$aot; fi
|
||||
|
||||
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
|
||||
FROM nginx:1.13
|
||||
COPY --from=angular /app/dist/ /usr/share/nginx/html
|
||||
COPY --from=angular /app/static/ /usr/share/nginx/static
|
||||
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
|
||||
# stage1 as builder
|
||||
FROM node:12-alpine as builder
|
||||
|
||||
WORKDIR /page
|
||||
|
||||
# copy the package.json to install dependencies
|
||||
COPY package.json /page
|
||||
|
||||
# Install the dependencies and make the folder
|
||||
RUN npm install
|
||||
|
||||
COPY . /page
|
||||
|
||||
# Build the project and copy the files
|
||||
RUN npm run ng build -- --deploy-url=/ --prod
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
COPY nginx.conf /etc/nginx
|
||||
COPY mime.types /etc/nginx
|
||||
|
||||
## Remove default nginx index page
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# Copy from the stahg 1
|
||||
COPY --from=builder /page/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 4200
|
||||
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;", "-p", "/usr/share/nginx"]
|
||||
|
@ -0,0 +1,48 @@
|
||||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml rss;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/x-javascript js;
|
||||
text/plain txt;
|
||||
text/x-component htc;
|
||||
text/mathml mml;
|
||||
image/png png;
|
||||
image/x-icon ico;
|
||||
image/x-jng jng;
|
||||
image/vnd.wap.wbmp wbmp;
|
||||
application/java-archive jar war ear;
|
||||
application/mac-binhex40 hqx;
|
||||
application/pdf pdf;
|
||||
application/x-cocoa cco;
|
||||
application/x-java-archive-diff jardiff;
|
||||
application/x-java-jnlp-file jnlp;
|
||||
application/x-makeself run;
|
||||
application/x-perl pl pm;
|
||||
application/x-pilot prc pdb;
|
||||
application/x-rar-compressed rar;
|
||||
application/x-redhat-package-manager rpm;
|
||||
application/x-sea sea;
|
||||
application/x-shockwave-flash swf;
|
||||
application/x-stuffit sit;
|
||||
application/x-tcl tcl tk;
|
||||
application/x-x509-ca-cert der pem crt;
|
||||
application/x-xpinstall xpi;
|
||||
application/zip zip;
|
||||
application/octet-stream deb;
|
||||
application/octet-stream bin exe dll;
|
||||
application/octet-stream dmg;
|
||||
application/octet-stream eot;
|
||||
application/octet-stream iso img;
|
||||
application/octet-stream msi msp msm;
|
||||
audio/mpeg mp3;
|
||||
audio/x-realaudio ra;
|
||||
video/mpeg mpeg mpg;
|
||||
video/quicktime mov;
|
||||
video/x-flv flv;
|
||||
video/x-msvideo avi;
|
||||
video/x-ms-wmv wmv;
|
||||
video/x-ms-asf asx asf;
|
||||
video/x-mng mng;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
|
||||
events {
|
||||
worker_connections 4096; ## Default: 1024
|
||||
}
|
||||
|
||||
http {
|
||||
include ./mime.types;
|
||||
server {
|
||||
|
||||
listen 4200;
|
||||
|
||||
sendfile on;
|
||||
|
||||
gzip on;
|
||||
gzip_http_version 1.1;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
gzip_min_length 1100;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_comp_level 9;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'parseStatus',
|
||||
pure: true
|
||||
})
|
||||
export class ParseStatus implements PipeTransform {
|
||||
transform(value: any, ...args: any[]) {
|
||||
return this.parseStatus(value);
|
||||
}
|
||||
|
||||
|
||||
parseStatus(status: number): string {
|
||||
return status != 0 ? 'DATASET-PROFILE-STATUS.FINALIZED' : 'DATASET-PROFILE-STATUS.DRAFT';
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<h1 mat-dialog-title>{{'ADDORGANIZATION-EDITOR.TITLE' | translate}}</h1>
|
||||
<div mat-dialog-content class="row">
|
||||
<mat-form-field class="col-12">
|
||||
<input matInput formControlName="name" placeholder="{{'ADDORGANIZATION-EDITOR.NAME' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('name').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field class="col-12">
|
||||
<input matInput formControlName="lastName" placeholder="{{'ADDORGANIZATION-EDITOR.LAST_NAME' | translate}}" required>
|
||||
<mat-error *ngIf="formGroup.get('lastName').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field> -->
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="ml-auto col-auto"><button mat-raised-button mat-dialog-close type="button">{{'ADDORGANIZATION-EDITOR.ACTIONS.CANCEL' | translate}}</button></div>
|
||||
<div class="col-auto"><button mat-raised-button [disabled]="!isFormValid()" color="primary" (click)="addOrganization()" type="button">{{'ADDORGANIZATION-EDITOR.ACTIONS.SAVE' | translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,43 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { ExternalResearcherService } from '@app/core/services/external-sources/researcher/external-researcher.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { OrganizationEditorModel } from './add-organization.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-organization-component',
|
||||
templateUrl: 'add-organization.component.html',
|
||||
})
|
||||
export class AddOrganizationComponent extends BaseComponent implements OnInit {
|
||||
|
||||
public formGroup: FormGroup;
|
||||
|
||||
constructor(
|
||||
private externalResearcherService: ExternalResearcherService,
|
||||
public dialogRef: MatDialogRef<AddOrganizationComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { super(); }
|
||||
|
||||
ngOnInit(): void {
|
||||
const researcher = new OrganizationEditorModel();
|
||||
this.formGroup = researcher.buildForm();
|
||||
}
|
||||
|
||||
send(value: any) {
|
||||
this.externalResearcherService.createResearcher(this.formGroup.value)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
null, null, () => this.dialogRef.close()
|
||||
);
|
||||
}
|
||||
|
||||
addOrganization() {
|
||||
this.dialogRef.close(this.formGroup.value);
|
||||
}
|
||||
|
||||
isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ResearcherModel } from '@app/core/model/researcher/researcher';
|
||||
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||
import { OrganizationModel } from '@app/core/model/organisation/organization';
|
||||
|
||||
export class OrganizationEditorModel {
|
||||
public id: String;
|
||||
public name: String;
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
||||
|
||||
fromModel(item: OrganizationModel): OrganizationEditorModel {
|
||||
this.id = item.id;
|
||||
this.name = item.name;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||
if (context == null) { context = this.createValidationContext(); }
|
||||
const formGroup = new FormBuilder().group({
|
||||
name: [{ value: this.name, disabled: disabled }, context.getValidation('name').validators]
|
||||
});
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
createValidationContext(): ValidationContext {
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
baseContext.validation.push({ key: 'name', validators: [BackendErrorValidator(this.validationErrorModel, 'name')] });
|
||||
return baseContext;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue