Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
313d1fa
102-BE/cannot-read-big-file-by-readAllBytes (#277)
Paurikova2 May 11, 2023
7455b79
103-be/shibboleth-login-wrong-error-page (#279)
milanmajchrak May 15, 2023
1b5eb81
105-be/user-is-not-registered-after-shibboleth-login (#281)
milanmajchrak May 17, 2023
f64b24d
88-BE/license-labels-are-missing-icons (#273)
Paurikova2 May 18, 2023
9f0e6b6
110-be/imported-item-should-not-regenerate-certain-metadata-fields (#…
milanmajchrak May 22, 2023
7fc92a9
Changed logging (#286)
milanmajchrak May 25, 2023
07752b1
116 be/deleted bitstreams cannot be imported (#296)
milanmajchrak Jun 1, 2023
3f9ef3f
80-BE/import-tasklistitem (#300)
Paurikova2 Jun 2, 2023
2315819
throw exception soon and explain better (#308)
MajoBerger Jun 6, 2023
c3020b5
added commit (#306)
Paurikova2 Jun 14, 2023
6aee0c3
87-BE/adding-missing-attributes (#303)
Paurikova2 Jun 14, 2023
ae6ef90
119-BE/remove-validation-of-deleted-bitstreams (#302)
Paurikova2 Jun 14, 2023
689fd59
added mvn argument fail-at-end (#319)
MajoBerger Jun 19, 2023
dc21db3
75-BE/missing-handles (#314)
Paurikova2 Jun 21, 2023
f26cbec
122-be/restricted-item-download-issues (#331)
milanmajchrak Jun 21, 2023
c68878c
Be/fixed bitstreams added user metadata (#295)
milanmajchrak Jun 21, 2023
41d5a1a
Internal/fix integration tests 75 (#311)
MajoBerger Jun 22, 2023
3136308
Removed not defined search options. (#337)
milanmajchrak Jun 22, 2023
cf61d34
browse - Updated IT according to updated cfg (#339)
milanmajchrak Jun 22, 2023
f2ce601
enable different endpoint to S3 bitstorage (#338)
MajoBerger Jun 22, 2023
8d8366d
Migrate to 7.5 (#274)
milanmajchrak Jun 23, 2023
3a038ba
Copied fix from 303
milanmajchrak Jun 23, 2023
e5ad3d0
Copied fix from 302, 319, 314
milanmajchrak Jun 23, 2023
1922e6f
Copied fix from 331
milanmajchrak Jun 23, 2023
2ed4f61
Copied fix from 295
milanmajchrak Jun 23, 2023
588576b
Copied fix from 337, 339
milanmajchrak Jun 23, 2023
fa89798
Removed ClarinLicenseImportRestController.java according to 273
milanmajchrak Jun 23, 2023
d252d09
Merge branch 'dtq-dev' into dtq-dev-7.5
milanmajchrak Jun 23, 2023
4e8c316
Eperson.hasPasswordSet was missing and one checkstyle violation as oc…
milanmajchrak Jun 23, 2023
bd0fbbd
Docker image should be generated.
milanmajchrak Jun 23, 2023
84cfd3d
Temp file
milanmajchrak Jun 23, 2023
644d182
Merge branch 'dtq-dev-7.5' into migrate-to-7.5
milanmajchrak Jun 23, 2023
39667be
Migrate to 7.5 (#343)
milanmajchrak Jun 23, 2023
5d34fe7
Merge remote-tracking branch 'origin/dtq-dev-7.5' into dtq-dev-7.5
milanmajchrak Jun 23, 2023
66c40a4
Removed unused class
milanmajchrak Jun 23, 2023
190d19f
Updated docker.yml
milanmajchrak Jun 23, 2023
d972002
Updated cfg (#348)
milanmajchrak Jun 27, 2023
cd1218e
Fixed from port 4000 to 8080 (#350)
milanmajchrak Jun 29, 2023
83569da
add redeploy to dev-5 -> curl call to deploy action
MajoBerger Jun 30, 2023
0434f97
add redeploy to dev-5 -> curl call to deploy action
MajoBerger Jun 30, 2023
2c12b8f
correct redeploy branch in github action
MajoBerger Jun 30, 2023
b4c05e8
Removed duplicate definition of the property (#353)
milanmajchrak Jul 3, 2023
43242ae
Merge branch 'dtq-dev' into dtq-dev-7.5
milanmajchrak Jul 3, 2023
db9bde0
internal/shibboleth-missing-one-error-page
milanmajchrak Jul 3, 2023
3b415ae
migrated-7.5/oai-is-not-working (#355)
milanmajchrak Jul 4, 2023
90f6e82
Merge branch 'customer/TUL' into dtq-dev-7.5
milanmajchrak Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# - failsafe.rerunFailingTestsCount => try again for flakey tests, and keep track of/report on number of retries
- type: "Integration Tests"
java: 11
mvnflags: "-DskipIntegrationTests=false -Denforcer.skip=true -Dcheckstyle.skip=true -Dlicense.skip=true -Dxml.skip=true -Dfailsafe.rerunFailingTestsCount=2"
mvnflags: "-DskipIntegrationTests=false -Denforcer.skip=true -Dcheckstyle.skip=true -Dlicense.skip=true -Dxml.skip=true -Dfailsafe.rerunFailingTestsCount=2 -fae"
resultsdir: "**/target/failsafe-reports/**"
# Do NOT exit immediately if one matrix job fails
# This ensures ITs continue running even if Unit Tests fail, or visa versa
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
push:
branches:
- dtq-dev
- dtq-dev-present
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -178,4 +177,4 @@ jobs:
--request POST \
https://api.github.com/repos/dataquest-dev/\
dspace-angular/actions/workflows/deploy.yml/dispatches \
--data "{\"ref\":\"refs/heads/customer/TUL\"}"
--data "{\"ref\":\"refs/heads/dtq-dev-7.5\"}"
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ public static void main(String[] argv)
protected CreateAdministrator()
throws Exception {
context = new Context();
try {
context.getDBConfig();
} catch (NullPointerException npr) {
// if database is null, there is no point in continuing. Prior to this exception and catch,
// NullPointerException was thrown, that wasn't very helpful.
throw new IllegalStateException("Problem connecting to database. This" +
" indicates issue with either network or version (or possibly some other). " +
"If you are running this in docker-compose, please make sure dspace-cli was " +
"built from the same sources as running dspace container AND that they are in " +
"the same project/network.");
}
groupService = EPersonServiceFactory.getInstance().getGroupService();
ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
clarinUserRegistrationService = ClarinServiceFactory.getInstance().getClarinUserRegistration();
Expand Down
8 changes: 8 additions & 0 deletions dspace-api/src/main/java/org/dspace/app/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,12 @@ public static List<String> differenceInSubmissionFields(Collection fromCollectio

return ListUtils.removeAll(fromFieldName, toFieldName);
}


public static String formatNetId(String netId, String organization) {
if (StringUtils.isBlank(netId)) {
return null;
}
return netId + "[" + organization + "]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.util.Util;
import org.dspace.authenticate.AuthenticationMethod;
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
import org.dspace.authorize.AuthorizeException;
Expand Down Expand Up @@ -82,6 +83,9 @@ public class ClarinShibAuthentication implements AuthenticationMethod {
*/
private static final Logger log = LogManager.getLogger(ClarinShibAuthentication.class);

// If the user which are in the login process has email already associated with a different users email.
private boolean isDuplicateUser = false;

/**
* Additional metadata mappings
**/
Expand Down Expand Up @@ -249,7 +253,7 @@ public int authenticate(Context context, String username, String password,
EPerson eperson = findEPerson(context, request);

// Step 2: Register New User, if necessary
if (eperson == null && autoRegister) {
if (eperson == null && autoRegister && !isDuplicateUser) {
eperson = registerNewEPerson(context, request);
}

Expand Down Expand Up @@ -550,7 +554,8 @@ protected EPerson findEPerson(Context context, HttpServletRequest request) throw

// 1) First, look for a netid header.
if (netidHeader != null) {
String netid = findSingleAttribute(request, netidHeader);
String org = shibheaders.get_idp();
String netid = Util.formatNetId(findSingleAttribute(request, netidHeader), org);
if (StringUtils.isEmpty(netid)) {
netid = shibheaders.get_single(netidHeader);
}
Expand Down Expand Up @@ -605,6 +610,7 @@ protected EPerson findEPerson(Context context, HttpServletRequest request) throw
"'. This might be a possible hacking attempt to steal another users " +
"credentials. If the user's netid has changed you will need to manually " +
"change it to the correct value or unset it in the database.");
this.isDuplicateUser = true;
eperson = null;
}
}
Expand Down Expand Up @@ -687,7 +693,7 @@ protected EPerson registerNewEPerson(Context context, HttpServletRequest request
// CLARIN

// Header values
String netid = findSingleAttribute(request, netidHeader);
String netid = Util.formatNetId(findSingleAttribute(request, netidHeader), org);
String email = findSingleAttribute(request, emailHeader);
String fname = findSingleAttribute(request, fnameHeader);
String lname = findSingleAttribute(request, lnameHeader);
Expand All @@ -706,7 +712,7 @@ protected EPerson registerNewEPerson(Context context, HttpServletRequest request
lname = shibheaders.get_single(lnameHeader);
}

if ( email == null && netid == null) {
if ( email == null ) {
// We require that there be an email, first name, and last name. If we
// don't have at least these three pieces of information then we fail.
String message = "Unable to register new eperson because we are unable to find an email address along " +
Expand Down Expand Up @@ -809,7 +815,7 @@ protected void updateEPerson(Context context, HttpServletRequest request, EPerso
String fnameHeader = configurationService.getProperty("authentication-shibboleth.firstname-header");
String lnameHeader = configurationService.getProperty("authentication-shibboleth.lastname-header");

String netid = findSingleAttribute(request, netidHeader);
String netid = Util.formatNetId(findSingleAttribute(request, netidHeader), shibheaders.get_idp());
String email = findSingleAttribute(request, emailHeader);
String fname = findSingleAttribute(request, fnameHeader);
String lname = findSingleAttribute(request, lnameHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.util.Util;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;

/**
* Shibboleth authentication header abstraction for DSpace
Expand All @@ -29,6 +32,8 @@ public class ShibHeaders {
// constants
//
private static final String header_separator_ = ";";
private String netIdHeader = "";
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();

// variables
//
Expand Down Expand Up @@ -58,10 +63,12 @@ public ShibHeaders(String shibHeaders) {

public void initialise(HttpServletRequest request, List<String> interesting) {
headers_ = new Headers(request, header_separator_, interesting);
this.initializeNetIdHeader();
}

public void initialise(String shibHeaders) {
headers_ = new Headers(shibHeaders, header_separator_);
this.initializeNetIdHeader();
}

//
Expand Down Expand Up @@ -97,6 +104,10 @@ public List<String> get(String key) {
public String get_single(String name) {
List<String> values = get(name);
if (values != null && !values.isEmpty()) {
// Format netId
if (StringUtils.equals(name, this.netIdHeader)) {
return Util.formatNetId(values.get(0), this.get_idp());
}
return values.get(0);
}
return null;
Expand Down Expand Up @@ -137,4 +148,8 @@ public void log_headers() {
i.getKey(), StringUtils.join(i.getValue().toArray(), ",") ));
}
}

private void initializeNetIdHeader() {
this.netIdHeader = configurationService.getProperty("authentication-shibboleth.netid-header");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@

import java.sql.SQLException;
import javax.persistence.Query;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

import org.dspace.content.clarin.ClarinVerificationToken;
import org.dspace.content.clarin.ClarinVerificationToken_;
import org.dspace.content.dao.clarin.ClarinVerificationTokenDAO;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
Expand Down Expand Up @@ -39,13 +43,14 @@ public ClarinVerificationToken findByToken(Context context, String token) throws

@Override
public ClarinVerificationToken findByNetID(Context context, String netID) throws SQLException {
Query query = createQuery(context, "SELECT cvt " +
"FROM ClarinVerificationToken cvt " +
"WHERE cvt.ePersonNetID = :netID");

query.setParameter("netID", netID);
query.setHint("org.hibernate.cacheable", Boolean.TRUE);

return singleResult(query);
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ClarinVerificationToken.class);
Root<ClarinVerificationToken> clarinVerificationTokenRoot = criteriaQuery.from(ClarinVerificationToken.class);
criteriaQuery.select(clarinVerificationTokenRoot);
criteriaQuery.where(criteriaBuilder.like(clarinVerificationTokenRoot.get(ClarinVerificationToken_.ePersonNetID),
"%" + netID + "%"));
criteriaQuery.orderBy(criteriaBuilder.asc(clarinVerificationTokenRoot.
get(ClarinVerificationToken_.ePersonNetID)));
return singleResult(context, criteriaQuery);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
Expand Down Expand Up @@ -78,6 +79,8 @@ public class RoleDisseminator implements PackageDisseminator {
public static final String CAN_LOGIN = "CanLogin";
public static final String REQUIRE_CERTIFICATE = "RequireCertificate";
public static final String SELF_REGISTERED = "SelfRegistered";
public static final String WELCOME_INFO = "welcomeInfo";
public static final String CAN_EDIT_SUBMISSION_METADATA = "canEditSubmissionMetadata";

// Valid type values for Groups (only used when Group is associated with a Community or Collection)
public static final String GROUP_TYPE_ADMIN = "ADMIN";
Expand Down Expand Up @@ -461,6 +464,13 @@ protected void writeEPerson(EPerson eperson, XMLStreamWriter writer,
writer.writeEmptyElement(SELF_REGISTERED);
}

if (Objects.nonNull(eperson.getWelcomeInfo())) {
writer.writeEmptyElement(WELCOME_INFO);
}

if (Objects.nonNull(eperson.getCanEditSubmissionMetadata())) {
writer.writeEmptyElement(CAN_EDIT_SUBMISSION_METADATA);
}
writer.writeEndElement();
}

Expand Down
18 changes: 18 additions & 0 deletions dspace-api/src/main/java/org/dspace/eperson/EPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public class EPerson extends DSpaceObject implements DSpaceObjectLegacySupport {
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "epeople")
private final List<Group> groups = new ArrayList<>();

@Column(name = "welcome_info")
private String welcomeInfo;

@Column(name = "can_edit_submission_metadata")
private Boolean canEditSubmissionMetadata;

/**
* The e-mail field (for sorting)
*/
Expand Down Expand Up @@ -446,6 +452,18 @@ public Date getPreviousActive() {
return previousActive;
}

public String getWelcomeInfo() {
return welcomeInfo;
}
public void setWelcomeInfo(String welcomeInfo) {
this.welcomeInfo = welcomeInfo;
}
public Boolean getCanEditSubmissionMetadata() {
return canEditSubmissionMetadata;
}
public void setCanEditSubmissionMetadata(Boolean canEditSubmissionMetadata) {
this.canEditSubmissionMetadata = canEditSubmissionMetadata;
}
public boolean hasPasswordSet() {
return StringUtils.isNotBlank(getPassword());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,32 @@ public String getDeadSince(Context context, String handle) throws SQLException {
format(timestamptz) : null;
}

@Override
public Handle createHandle(Context context, String handleStr) throws SQLException, AuthorizeException {
// Check authorisation: Only admins may create DC types
if (!authorizeService.isAdmin(context)) {
throw new AuthorizeException(
"Only administrators may modify the handle registry");
}

String handleId;
// Do we want to generate the new handleId or use entered handleStr?
if (StringUtils.isNotBlank(handleStr)) {
// We use handleStr entered by use
handleId = handleStr;
} else {
// We generate new handleId
handleId = createId(context);
}

Handle handle = handleDAO.create(context, new Handle());
// Set handleId
handle.setHandle(handleId);
this.save(context, handle);
log.debug("Created new Handle with handle " + handleId);
return handle;
}

/**
* Strips the part identifier from the handle
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,15 @@ public void update(Context context, Handle handleObject, String newHandle,
* @throws SQLException if database error
*/
public String getDeadSince(Context context, String handle) throws SQLException;

/**
* Create handle without dspace object.
* This method is created for migration purposes.
* @param context context
* @param handle handle of Handle object
* @return created Handle
* @throws SQLException if database error
* @throws AuthorizeException if authorization error
*/
public Handle createHandle(Context context, String handle) throws SQLException, AuthorizeException;
}
Loading