Skip to content

Commit

Permalink
106812: Fix old rest resource policy creations
Browse files Browse the repository at this point in the history
  • Loading branch information
YanaDePauw committed Sep 29, 2023
1 parent b923e13 commit 1cf13e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,10 @@ static String getMimeType(String name) {
private void addPolicyToBitstream(org.dspace.core.Context context, ResourcePolicy policy,
org.dspace.content.Bitstream dspaceBitstream)
throws SQLException, AuthorizeException {
org.dspace.authorize.ResourcePolicy dspacePolicy = resourcePolicyService.create(context);
org.dspace.authorize.ResourcePolicy dspacePolicy =
resourcePolicyService.create(context, null,
groupService.findByIdOrLegacyId(context, policy.getGroupId()));
dspacePolicy.setAction(policy.getActionInt());
dspacePolicy.setGroup(groupService.findByIdOrLegacyId(context, policy.getGroupId()));
dspacePolicy.setdSpaceObject(dspaceBitstream);
dspacePolicy.setStartDate(policy.getStartDate());
dspacePolicy.setEndDate(policy.getEndDate());
Expand Down
5 changes: 3 additions & 2 deletions dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,10 @@ public Bitstream addItemBitstream(@PathParam("item_id") String itemId, InputStre
bitstreamsPolicies.remove(policy);
}

org.dspace.authorize.ResourcePolicy dspacePolicy = resourcePolicyService.create(context);
org.dspace.authorize.ResourcePolicy dspacePolicy =
resourcePolicyService.create(context,
null, groupService.findByIdOrLegacyId(context, groupId));
dspacePolicy.setAction(org.dspace.core.Constants.READ);
dspacePolicy.setGroup(groupService.findByIdOrLegacyId(context, groupId));
dspacePolicy.setdSpaceObject(dspaceBitstream);
if ((year != null) || (month != null) || (day != null)) {
Date date = new Date();
Expand Down

0 comments on commit 1cf13e3

Please sign in to comment.