@@ -59,11 +59,13 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
59
59
*/
60
60
package org .dcache .restful .resources .tape ;
61
61
62
+ import static org .dcache .http .AuthenticationHandler .getLoginAttributes ;
62
63
import static org .dcache .restful .util .HttpServletRequests .getUserRootAwareTargetPrefix ;
63
64
import static org .dcache .restful .util .JSONUtils .newBadRequestException ;
64
65
import static org .dcache .restful .util .RequestUser .getRestriction ;
65
66
import static org .dcache .restful .util .RequestUser .getSubject ;
66
67
68
+ import diskCacheV111 .util .FsPath ;
67
69
import diskCacheV111 .util .PnfsHandler ;
68
70
import io .swagger .annotations .Api ;
69
71
import io .swagger .annotations .ApiOperation ;
@@ -81,15 +83,18 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
81
83
import javax .servlet .http .HttpServletRequest ;
82
84
import javax .ws .rs .BadRequestException ;
83
85
import javax .ws .rs .Consumes ;
86
+ import javax .ws .rs .ForbiddenException ;
84
87
import javax .ws .rs .POST ;
85
88
import javax .ws .rs .Path ;
86
89
import javax .ws .rs .PathParam ;
87
90
import javax .ws .rs .Produces ;
88
91
import javax .ws .rs .core .Context ;
89
92
import javax .ws .rs .core .MediaType ;
90
93
import javax .ws .rs .core .Response ;
94
+ import org .dcache .auth .attributes .LoginAttributes ;
91
95
import org .dcache .auth .attributes .Restriction ;
92
96
import org .dcache .cells .CellStub ;
97
+ import org .dcache .http .PathMapper ;
93
98
import org .dcache .restful .util .HandlerBuilders ;
94
99
import org .dcache .restful .util .bulk .BulkServiceCommunicator ;
95
100
import org .dcache .services .bulk .BulkRequest ;
@@ -116,6 +121,9 @@ public final class ReleaseResources {
116
121
@ Inject
117
122
private BulkServiceCommunicator service ;
118
123
124
+ @ Inject
125
+ private PathMapper pathMapper ;
126
+
119
127
@ Inject
120
128
@ Named ("pnfs-stub" )
121
129
private CellStub pnfsmanager ;
@@ -170,6 +178,8 @@ public Response release(
170
178
171
179
Subject subject = getSubject ();
172
180
Restriction restriction = getRestriction ();
181
+ FsPath userRoot = LoginAttributes .getUserRoot (getLoginAttributes (request ));
182
+ FsPath rootPath = pathMapper .effectiveRoot (userRoot , ForbiddenException ::new );
173
183
174
184
/*
175
185
* For WLCG, this is a fire-and-forget request, so it does not need to
@@ -184,7 +194,9 @@ public Response release(
184
194
185
195
PnfsHandler handler = HandlerBuilders .unrestrictedPnfsHandler (pnfsmanager );
186
196
187
- request .setTargetPrefix (getUserRootAwareTargetPrefix (this .request , null , handler ));
197
+ request .setTargetPrefix (getUserRootAwareTargetPrefix (this .request ,
198
+ rootPath .toString (),
199
+ handler ));
188
200
189
201
BulkRequestMessage message = new BulkRequestMessage (request , restriction );
190
202
message .setSubject (subject );
0 commit comments