Skip to content

Commit

Permalink
Internal/Copy fixes from ZCU (#749)
Browse files Browse the repository at this point in the history
* Use $JAVA_OPTS_HANDLE to define handle server memory.

* Do not add another slash in the handle URL (#737)

* The scheduled tasks are available in the `/scheduledtasks` endpoint. (#741)

* TUL/ The context user is set to current subscriber (#747)

* The context user is set to current subscriber

* Updated comment

* Fixed checktyle issue

* Cherry picked fix about integration tests (#751)

Co-authored-by: Tim Donohue <[email protected]>

---------

Co-authored-by: Tim Donohue <[email protected]>
  • Loading branch information
milanmajchrak and tdonohue authored Sep 16, 2024
1 parent 218f7f2 commit c999c5d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ public String resolveToURL(Context context, String handleStr) throws SQLExceptio
if (isInternalResource(handle)) {
// Internal handle
// Create url for internal handle
url = configurationService.getProperty("dspace.ui.url")
+ "/handle/" + handleStr;
String currentUiUrl = configurationService.getProperty("dspace.ui.url");
url = currentUiUrl.endsWith("/") ? currentUiUrl : currentUiUrl + "/";
url += "handle/" + handleStr;
} else {
// External handle
url = handle.getUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public SubscriptionEmailNotificationServiceImpl(Map<String, DSpaceObjectUpdates>
public void perform(Context context, DSpaceRunnableHandler handler, String subscriptionType, String frequency) {
List<IndexableObject> communityItems = new ArrayList<>();
List<IndexableObject> collectionsItems = new ArrayList<>();
EPerson currentEperson = context.getCurrentUser();
try {
List<Subscription> subscriptions =
findAllSubscriptionsBySubscriptionTypeAndFrequency(context, subscriptionType, frequency);
Expand All @@ -77,7 +78,10 @@ public void perform(Context context, DSpaceRunnableHandler handler, String subsc
for (Subscription subscription : subscriptions) {
DSpaceObject dSpaceObject = subscription.getDSpaceObject();
EPerson ePerson = subscription.getEPerson();

// Set the current user to the subscribed eperson because the Solr query checks
// the permissions of the current user in the ANONYMOUS group.
// If there is no user (i.e., `current user = null`), it will send an email with no new items.
context.setCurrentUser(ePerson);
if (!authorizeService.authorizeActionBoolean(context, ePerson, dSpaceObject, READ, true)) {
iterator++;
continue;
Expand Down Expand Up @@ -126,6 +130,8 @@ public void perform(Context context, DSpaceRunnableHandler handler, String subsc
handler.handleException(e);
context.abort();
}
// Reset the current user because it was changed to subscriber eperson
context.setCurrentUser(currentEperson);
}

@SuppressWarnings("rawtypes")
Expand Down
6 changes: 3 additions & 3 deletions dspace/bin/start-handle-server
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ HANDLEDIR=`$BINDIR/dspace dsprop --property handle.dir`
LOGDIR=$DSPACEDIR/log

#Allow user to specify java options through JAVA_OPTS variable
if [ "$JAVA_OPTS" = "" ]; then
if [ "$JAVA_OPTS_HANDLE" = "" ]; then
#Default Java to use 256MB of memory
JAVA_OPTS=-Xmx256m
$JAVA_OPTS_HANDLE=-Xmx256m
fi

# Remove lock file, in case the old Handle server did not shut down properly
Expand All @@ -34,7 +34,7 @@ rm -f $HANDLEDIR/txns/lock
# Start the Handle server, with a special log4j properties file.
# We cannot simply write to the same logs, since log4j
# does not support more than one JVM writing to the same rolling log.
nohup java $JAVA_OPTS -classpath `$BINDIR/dspace classpath` \
nohup java $JAVA_OPTS_HANDLE -classpath `$BINDIR/dspace classpath` \
-Ddspace.log.init.disable=true \
-Dlog4j.configuration=log4j-handle-plugin.properties \
net.handle.server.Main $HANDLEDIR \
Expand Down
2 changes: 1 addition & 1 deletion dspace/config/modules/actuator.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ management.endpoint.health.roles = ADMIN
## Configuration to establis
management.endpoint.health.status.order= down, out-of-service, up-with-issues, up, unknown
## Configuration that enables only health and info endpoints
management.endpoints.web.exposure.include=health,info
management.endpoints.web.exposure.include=health,info,scheduledtasks

## Configuration to set 200 as status of health http response when it is DOWN or OUT_OF_SERVICE
## The DSpace UI requires these be set to 200 in order to support health status reports when services are down.
Expand Down

0 comments on commit c999c5d

Please sign in to comment.