This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 444864 - [server] Orion User API needs cleanup
Summary: [server] Orion User API needs cleanup
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Server (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 452165
Blocks:
  Show dependency tree
 
Reported: 2014-09-23 12:14 EDT by Anthony Hunter CLA
Modified: 2014-11-24 23:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Hunter CLA 2014-09-23 12:14:31 EDT
While working on Bug 444501 and Bug 444779, I have found that we are mixing the case of the parameters in the Orion User API. This is a problem since JSON is case sensitive and we cannot simply interchange things like Name and name.

For whatever reason, the UserHandlerV1 is using both ProtocolConstants and UserConstants to create the JSON resulting in some case mismatch in the keys.

The Orion User API documentation is mostly empty at https://wiki.eclipse.org/Orion/Server_API/User_API so we can just fix it.
Comment 1 Anthony Hunter CLA 2014-10-28 14:59:09 EDT
(In reply to Anthony Hunter from comment #0)
> While working on Bug 444501 and Bug 444779, I have found that we are mixing
> the case of the parameters in the Orion User API. This is a problem since
> JSON is case sensitive and we cannot simply interchange things like Name and
> name.
> 
> For whatever reason, the UserHandlerV1 is using both ProtocolConstants and
> UserConstants to create the JSON resulting in some case mismatch in the keys.
> 
> The Orion User API documentation is mostly empty at
> https://wiki.eclipse.org/Orion/Server_API/User_API so we can just fix it.

According to our coding guidelines at https://wiki.eclipse.org/Orion/Coding_conventions#JSON , Object member names use title case ("Name", "ChildrenLocation", etc). 

"UserName" will replace login, name, userid, uid, etc.

Other properties would be "Email", "FullName", "OpenId", etc.

In addition, I will create a UserConstants in the Orion core bundle that will be used by the server code base.
Comment 2 Anthony Hunter CLA 2014-10-30 15:55:26 EDT
I have delivered bug 444501 as phase one with the original mismatched API parameters.

I will deliver this bug as a phase two since it will require server migration.
Comment 3 Anthony Hunter CLA 2014-11-05 10:20:51 EST
(In reply to Anthony Hunter from comment #2)
> I have delivered bug 444501 as phase one with the original mismatched API
> parameters.
> 
> I will deliver this bug as a phase two since it will require server
> migration.

This should be handled by the latest migration in Orion 8.0.

The separate "profileProperties" needs to be removed and it contents moved to be standard properties.

"blocked" should be "Blocked"
"diskusage" should be "DiskUsage"
"diskusagetimestamp" should be "DiskUsageTimestamp"
"email" should be "Email"
"email_confirmation" should be "EmailConfirmation"
"lastlogintimestamp" should be "LastLoginTimestamp"
"oauth" should be "OAuth"
"openid" should be "OpenId"
"password" should be "Password"
"passwordResetId" should be "PasswordResetId"
Comment 4 Anthony Hunter CLA 2014-11-10 13:00:39 EST
(In reply to Anthony Hunter from comment #3)
> This should be handled by the latest migration in Orion 8.0.
> 
> The separate "profileProperties" needs to be removed and it contents moved
> to be standard properties.
> 
> "blocked" should be "Blocked"
> "diskusage" should be "DiskUsage"
> "diskusagetimestamp" should be "DiskUsageTimestamp"
> "email" should be "Email"
> "email_confirmation" should be "EmailConfirmation"
> "lastlogintimestamp" should be "LastLoginTimestamp"
> "oauth" should be "OAuth"
> "openid" should be "OpenId"
> "password" should be "Password"
> "passwordResetId" should be "PasswordResetId"

The server side changes have been delivered with commits:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=56d117cbcd0a3ee4cf517f64fccd180a64c7d29d
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=407439ab46581a63473c0e6ca28d437d08411c85

The Orion server metadata storage is now at Version 8.0
Comment 5 Anthony Hunter CLA 2014-11-17 23:15:53 EST
(In reply to Anthony Hunter from comment #3)
> The separate "profileProperties" needs to be removed and it contents moved
> to be standard properties.
> 
> "blocked" should be "Blocked"
> "diskusage" should be "DiskUsage"
> "diskusagetimestamp" should be "DiskUsageTimestamp"
> "email" should be "Email"
> "email_confirmation" should be "EmailConfirmation"
> "lastlogintimestamp" should be "LastLoginTimestamp"
> "oauth" should be "OAuth"
> "openid" should be "OpenId"
> "password" should be "Password"
> "passwordResetId" should be "PasswordResetId"

I removed all the TODOs from the server with commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=1efdb1cf9eae13f4bdfb4722d825ce2432f892b4

The client now uses the newer server API with commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c0ddeb407f3871c8673d584ca8d92bd6b7fed32e
Comment 6 Anthony Hunter CLA 2014-11-24 23:56:33 EST
I have pushed the last set of changes that completes the clean up of the users API and login API.

I have updated our server API at:
http://wiki.eclipse.org/Orion/Server_API/Login_API
http://wiki.eclipse.org/Orion/Server_API/User_API

Let me know if there are any comments.

Significant changes:

Object member names in JSON use title case ("UserName", "HasPassword", etc). ( See https://wiki.eclipse.org/Orion/Coding_conventions#JSON ).

A user account has a UserName and FullName, old terms login, uid and name have been removed from the JSON.

It is now /login/form?username=${username}&password=${password} to login to the server, old value was login= ( and I changed it back from Password= from last week).

As much as possible we use JSON within the APIs rather than query parameters

A reminder that you need to rebase your org.eclipse.orion.client repo for self hosting to work again.

These were commits:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=6c1bc5ba730d526b43eb7e9f037eced2020f6671
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=97cb677133dd2ea4c7cdb4c57a8a3aa6245416cc