Skip to content

Commit

Permalink
Revert "Merge pull request #757 from openkfw/650-dms-no-auth"
Browse files Browse the repository at this point in the history
This reverts commit 8428529, reversing
changes made to 1bc6832.
  • Loading branch information
Stezido committed Mar 15, 2021
1 parent bbffed7 commit bac4f40
Show file tree
Hide file tree
Showing 30 changed files with 24 additions and 753 deletions.
8 changes: 2 additions & 6 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"joi": "^14.3.1",
"jsonwebtoken": "^8.5.0",
"lodash.isequal": "^4.5.0",
"minio": "^7.0.17",
"pino": "^5.8.0",
"pino-pretty": "^2.2.3",
"raw-body": "^2.3.3",
Expand All @@ -92,7 +91,6 @@
"@types/joi": "^14.3.2",
"@types/jsonwebtoken": "^8.0.0",
"@types/lodash.isequal": "^4.5.5",
"@types/minio": "^7.0.6",
"@types/mocha": "^5.2.6",
"@types/node": "^14.6.4",
"@types/pino": "^6.3.0",
Expand Down
10 changes: 0 additions & 10 deletions api/src/config/index.ts

This file was deleted.

17 changes: 0 additions & 17 deletions api/src/http_errors/not_found.ts

This file was deleted.

2 changes: 1 addition & 1 deletion api/src/httpd/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const createBasicApp = (

server.addContentTypeParser("application/gzip", async function (request, payload) {
request.headers["content-length"] = "1024mb";
return payload;
return payload;
});

// app.use(logging);
Expand Down
14 changes: 0 additions & 14 deletions api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import * as WorkflowitemAssignService from "./service/workflowitem_assign";
import * as WorkflowitemCloseService from "./service/workflowitem_close";
import * as WorkflowitemCreateService from "./service/workflowitem_create";
import * as WorkflowitemDocumentDownloadService from "./service/workflowitem_document_download";
import * as WorkflowitemDocumentDownloadMinioService from "./service/workflowitem_document_minio_download";
import * as WorkflowitemGetService from "./service/workflowitem_get";
import * as WorkflowitemViewHistoryService from "./service/workflowitem_history_get";
import * as WorkflowitemListService from "./service/workflowitem_list";
Expand Down Expand Up @@ -121,7 +120,6 @@ import * as WorkflowitemAssignAPI from "./workflowitem_assign";
import * as WorkflowitemCloseAPI from "./workflowitem_close";
import * as WorkflowitemCreateAPI from "./workflowitem_create";
import * as WorkflowitemsDocumentDownloadAPI from "./workflowitem_download_document";
import * as WorkflowitemsDocumentDownloadMinioAPI from "./workflowitem_download_document_minio";
import * as WorkflowitemListAPI from "./workflowitem_list";
import * as WorkflowitemPermissionGrantAPI from "./workflowitem_permission_grant";
import * as WorkflowitemPermissionRevokeAPI from "./workflowitem_permission_revoke";
Expand Down Expand Up @@ -778,18 +776,6 @@ WorkflowitemsDocumentDownloadAPI.addHttpHandler(server, URL_PREFIX, {
),
});

WorkflowitemsDocumentDownloadMinioAPI.addHttpHandler(server, URL_PREFIX, {
getDocumentMinio: (ctx, projectId, subprojectId, workflowitemId, documentId) =>
WorkflowitemDocumentDownloadMinioService.getDocumentMinio(
db,
ctx,
projectId,
subprojectId,
workflowitemId,
documentId,
),
});

/*
* Run the server.
*/
Expand Down
168 changes: 0 additions & 168 deletions api/src/lib/minio.ts

This file was deleted.

2 changes: 0 additions & 2 deletions api/src/service/domain/workflow/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface UploadedDocument {
id: string;
base64: string;
fileName: string;
url?: string;
}

export const uploadedDocumentSchema = Joi.object({
Expand All @@ -31,7 +30,6 @@ export const uploadedDocumentSchema = Joi.object({
.required()
.error(() => new Error("Document can't be an empty file")),
fileName: Joi.string(),
orgAccess: Joi.array().items(Joi.string()).optional(),
});

export async function hashDocument(
Expand Down
2 changes: 0 additions & 2 deletions api/src/service/domain/workflow/workflowitem_create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("Create workflowitem", () => {
workflowitemExists: async (_projectId, _subprojectId, _workflowitemId) => false,
getSubproject: async () => baseSubproject,
applyWorkflowitemType: () => [],
uploadDocument: () => new Promise(() => undefined),
});

assert.isTrue(Result.isErr(result));
Expand All @@ -62,7 +61,6 @@ describe("Create workflowitem", () => {
workflowitemExists: async (_projectId, _subprojectId, _workflowitemId) => false,
getSubproject: async () => baseSubproject,
applyWorkflowitemType: () => [],
uploadDocument: () => new Promise(() => undefined),
});

assert.isTrue(Result.isErr(result));
Expand Down
15 changes: 1 addition & 14 deletions api/src/service/domain/workflow/workflowitem_create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Joi = require("joi");
import { VError } from "verror";
import { minioEndPoint, hostPort } from "../../../config";
import Intent, { workflowitemIntents } from "../../../authz/intents";
import { Ctx } from "../../../lib/ctx";
import * as Result from "../../../result";
Expand Down Expand Up @@ -78,9 +77,6 @@ interface Repository {
event: BusinessEvent,
workflowitem: Workflowitem.Workflowitem,
): Result.Type<BusinessEvent[]>;
uploadDocument(
document: UploadedDocument
): Promise<void>;
}

export async function createWorkflowitem(
Expand Down Expand Up @@ -203,16 +199,7 @@ export async function createWorkflowitem(
if (Result.isErr(result)) {
return result;
}
const { document } = result as WorkflowitemDocumentUploaded.Event;
// document should be private
if (minioEndPoint) {
await repository.uploadDocument(document);
const eventData = {...result, document: {...document, base64: "", url: hostPort}};
documentUploadedEvents.push(eventData);
} else {
documentUploadedEvents.push(result);
}

documentUploadedEvents.push(result);
}

// Check the workflowitem type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ServiceUser } from "../organization/service_user";
import * as WorkflowitemDocument from "./document";
import * as Workflowitem from "./workflowitem";
import * as WorkflowitemDocumentUploaded from "./workflowitem_document_uploaded";
import { getDocument as getDocumentService } from "../../workflowitem_document_download";
import VError = require("verror");

interface Repository {
Expand All @@ -32,10 +31,7 @@ export async function getDocument(
return new NotAuthorized({ ctx, userId: user.id, intent, target: workflowitem });
}

/**
* Get all events from one document
* @see getDocumentService
*/
// Get all events from one document
const documentEvents = await repository.getDocumentEvents(documentId);
if (Result.isErr(documentEvents)) {
return new VError(
Expand Down
Loading

0 comments on commit bac4f40

Please sign in to comment.