Skip to content

Commit

Permalink
bulk: let bulk propagate Subject for pin/stage
Browse files Browse the repository at this point in the history
Motivation:
When making pin, stage or unpin requests via `PinManager`, the bulk service currently does not propagate the subject to PinManager. If it did, that information would be used by PinManager/PoolManager to enforce permissions such as if a subject is allowed to stage.

Modification:
Add the known subject to `PinManagerPinRequest` and `PinManagerUnpinMessage` messages issued by bulk.

Result:
Better enforcement of subject-based permissions.

Target: master
Request: 9.0
Request: 8.2
Request: 8.1
Request: 8.0
Request: 7.2
Requires-notes: no
Requires-book: no
Patch: https://rb.dcache.org/r/13949/
Acked-by: Albert Rossi
  • Loading branch information
lemora committed Mar 31, 2023
1 parent ac9976d commit 66b8f42
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Expand Up @@ -116,6 +116,7 @@ public ListenableFuture<Message> perform(String rid, long tid, FsPath target,
PinManagerPinMessage message
= new PinManagerPinMessage(attributes, getProtocolInfo(), id,
lifetimeInMillis);
message.setSubject(subject);
return pinManager.send(message, Long.MAX_VALUE);
} catch (URISyntaxException | CacheException e) {
return Futures.immediateFailedFuture(e);
Expand All @@ -133,7 +134,7 @@ protected void configure(Map<String, String> arguments) {
String expire = arguments.get(LIFETIME.getName());
String unit = arguments.get(LIFETIME_UNIT.getName());

Long value = (long)(Double.parseDouble(expire));
Long value = (long) (Double.parseDouble(expire));

lifetimeInMillis = expire == null ? defaultUnit.toMillis(defaultValue)
: unit == null ? defaultUnit.toMillis(value)
Expand Down
Expand Up @@ -132,6 +132,7 @@ protected PinManagerUnpinMessage unpinMessage(String id, BulkRequestTarget targe

protected PinManagerUnpinMessage unpinMessage(String id, PnfsId pnfsId) {
PinManagerUnpinMessage message = new PinManagerUnpinMessage(pnfsId);
message.setSubject(subject);
message.setRequestId(id);
return message;
}
Expand Down
Expand Up @@ -124,6 +124,7 @@ public ListenableFuture<Message> perform(String rid, long tid, FsPath target,
PinManagerPinMessage message
= new PinManagerPinMessage(attributes, getProtocolInfo(), id,
getLifetimeInMillis(target));
message.setSubject(subject);
return pinManager.send(message, Long.MAX_VALUE);
} catch (URISyntaxException | CacheException e) {
return Futures.immediateFailedFuture(e);
Expand Down

0 comments on commit 66b8f42

Please sign in to comment.