@@ -560,7 +560,9 @@ && checkPermissions(context, body.destinationWorkspaceId(), WorkspaceAction.writ
560560 body .destinationPath (),
561561 sourceWorkspace ,
562562 body .destinationWorkspaceId (),
563- body .overwrite ());
563+ body .overwrite (),
564+ authorize (context ).userId ()
565+ );
564566 if (moveResults .response .getValueType () == JsonValue .ValueType .STRING ) {
565567 context .status (moveResults .status ).result (((JsonString ) moveResults .response ()).getString ());
566568 } else {
@@ -576,7 +578,9 @@ && checkPermissions(context, body.destinationWorkspaceId(), WorkspaceAction.writ
576578 body .destinationPath (),
577579 sourceWorkspace ,
578580 body .destinationWorkspaceId (),
579- body .overwrite ());
581+ body .overwrite (),
582+ authorize (context ).userId ()
583+ );
580584 if (copyResults .response .getValueType () == JsonValue .ValueType .STRING ) {
581585 context .status (copyResults .status ).result (((JsonString ) copyResults .response ()).getString ());
582586 } else {
@@ -670,7 +674,8 @@ private HandlerResult handleMove(
670674 Path destinationPath ,
671675 int sourceWorkspaceId ,
672676 int destinationWorkspaceId ,
673- boolean overwrite
677+ boolean overwrite ,
678+ String userId
674679 ) throws NoSuchWorkspaceException
675680 {
676681 final var errorMsg = "Unable to move '%s' in Workspace %d to '%s' in Workspace %d."
@@ -697,7 +702,7 @@ private HandlerResult handleMove(
697702 return new HandlerResult (500 , new FormattedError (errorMsg ).toJson ());
698703 }
699704 } else {
700- if (workspaceService .moveFile (sourceWorkspaceId , toMove , destinationWorkspaceId , destinationPath )) {
705+ if (workspaceService .moveFile (sourceWorkspaceId , toMove , destinationWorkspaceId , destinationPath , userId )) {
701706 return new HandlerResult (200 , successMsg );
702707 } else {
703708 return new HandlerResult (500 , new FormattedError (errorMsg ).toJson ());
@@ -715,7 +720,8 @@ private HandlerResult handleCopy(
715720 Path destinationPath ,
716721 int sourceWorkspaceId ,
717722 int destinationWorkspaceId ,
718- boolean overwrite
723+ boolean overwrite ,
724+ String userId
719725 ) throws NoSuchWorkspaceException
720726 {
721727 final var errorMsg = "Unable to copy '%s' in Workspace %d to '%s' in Workspace %d."
@@ -742,7 +748,7 @@ private HandlerResult handleCopy(
742748 return new HandlerResult (500 , new FormattedError (errorMsg ).toJson ());
743749 }
744750 } else {
745- if (workspaceService .copyFile (sourceWorkspaceId , toCopy , destinationWorkspaceId , destinationPath )) {
751+ if (workspaceService .copyFile (sourceWorkspaceId , toCopy , destinationWorkspaceId , destinationPath , userId )) {
746752 return new HandlerResult (200 , successMsg );
747753 } else {
748754 return new HandlerResult (500 , new FormattedError (errorMsg ).toJson ());
@@ -1054,7 +1060,9 @@ && checkPermissions(context, body.destinationWorkspaceId(), WorkspaceAction.writ
10541060 items ,
10551061 sourceWorkspace ,
10561062 body .destinationWorkspaceId (),
1057- body .overwrite ());
1063+ body .overwrite (),
1064+ authorize (context ).userId ()
1065+ );
10581066 context .status (207 ).json (moveResults .toString ());
10591067 }
10601068 case PostActions .COPY -> {
@@ -1067,7 +1075,9 @@ && checkPermissions(context, body.destinationWorkspaceId(), WorkspaceAction.writ
10671075 items ,
10681076 sourceWorkspace ,
10691077 body .destinationWorkspaceId (),
1070- body .overwrite ());
1078+ body .overwrite (),
1079+ authorize (context ).userId ()
1080+ );
10711081 context .status (207 ).json (copyResults .toString ());
10721082 }
10731083 default -> context .status (501 ).json (new FormattedError ("Unsupported post action: " + body .action ().name ()).toJson ());
@@ -1078,7 +1088,8 @@ private JsonArray handleBulkMove(
10781088 List <BulkPostItem > toMove ,
10791089 int sourceWorkspaceId ,
10801090 int destinationWorkspaceId ,
1081- boolean overwrite
1091+ boolean overwrite ,
1092+ String userId
10821093 ) throws NoSuchWorkspaceException {
10831094 final var responseArray = Json .createArrayBuilder ();
10841095 for (final var item : toMove ){
@@ -1087,7 +1098,9 @@ private JsonArray handleBulkMove(
10871098 item .newPath (),
10881099 sourceWorkspaceId ,
10891100 destinationWorkspaceId ,
1090- overwrite );
1101+ overwrite ,
1102+ userId
1103+ );
10911104 final var response = Json .createObjectBuilder ()
10921105 .add ("item" , item .currentLocation ().toString ())
10931106 .add ("status" , results .status )
@@ -1101,7 +1114,8 @@ private JsonArray handleBulkCopy(
11011114 List <BulkPostItem > toCopy ,
11021115 int sourceWorkspaceId ,
11031116 int destinationWorkspaceId ,
1104- boolean overwrite
1117+ boolean overwrite ,
1118+ String userId
11051119 ) throws NoSuchWorkspaceException {
11061120 final var responseArray = Json .createArrayBuilder ();
11071121 for (final var item : toCopy ) {
@@ -1110,7 +1124,9 @@ private JsonArray handleBulkCopy(
11101124 item .newPath (),
11111125 sourceWorkspaceId ,
11121126 destinationWorkspaceId ,
1113- overwrite );
1127+ overwrite ,
1128+ userId
1129+ );
11141130 final var response = Json .createObjectBuilder ()
11151131 .add ("item" , item .currentLocation ().toString ())
11161132 .add ("status" , results .status )
0 commit comments