Skip to content

Commit

Permalink
user fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lbownik committed Jan 8, 2025
1 parent b15e199 commit 94993b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package edu.harvard.iq.dataverse.persistence.user;

import edu.harvard.iq.dataverse.persistence.DvObject;
import edu.harvard.iq.dataverse.persistence.JpaEntity;
import edu.harvard.iq.dataverse.persistence.config.LocaleConverter;
import edu.harvard.iq.dataverse.persistence.config.ValidateEmail;
Expand Down Expand Up @@ -195,16 +194,6 @@ public List<AcceptedConsent> getAcceptedConsents() {
public boolean isSuperuser() {
return superuser;
}

@Override
public boolean isAnonymized() {
return false;
}

@Override
public boolean isAllowedToView(final DvObject object) {
return object.getReleaseUser().equals(this);
}

public AuthenticatedUserLookup getAuthenticatedUserLookup() {
return authenticatedUserLookup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ public boolean isAuthenticated() {
public boolean isSuperuser() {
return false;
}

@Override
public boolean isAnonymized() {
return false;
}

@Override
public boolean equals(Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public boolean isSuperuser() {
public String getIdentifier() {
return PREFIX + this.datasetId;
}

@Override
public boolean isAnonymized() {
return this.anonymized;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ public interface User extends RoleAssignee, Serializable {

boolean isAuthenticated();

boolean isSuperuser();

boolean isAnonymized();
boolean isSuperuser();
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ public boolean isViewedFromPrivateUrl(final DvObject dataset) {
}

public boolean isViewedFromAnonymizedPrivateUrl(final DvObject dataset) {
return getUser().isAnonymized() && isViewedFromPrivateUrl(dataset);
if(getUser() instanceof PrivateUrlUser) {
final PrivateUrlUser user = (PrivateUrlUser)getUser();
return user.isAnonymized() && user.isAllowedToView(dataset);
} else {
return false;
}
}


Expand Down

0 comments on commit 94993b5

Please sign in to comment.