-
Notifications
You must be signed in to change notification settings - Fork 530
11918 template apis #11969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sekmiller
wants to merge
32
commits into
develop
Choose a base branch
from
11918-template-apis
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+348
−10
Open
11918 template apis #11969
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0eeac97
#11918 prelim check in
sekmiller f74a9cd
#11918 fix perms and test
sekmiller e21f007
#11918 add unit tests for command
sekmiller 8888d00
#11918 fix create test for flush/new template
sekmiller 4775c27
#11918 add get template by id
sekmiller 2d24a5a
Merge branch 'develop' into 11918-template-apis
sekmiller a2714fd
Merge branch 'develop' into 11918-template-apis
sekmiller 8069e6c
Merge branch 'develop' into 11918-template-apis
sekmiller 0b2cc27
Merge branch 'develop' into 11918-template-apis
sekmiller 09d7775
Merge branch 'develop' into 11918-template-apis
sekmiller 7585924
#11918 unused code
sekmiller 09e4a28
#11918 add release notes
sekmiller e1d4f67
Merge branch 'develop' into 11918-template-apis
sekmiller 5a06245
#11918 update release note
sekmiller 9a5454e
Update native-api.rst
sekmiller 0dcc385
Merge branch '11918-template-apis' of https://github.com/IQSS/dataver…
sekmiller a62265d
#11918 code format
sekmiller fc64bdf
Merge branch 'develop' into 11918-template-apis
sekmiller 261d7ae
Merge branch 'develop' into 11918-template-apis
sekmiller 7fce175
#11918 CR fixes
sekmiller 656b0b6
Update native-api.rst
sekmiller 9ea3f16
Merge branch 'develop' into 11918-template-apis
sekmiller 09c7974
Merge branch 'develop' into 11918-template-apis
sekmiller 967cf3c
Merge branch 'develop' into 11918-template-apis
sekmiller acf58a2
Merge branch 'develop' into 11918-template-apis
sekmiller d73c3be
Merge branch 'develop' into 11918-template-apis
sekmiller 2d8054f
Merge branch 'develop' into 11918-template-apis
sekmiller d080fd8
Merge branch 'develop' into 11918-template-apis
sekmiller afa57c3
Merge branch 'develop' into 11918-template-apis
sekmiller 39ba71c
Merge branch 'develop' into 11918-template-apis
sekmiller c2e75a6
Merge branch 'develop' into 11918-template-apis
sekmiller 7b9a106
Update CreateTemplateCommandTest.java
sekmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,17 @@ | ||
| ## New Endpoint: GET `/dataverses/{id}/template` | ||
|
|
||
| A new endpoint has been implemented to manage templates belonging to a given dataverse collection. | ||
|
|
||
| ### Functionality | ||
| - Returns the template of the given {id} in json format. | ||
| - You must have add dataset permission in the collection in order to use this endpoint. | ||
|
|
||
| ## New Endpoint: DELETE `/dataverses/{id}/template` | ||
|
|
||
| A new endpoint has been implemented to manage templates belonging to a given dataverse collection. | ||
|
|
||
| ### Functionality | ||
| - Deletes the template of the given {id}. | ||
| - You must have Edit Dataverse permission in order to use this endpoint. | ||
|
|
||
|
|
This file contains hidden or 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 hidden or 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 hidden or 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
50 changes: 50 additions & 0 deletions
50
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetTemplateCommand.java
This file contains hidden or 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,50 @@ | ||
|
|
||
| package edu.harvard.iq.dataverse.engine.command.impl; | ||
|
|
||
| import edu.harvard.iq.dataverse.Template; | ||
| import edu.harvard.iq.dataverse.authorization.Permission; | ||
| 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.exception.CommandException; | ||
| import java.util.Collections; | ||
| import java.util.HashSet; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * | ||
| * @author stephenkraffmiller | ||
| */ | ||
| public class GetTemplateCommand extends AbstractCommand<Template> { | ||
|
|
||
| private final Template template; | ||
|
|
||
| public GetTemplateCommand (DataverseRequest aRequest, Template template){ | ||
| super(aRequest, template.getDataverse()); | ||
| this.template = template; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| @Override | ||
| public Template execute(CommandContext ctxt) throws CommandException { | ||
| return template; | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, Set<Permission>> getRequiredPermissions() { | ||
| //at least need add dataset if not published also - view unpublished | ||
| Set<Permission> requiredPermissions = new HashSet<>(); | ||
|
|
||
| requiredPermissions.add(Permission.AddDataset); | ||
| if (!template.getDataverse().isReleased()) { | ||
| requiredPermissions.add(Permission.ViewUnpublishedDataverse); | ||
| } | ||
|
|
||
| return Collections.singletonMap("", requiredPermissions); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.