Skip to content
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

www: Allow user details lookup by pubkey #744

Merged
merged 10 commits into from Apr 30, 2019

Conversation

@s-ben
Copy link
Contributor

commented Mar 22, 2019

In order for an external tool to be able to verify things like a
comment score, there needs to be a way to lookup public user details
by pubkey. This commit accomplishes this via the following changes:

  • Makes the /users endpoint public
  • Adds UserGetByPublicKey method to the user database interface
  • Allows non-admins to filter users by username or pubkey (endpoint
    returns only user ID and username for matches)
  • Allows admins to search by username, email, or pubkey (endpoint
    returns user ID, email, and username for matches)
politeiawww/userwww.go Outdated Show resolved Hide resolved
politeiawww/user.go Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user/localdb/localdb.go Outdated Show resolved Hide resolved
politeiawww/user/localdb/localdb.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved

@s-ben s-ben force-pushed the s-ben:pk_lookup branch from 2526f03 to 5227e8b Mar 27, 2019

@s-ben

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

@lukebp have addressed comments. I did get into a nasty git hole there, merging my changes with the latest on master (y'll have been busy). Ended up squashing some commits down and having to force push. Hopefully changes are still clear. The only open comment is on whether you want to perform further cleanup on the rest of a file (removing the \n from other debug functions in localdb.go).

@s-ben s-ben force-pushed the s-ben:pk_lookup branch from 7bc3ad5 to 205ecf4 Apr 3, 2019

politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
politeiawww/user.go Outdated Show resolved Hide resolved
@marcopeereboom

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

@lukebp need you to look at this

politeiawww/api/www/v1/v1.go Outdated Show resolved Hide resolved
politeiawww/api/www/v1/v1.go Outdated Show resolved Hide resolved

s-ben added some commits Mar 15, 2019

www: Allow user details lookup by pubkey
In order for an external tool to be able to verify things like a
comment score, there needs to be a way to lookup public user details
 by pubkey. This commit accomplishes this via the following changes:

- Makes the /users endpoint public
- Adds UserGetByPublicKey method to the user database interface
- Allows non-admins to filter users by username or pubkey (endpoint
returns only user ID and username for matches)
- Allows admins to search by username, email, or pubkey (endpoint
returns user ID, email, and username for matches)

@s-ben s-ben force-pushed the s-ben:pk_lookup branch from 2891be2 to 119d5ba Apr 27, 2019

@marcopeereboom

This comment has been minimized.

Copy link
Member

commented Apr 27, 2019

ugh more routes. We need less routes not more.

I am not ok returning email addresses to non-admins. Which means it maps pubkey to user name. Do we really want to introduce a route for that?

@lukebp

This comment has been minimized.

Copy link
Member

commented Apr 28, 2019

ugh more routes. We need less routes not more.

This doesn't add a new route. It modifies an existing route.

I am not ok returning email addresses to non-admins. Which means it maps pubkey to user name. Do we really want to introduce a route for that?

Email address is not returned to non-admins. Only userID and username. Only admins can perform email lookups.

Reason this PR is needed:
Politeia data cannot be independently verified without a public route that allows for userID lookups by pubkey (ex. comment scores). @RichardRed0x has been building tools that allow you to independently verify the politeia data using the public proposals repo and has run into this issue firsthand.

@marcopeereboom

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

I am confused. https://github.com/decred/politeia/blob/master/politeiawww/api/www/v1/v1.go#L442

Why is that key not enough? and we have (or at least had) a tool to do this. @sndurkin wrote it a long time ago.

@marcopeereboom
Copy link
Member

left a comment

I hate that we need to go through this mess for the score. But fine.

@marcopeereboom marcopeereboom merged commit 1fd0662 into decred:master Apr 30, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.