-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3498 from IQSS/3133-missing-perms
fixed issue with missing perms; added command, added DataverseEntity …
- Loading branch information
Showing
7 changed files
with
115 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/edu/harvard/iq/dataverse/DataverseEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package edu.harvard.iq.dataverse; | ||
|
||
|
||
/** | ||
* This is a non persistent superclass to be used by entities in Dataverse | ||
* for any shared non persistent properties; for example "mergeable" which should | ||
* be set to false, when an entity is manually loaded through native queries | ||
*/ | ||
public abstract class DataverseEntity { | ||
|
||
private boolean mergeable = true; | ||
|
||
public boolean isMergeable() { | ||
return mergeable; | ||
} | ||
|
||
public void setMergeable(boolean mergeable) { | ||
this.mergeable = mergeable; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RequestAccessCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
||
import edu.harvard.iq.dataverse.DataFile; | ||
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; | ||
import edu.harvard.iq.dataverse.engine.command.AbstractCommand; | ||
import edu.harvard.iq.dataverse.engine.command.CommandContext; | ||
import edu.harvard.iq.dataverse.engine.command.DataverseRequest; | ||
import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; | ||
import edu.harvard.iq.dataverse.engine.command.exception.CommandException; | ||
|
||
/** | ||
* | ||
* @author gdurand | ||
*/ | ||
@RequiredPermissions({}) | ||
public class RequestAccessCommand extends AbstractCommand<DataFile> { | ||
|
||
private final DataFile file; | ||
private final AuthenticatedUser requester; | ||
|
||
|
||
public RequestAccessCommand(DataverseRequest dvRequest, DataFile file) { | ||
// for data file check permission on owning dataset | ||
super(dvRequest, file); | ||
this.file = file; | ||
this.requester = (AuthenticatedUser) dvRequest.getUser(); | ||
} | ||
|
||
@Override | ||
public DataFile execute(CommandContext ctxt) throws CommandException { | ||
file.getFileAccessRequesters().add(requester); | ||
return ctxt.files().save(file); | ||
} | ||
|
||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters