Skip to content

Commit

Permalink
remove oauth2tokendata with a cascade #2419 #4475
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Mar 3, 2021
1 parent 6e61841 commit 8afbf5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ public void deleteAuthenticatedUser(Object pk) {
em.remove(confirmEmailData);
}
userNotificationService.findByUser(user.getId()).forEach(userNotificationService::delete);
em.createNativeQuery("delete from OAuth2TokenData where user_id =" + user.getId()).executeUpdate();

AuthenticationProvider prv = lookupProvider(user);
if ( prv != null && prv.isUserDeletionAllowed() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.harvard.iq.dataverse.authorization.AccessRequest;
import edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo;
import edu.harvard.iq.dataverse.authorization.AuthenticatedUserLookup;
import edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2TokenData;
import edu.harvard.iq.dataverse.userdata.UserUtil;
import edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.OrcidOAuth2AP;
import edu.harvard.iq.dataverse.util.BundleUtil;
Expand Down Expand Up @@ -166,7 +167,10 @@ public List<DatasetLock> getDatasetLocks() {
public void setDatasetLocks(List<DatasetLock> datasetLocks) {
this.datasetLocks = datasetLocks;
}


@OneToMany(mappedBy = "user", cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
private List<OAuth2TokenData> oAuth2TokenDatas;

@Override
public AuthenticatedUserDisplayInfo getDisplayInfo() {
return new AuthenticatedUserDisplayInfo(firstName, lastName, email, affiliation, position);
Expand Down

0 comments on commit 8afbf5e

Please sign in to comment.