Skip to content

Comments

6266 api endpoints for token management#6292

Merged
kcondon merged 10 commits intodevelopfrom
6266-api-endpoints-for-token-management
Oct 21, 2019
Merged

6266 api endpoints for token management#6292
kcondon merged 10 commits intodevelopfrom
6266-api-endpoints-for-token-management

Conversation

@sekmiller
Copy link
Contributor

New Contributors

Welcome! New contributors should at least glance at CONTRIBUTING.md, especially the section on pull requests where we encourage you to reach out to other developers before you start coding. Also, please note that we measure code coverage and prefer you write unit tests. Pull requests can still be reviewed without tests or completion of the checklist outlined below. Note that we use the "closes" syntax below to trigger Github's automation to close the corresponding issue once the pull request is merged.

Thanks for your contribution to Dataverse!

Related Issues

Pull Request Checklist

  • Unit [tests][x]NA
  • Integration [tests][x]: completed
  • Deployment requirements, [x]None
  • Documentation completed
  • Merged latest from "develop" branch and resolved conflicts

@coveralls
Copy link

coveralls commented Oct 18, 2019

Coverage Status

Coverage decreased (-0.005%) to 19.456% when pulling b44c4c1 on 6266-api-endpoints-for-token-management into 4539927 on develop.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks fantastic but I'm leaving a few thoughts as comments.

au = (AuthenticatedUser) u;
} catch (ClassCastException e){
//if we have a non-authentivated user we stop here.
return notFound("Token for " + u.getIdentifier() + " not found.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't the message here be something like "The guest user cannot have an API token"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the error messages to say that tokens for guests/private url not eligible for deletion or recreation.

au = (AuthenticatedUser) u;
} catch (ClassCastException e){
//if we have a non-authentivated user we stop here.
return notFound("Token for " + u.getIdentifier() + " not found.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, this message could say that the Guest user can't have an API token. Or PrivateURL user, I guess. I'm just thinking that it might be nice to have a slightly different message than the one below.

return notFound("Token for " + u.getIdentifier() + " not found.");
}

/* this null check is probably overkill*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree this is probably overkill. 😄 The same null check appears in the DELETE code above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took out the redundant null checking and fixed a copy/paste of the comment typo

@poikilotherm
Copy link
Contributor

poikilotherm commented Oct 18, 2019

I just added a question to #6266 wondering if an extension of this addition might help with #6286. I would be very glad if you guys would consider talking about it 😉

djbrooke and others added 2 commits October 18, 2019 12:07
@kcondon kcondon self-assigned this Oct 21, 2019
@kcondon kcondon merged commit 96efe2f into develop Oct 21, 2019
@kcondon kcondon deleted the 6266-api-endpoints-for-token-management branch October 21, 2019 19:21
@djbrooke djbrooke added this to the 4.18 milestone Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add API endpoints to help manage API tokens

6 participants