diff --git a/lib/javax.annotation.jar b/lib/javax.annotation.jar new file mode 100644 index 0000000000000000000000000000000000000000..52dca7f561c5d579ca764cb25b96d3f539cf242a Binary files /dev/null and b/lib/javax.annotation.jar differ diff --git a/lib/javax.ejb.jar b/lib/javax.ejb.jar new file mode 100644 index 0000000000000000000000000000000000000000..4ebf5ecd4c9ab83540ef206f6c5a1906db008098 Binary files /dev/null and b/lib/javax.ejb.jar differ diff --git a/lib/javax.jms.jar b/lib/javax.jms.jar new file mode 100644 index 0000000000000000000000000000000000000000..d31451ada1ad9a4471d9bae383df647c9b4b5235 Binary files /dev/null and b/lib/javax.jms.jar differ diff --git a/lib/javax.persistence.jar b/lib/javax.persistence.jar new file mode 100644 index 0000000000000000000000000000000000000000..21d80e0ed3b5e20aa787087247a006398cda7679 Binary files /dev/null and b/lib/javax.persistence.jar differ diff --git a/lib/javax.resource.jar b/lib/javax.resource.jar new file mode 100644 index 0000000000000000000000000000000000000000..696a2345878907025784d2e6e49c6e6b41d1cfac Binary files /dev/null and b/lib/javax.resource.jar differ diff --git a/lib/javax.servlet.jar b/lib/javax.servlet.jar new file mode 100644 index 0000000000000000000000000000000000000000..0519e4a4e16c207f18527175c6a4425b2b1bacbd Binary files /dev/null and b/lib/javax.servlet.jar differ diff --git a/lib/javax.servlet.jsp.jar b/lib/javax.servlet.jsp.jar new file mode 100644 index 0000000000000000000000000000000000000000..9c0631cea0fd56031db19fc3edbb4db4bfbb923a Binary files /dev/null and b/lib/javax.servlet.jsp.jar differ diff --git a/lib/javax.servlet.jsp.jstl.jar b/lib/javax.servlet.jsp.jstl.jar new file mode 100644 index 0000000000000000000000000000000000000000..7be17cc742fde5e957696dd98f6d0cf6520ed294 Binary files /dev/null and b/lib/javax.servlet.jsp.jstl.jar differ diff --git a/lib/javax.transaction.jar b/lib/javax.transaction.jar new file mode 100644 index 0000000000000000000000000000000000000000..729c6952389cd4769d5d840b3d1a7941b3c0f63e Binary files /dev/null and b/lib/javax.transaction.jar differ diff --git a/src/main/java/org/nrg/dcm/preferences/DicomSCPPreference.java b/src/main/java/org/nrg/dcm/preferences/DicomSCPPreference.java index de3cf97330fb62373932a1ae48f416b2cfee6b22..80aab1ac85d3a066a670878d49c513b6c8d771cf 100644 --- a/src/main/java/org/nrg/dcm/preferences/DicomSCPPreference.java +++ b/src/main/java/org/nrg/dcm/preferences/DicomSCPPreference.java @@ -10,6 +10,7 @@ import org.nrg.prefs.annotations.NrgPreference; import org.nrg.prefs.annotations.NrgPreferenceBean; import org.nrg.prefs.beans.AbstractPreferenceBean; import org.nrg.prefs.exceptions.InvalidPreferenceName; +import org.nrg.prefs.services.NrgPreferenceService; import org.nrg.xdat.om.XnatProjectdata; import org.nrg.xnat.DicomObjectIdentifier; import org.nrg.xnat.utils.XnatUserProvider; @@ -28,7 +29,8 @@ import java.util.concurrent.Executors; @NrgPreferenceBean(toolId = "dicomScpManager", toolName = "DICOM SCP Manager", description = "Manages configuration of the various DICOM SCP endpoints on the XNAT system.") public class DicomSCPPreference extends AbstractPreferenceBean { @Autowired - public DicomSCPPreference(final XnatUserProvider primaryAdminUserProvider, final ApplicationContext context) { + public DicomSCPPreference(final NrgPreferenceService preferenceService, final XnatUserProvider primaryAdminUserProvider, final ApplicationContext context) { + super(preferenceService); _provider = primaryAdminUserProvider; _context = context; } diff --git a/src/main/java/org/nrg/xapi/rest/settings/SiteConfigApi.java b/src/main/java/org/nrg/xapi/rest/settings/SiteConfigApi.java index 628af014ba9952124baf0a441413e33a041ab102..f3d29c85e97176f00faabf8a89e919d009aded8d 100644 --- a/src/main/java/org/nrg/xapi/rest/settings/SiteConfigApi.java +++ b/src/main/java/org/nrg/xapi/rest/settings/SiteConfigApi.java @@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; @@ -41,6 +42,19 @@ public class SiteConfigApi extends AbstractXapiRestController { _appInfo = appInfo; } + @PostConstruct + public void checkForFoundPreferences() { + if (!_appInfo.isInitialized()) { + Map<String, String> tempPrefs = _appInfo.getFoundPreferences(); + if(tempPrefs!=null){ + _found.putAll(tempPrefs); + } + if (_found.size() > 0) { + _hasFoundPreferences = true; + } + } + } + @ApiOperation(value = "Returns a map of application build properties.", notes = "This includes the implementation version, Git commit hash, and build number and number.", response = Properties.class) @ApiResponses({@ApiResponse(code = 200, message = "Application build properties successfully retrieved."), @ApiResponse(code = 401, message = "Must be authenticated to access the XNAT REST API."), @ApiResponse(code = 500, message = "Unexpected error")}) @RequestMapping(value = "buildInfo", produces = {MediaType.APPLICATION_JSON_VALUE}, method = {RequestMethod.GET}) @@ -98,13 +112,15 @@ public class SiteConfigApi extends AbstractXapiRestController { _log.debug("User " + username + " requested the site configuration."); } - final Map<String, Object> preferences = _preferences.getPreferenceMap(); + final Map<String, Object> preferences = getPreferences(); if (!_appInfo.isInitialized()) { if (_log.isInfoEnabled()) { _log.info("The site is being initialized by user {}. Setting default values from context.", username); } - preferences.put("siteUrl", XnatHttpUtils.getServerRoot(request)); + if (!preferences.containsKey("siteUrl")) { + preferences.put("siteUrl", XnatHttpUtils.getServerRoot(request)); + } } return new ResponseEntity<>(preferences, HttpStatus.OK); @@ -125,7 +141,7 @@ public class SiteConfigApi extends AbstractXapiRestController { final Map<String, Object> values = new HashMap<>(); for (final String preference : preferences) { - final Object value = _preferences.getProperty(preference); + final Object value = getPreferences().get(preference); if (value != null) { values.put(preference, value); } @@ -141,7 +157,7 @@ public class SiteConfigApi extends AbstractXapiRestController { if (status != null) { return new ResponseEntity<>(status); } - final Object value = _preferences.getProperty(property); + final Object value = getPreferences().get(property); if (_log.isDebugEnabled()) { _log.debug("User " + getSessionUser().getUsername() + " requested the value for the site configuration property " + property + ", got value: " + value); } @@ -214,6 +230,15 @@ public class SiteConfigApi extends AbstractXapiRestController { return new ResponseEntity<>(HttpStatus.OK); } + private Map<String, Object> getPreferences() { + if (!_hasFoundPreferences) { + return _preferences.getPreferenceMap(); + } + final Map<String, Object> preferences = new HashMap<>(_preferences.getPreferenceMap()); + preferences.putAll(_found); + return preferences; + } + private void initialize() throws InitializationException { // In the case where the application hasn't yet been initialized, this operation should mean that the system is // being initialized from the set-up page. In that case, we need to propagate a few properties to the arc-spec @@ -228,5 +253,7 @@ public class SiteConfigApi extends AbstractXapiRestController { private static final Logger _log = LoggerFactory.getLogger(SiteConfigApi.class); private final SiteConfigPreferences _preferences; - private final XnatAppInfo _appInfo; + private final XnatAppInfo _appInfo; + private final Map<String, String> _found = new HashMap<>(); + private boolean _hasFoundPreferences; } diff --git a/src/main/java/org/nrg/xnat/configuration/ApplicationConfig.java b/src/main/java/org/nrg/xnat/configuration/ApplicationConfig.java index e20b4195d38352a945081d1d87722da608b7ea24..d3347eba07f22c91464742187d152c6b0235d653 100644 --- a/src/main/java/org/nrg/xnat/configuration/ApplicationConfig.java +++ b/src/main/java/org/nrg/xnat/configuration/ApplicationConfig.java @@ -2,7 +2,9 @@ package org.nrg.xnat.configuration; import org.nrg.config.exceptions.SiteConfigurationException; import org.nrg.config.services.ConfigService; +import org.nrg.framework.configuration.ConfigPaths; import org.nrg.framework.services.NrgEventService; +import org.nrg.prefs.services.NrgPreferenceService; import org.nrg.xdat.preferences.NotificationsPreferences; import org.nrg.xdat.preferences.SiteConfigPreferences; import org.nrg.xdat.security.HistoricPasswordValidator; @@ -50,18 +52,18 @@ public class ApplicationConfig { } @Bean - public SiteConfigPreferences siteConfigPreferences(final NrgEventService service) { - return new SiteConfigPreferences(service); + public SiteConfigPreferences siteConfigPreferences(final NrgPreferenceService preferenceService, final NrgEventService eventService, final ConfigPaths configFolderPaths) { + return new SiteConfigPreferences(preferenceService, eventService, configFolderPaths); } @Bean - public NotificationsPreferences notificationsPreferences(final NrgEventService service) { - return new NotificationsPreferences(service); + public NotificationsPreferences notificationsPreferences(final NrgPreferenceService preferenceService, final NrgEventService eventService, final ConfigPaths configFolderPaths) { + return new NotificationsPreferences(preferenceService, eventService, configFolderPaths); } @Bean - public AutomationPreferences automationPreferences(final NrgEventService service) { - return new AutomationPreferences(service); + public AutomationPreferences automationPreferences(final NrgPreferenceService preferenceService, final NrgEventService service) { + return new AutomationPreferences(preferenceService, service); } @Bean diff --git a/src/main/java/org/nrg/xnat/initialization/PropertiesConfig.java b/src/main/java/org/nrg/xnat/initialization/PropertiesConfig.java index b96165fcd8b03629ec3249e9d963176b042d1663..cbe258fb644cc1a337ad6a24e53349f711cd585a 100644 --- a/src/main/java/org/nrg/xnat/initialization/PropertiesConfig.java +++ b/src/main/java/org/nrg/xnat/initialization/PropertiesConfig.java @@ -2,6 +2,7 @@ package org.nrg.xnat.initialization; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.lang3.StringUtils; +import org.nrg.framework.configuration.ConfigPaths; import org.python.google.common.base.Joiner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +80,7 @@ public class PropertiesConfig { } @Bean - public List<Path> configFolderPaths(final Environment environment) { + public ConfigPaths configFolderPaths(final Environment environment) { if (_configFolderPaths.size() == 0) { final Map<String, String> paths = new HashMap<>(); for (int index = 0; index < CONFIG_LOCATIONS.size(); index++) { @@ -207,7 +208,7 @@ public class PropertiesConfig { private static final List<String> CONFIG_URLS = new ArrayList<>(); - private final List<Path> _configFolderPaths = new ArrayList<>(); + private final ConfigPaths _configFolderPaths = new ConfigPaths(); private final List<String> _configFolderLocations = new ArrayList<>(); private Path _xnatHome; } diff --git a/src/main/java/org/nrg/xnat/preferences/AutomationPreferences.java b/src/main/java/org/nrg/xnat/preferences/AutomationPreferences.java index 7e1f88846ef049f1e2aeb7fdbe083220059b90bd..27c9c8fcf68e66d6e74c06e786542ada52a09086 100644 --- a/src/main/java/org/nrg/xnat/preferences/AutomationPreferences.java +++ b/src/main/java/org/nrg/xnat/preferences/AutomationPreferences.java @@ -4,6 +4,7 @@ import org.nrg.framework.services.NrgEventService; import org.nrg.prefs.annotations.NrgPreference; import org.nrg.prefs.annotations.NrgPreferenceBean; import org.nrg.prefs.exceptions.InvalidPreferenceName; +import org.nrg.prefs.services.NrgPreferenceService; import org.nrg.xdat.preferences.EventTriggeringAbstractPreferenceBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,8 +19,8 @@ public class AutomationPreferences extends EventTriggeringAbstractPreferenceBean public static final String AUTOMATION_TOOL_ID = "automation"; @Autowired - public AutomationPreferences(final NrgEventService eventService) { - super(eventService); + public AutomationPreferences(final NrgPreferenceService preferenceService, final NrgEventService eventService) { + super(preferenceService, eventService); } @NrgPreference(defaultValue = "true") diff --git a/src/main/java/org/nrg/xnat/restlet/actions/AutomationBasedImporter.java b/src/main/java/org/nrg/xnat/restlet/actions/AutomationBasedImporter.java index 6f3064a81a3e48998077d67a1745bc99fd5abb8e..3d02fb72f854c1b4e99de643fefb8fd953ca5b6f 100644 --- a/src/main/java/org/nrg/xnat/restlet/actions/AutomationBasedImporter.java +++ b/src/main/java/org/nrg/xnat/restlet/actions/AutomationBasedImporter.java @@ -12,44 +12,25 @@ package org.nrg.xnat.restlet.actions; * @author Mike Hodge <hodgem@mir.wustl.edu> */ -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; - import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; - -import java.util.concurrent.Callable; - import org.apache.commons.lang.StringEscapeUtils; import org.apache.log4j.Logger; -import org.json.JSONObject; import org.json.JSONArray; import org.json.JSONException; +import org.json.JSONObject; import org.json.JSONTokener; - import org.nrg.action.ClientException; import org.nrg.action.ServerException; import org.nrg.automation.entities.ScriptOutput; import org.nrg.automation.entities.ScriptOutput.Status; +import org.nrg.automation.entities.ScriptTrigger; import org.nrg.automation.event.AutomationEventImplementerI; import org.nrg.automation.event.entities.AutomationCompletionEvent; import org.nrg.automation.event.entities.AutomationEventIdsIds; -import org.nrg.automation.entities.ScriptTrigger; import org.nrg.automation.services.AutomationEventIdsIdsService; import org.nrg.automation.services.AutomationEventIdsService; import org.nrg.automation.services.ScriptTriggerService; @@ -60,15 +41,6 @@ import org.nrg.xdat.XDAT; import org.nrg.xdat.om.XnatExperimentdata; import org.nrg.xdat.om.XnatProjectdata; import org.nrg.xdat.om.XnatSubjectdata; -import org.nrg.xnat.event.listeners.AutomationCompletionEventListener; -import org.nrg.xnat.restlet.actions.importer.ImporterHandler; -import org.nrg.xnat.restlet.actions.importer.ImporterHandlerA; -import org.nrg.xnat.restlet.files.utils.RestFileUtils; -import org.nrg.xnat.restlet.util.FileWriterWrapperI; -import org.nrg.xnat.turbine.utils.ArcSpecManager; - -import java.util.zip.ZipOutputStream; - import org.nrg.xft.event.EventMetaI; import org.nrg.xft.event.EventUtils; import org.nrg.xft.event.EventUtils.CATEGORY; @@ -81,6 +53,24 @@ import org.nrg.xft.security.UserI; import org.nrg.xft.utils.zip.TarUtils; import org.nrg.xft.utils.zip.ZipI; import org.nrg.xft.utils.zip.ZipUtils; +import org.nrg.xnat.event.listeners.AutomationCompletionEventListener; +import org.nrg.xnat.restlet.actions.importer.ImporterHandler; +import org.nrg.xnat.restlet.actions.importer.ImporterHandlerA; +import org.nrg.xnat.restlet.files.utils.RestFileUtils; +import org.nrg.xnat.restlet.util.FileWriterWrapperI; +import org.nrg.xnat.turbine.utils.ArcSpecManager; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.net.URLDecoder; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.zip.ZipOutputStream; @ImporterHandler(handler = "automation", allowCallsWithoutFiles = true, callPartialUriWrap = false) public class AutomationBasedImporter extends ImporterHandlerA implements Callable<List<String>> { diff --git a/src/main/java/org/nrg/xnat/services/XnatAppInfo.java b/src/main/java/org/nrg/xnat/services/XnatAppInfo.java index 72c82c41018613feaa060741a624f6deeff2b195..f6231161d19e83b8f3e9c5a04fc68a338c10e74e 100644 --- a/src/main/java/org/nrg/xnat/services/XnatAppInfo.java +++ b/src/main/java/org/nrg/xnat/services/XnatAppInfo.java @@ -1,18 +1,24 @@ package org.nrg.xnat.services; -import org.nrg.framework.utilities.BasicXnatResourceLocator; + +import org.nrg.prefs.exceptions.InvalidPreferenceName; +import org.nrg.xdat.XDAT; import org.python.google.common.collect.ImmutableMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PropertiesLoaderUtils; +import org.springframework.dao.DataAccessException; +import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Component; import javax.inject.Inject; import javax.servlet.ServletContext; import java.io.IOException; import java.io.InputStream; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; import java.text.DecimalFormat; import java.util.*; import java.util.jar.Attributes; @@ -32,6 +38,7 @@ public class XnatAppInfo { @Inject public XnatAppInfo(final ServletContext context, final JdbcTemplate template) throws IOException { + _template = template; try (final InputStream input = context.getResourceAsStream("/META-INF/MANIFEST.MF")) { final Manifest manifest = new Manifest(input); final Attributes attributes = manifest.getMainAttributes(); @@ -62,12 +69,50 @@ public class XnatAppInfo { keyedAttributes.put(property, attributes.getValue(property)); } } + if (!isInitialized()) { + try { + final int count = _template.queryForObject("select count(*) from arc_archivespecification", Integer.class); + if (count > 0) { + // Migrate to preferences map. + _template.query("select arc_archivespecification.site_id, arc_archivespecification.site_admin_email, arc_archivespecification.site_url, arc_archivespecification.smtp_host, arc_archivespecification.require_login, arc_archivespecification.enable_new_registrations, arc_archivespecification.enable_csrf_token, arc_pathinfo.archivepath, arc_pathinfo.prearchivepath, arc_pathinfo.cachepath, arc_pathinfo.buildpath, arc_pathinfo.ftppath, arc_pathinfo.pipelinepath from arc_archivespecification LEFT JOIN arc_pathinfo ON arc_archivespecification.globalpaths_arc_pathinfo_id=arc_pathinfo.arc_pathinfo_id", new RowMapper<Object>() { + @Override + public Object mapRow(final ResultSet rs, final int rowNum) throws SQLException { + _foundPreferences.put("siteId", rs.getString("site_id")); + _foundPreferences.put("adminEmail", rs.getString("site_admin_email")); + _foundPreferences.put("siteUrl", rs.getString("site_url")); + _foundPreferences.put("smtp_host", rs.getString("smtp_host")); + _foundPreferences.put("requireLogin", rs.getString("require_login")); + _foundPreferences.put("userRegistration", rs.getString("enable_new_registrations")); + _foundPreferences.put("enableCsrfToken", rs.getString("enable_csrf_token")); + _foundPreferences.put("archivePath", rs.getString("archivepath")); + _foundPreferences.put("prearchivePath", rs.getString("prearchivepath")); + _foundPreferences.put("cachePath", rs.getString("cachepath")); + _foundPreferences.put("buildPath", rs.getString("buildpath")); + _foundPreferences.put("ftpPath", rs.getString("ftppath")); + _foundPreferences.put("pipelinePath", rs.getString("pipelinepath")); + return _foundPreferences; + } + }); + } + } catch (DataAccessException e) { + _log.info("Nothing to migrate"); + } + } } - for (final Resource resource : BasicXnatResourceLocator.getResources("classpath*:META-INF/xnat/**/*-plugin.properties")) { - final Properties properties = PropertiesLoaderUtils.loadProperties(resource); - _plugins.put(properties.getProperty("name"), properties); + + } + + public Map<String, String> getFoundPreferences() { + if (_foundPreferences.size() == 0) { + return null; } - _template = template; + + return new HashMap<>(_foundPreferences); + +// for (final Resource resource : BasicXnatResourceLocator.getResources("classpath*:META-INF/xnat/**/*-plugin.properties")) { +// final Properties properties = PropertiesLoaderUtils.loadProperties(resource); +// _plugins.put(properties.getProperty("name"), properties); +// } } /** @@ -81,10 +126,34 @@ public class XnatAppInfo { // Recheck to see if it has been initialized. We don't need to recheck to see if it's been // uninitialized because that's silly. //noinspection SqlDialectInspection,SqlNoDataSourceInspection - _initialized = _template.queryForObject("select value from xhbm_preference p, xhbm_tool t where t.tool_id = 'siteConfig' and p.tool = t.id and p.name = 'initialized';", Boolean.class); - if (_log.isInfoEnabled()) { - _log.info("The site was not flagged as initialized, but found initialized preference set to true. Flagging as initialized."); + try { + _initialized = _template.queryForObject("select value from xhbm_preference p, xhbm_tool t where t.tool_id = 'siteConfig' and p.tool = t.id and p.name = 'initialized';", Boolean.class); + if (_initialized) { + if (_log.isInfoEnabled()) { + _log.info("The site was not flagged as initialized, but found initialized preference set to true. Flagging as initialized."); + } + } else { + if (_log.isInfoEnabled()) { + _log.info("The site was not flagged as initialized and initialized preference set to false. Setting system for initialization."); + } + for(String pref: _foundPreferences.keySet()){ + _template.update( + "UPDATE xhbm_preference SET value = ? WHERE name = ?", + new Object[]{_foundPreferences.get(pref), pref}, new int[]{Types.VARCHAR, Types.VARCHAR} + ); + try { + XDAT.getSiteConfigPreferences().set(_foundPreferences.get(pref), pref); + } + catch(InvalidPreferenceName e){ + _log.error("",e); + } + } + } + } + catch(EmptyResultDataAccessException e){ + //Could not find the initialized preference. Site is still not initialized. } + } return _initialized; } @@ -231,11 +300,12 @@ public class XnatAppInfo { private final JdbcTemplate _template; - private final Date _startTime = new Date(); - private final Properties _properties = new Properties(); - private final Map<String, Map<String, String>> _attributes = new HashMap<>(); - private final Map<String, Properties> _plugins = new HashMap<>(); + private final Map<String, String> _foundPreferences = new HashMap<>(); - private boolean _initialized = false; + private final Date _startTime = new Date(); + private final Properties _properties = new Properties(); + private final Map<String, Map<String, String>> _attributes = new HashMap<>(); + private boolean _initialized = false; + private final Map<String, Properties> _plugins = new HashMap<>(); } diff --git a/src/main/java/org/nrg/xnat/turbine/modules/actions/AcceptProjectAccess.java b/src/main/java/org/nrg/xnat/turbine/modules/actions/AcceptProjectAccess.java index d3ee58d874a3e42a520abeb38cb918a519ddbf25..178742953689019c58634cb17d6940d8ead504e6 100644 --- a/src/main/java/org/nrg/xnat/turbine/modules/actions/AcceptProjectAccess.java +++ b/src/main/java/org/nrg/xnat/turbine/modules/actions/AcceptProjectAccess.java @@ -29,6 +29,7 @@ public class AcceptProjectAccess extends SecureAction { @Override public void doPerform(RunData data, Context context) throws Exception { UserI user = (UserI) context.get("user"); //Check the user in the context before XDAT.getUserDetails() because XDAT.getUserDetails() may still be the guest user at this point. + if (user == null) { user = XDAT.getUserDetails(); } diff --git a/src/main/webapp/setup/site-setup.yaml b/src/main/webapp/setup/site-setup.yaml index 537ad89cbd118c29307f69951a2171b4fe62b997..e7432fa64c0cf7bd154c5fad8f63c273455637f0 100644 --- a/src/main/webapp/setup/site-setup.yaml +++ b/src/main/webapp/setup/site-setup.yaml @@ -213,3 +213,39 @@ siteSetup: name: mail.smtp.ssl.trust label: SSL Trust + # ========================= + # OTHER SETTINGS + otherSettings: + kind: panel.form + name: otherSettings + label: Miscellaneous Settings + footer: false + method: POST + action: /xapi/notifications/batch + contentType: json + load: XNAT.data.siteConfig + contents: + + requireLogin: + kind: panel.input.checkbox + id: requireLogin + name: requireLogin + label: Require User Login + description: "If checked, then only registered users will be able to access your site. If false, anyone visiting your site will automatically be logged in as 'guest' with access to public data." + + autoEnableUserRegistration: + kind: panel.input.checkbox + id: autoEnableUserRegistration + name: userRegistration + label: "Auto-enable User Registration?" + description: > + If true, user accounts will be enabled automatically when the user registers. Users will be able to access the site and any 'public' + projects immediately. If false, the site administrator will be required to manually enable user accounts. Either way the administrator + receives an email notification when a user registers. + + enableCsrfToken: + kind: panel.input.checkbox + id: enableCsrfToken + name: enableCsrfToken + label: Require CSRF Token? + description: Should this site require the use of a token to prevent CSRF attacks on POST, PUT, and DELETEs? \ No newline at end of file