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

Allows createUser to create a user without passing an id. #149

Merged
merged 1 commit into from
Feb 3, 2016

Conversation

benoitvidis
Copy link
Contributor

Forces updateUser to actually use the update action

Forces updateUser to actually use the update action
@codecov-io
Copy link

Current coverage is 91.94%

Merging #149 into master will not affect coverage as of 93db5f3

@@            master    #149   diff @@
======================================
  Files           77      77       
  Stmts         3972    3973     +1
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit           3652    3653     +1
  Partial          0       0       
  Missed         320     320       

Review entire Coverage Diff as of 93db5f3


Uncovered Suggestions

  1. +0.25% via ...b/services/rabbit.js#295...304
  2. +0.23% via lib/api/enable.js#14...22
  3. +0.20% via lib/api/perf.js#80...87
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@ballinette
Copy link

+1

@@ -329,6 +330,9 @@ module.exports = function SecurityController (kuzzle) {
if (newRequestObject.data._id !== undefined) {
pojoUser._id = newRequestObject.data._id;
}
else {
pojoUser._id = uuid.v4();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we put 'anonymous' instead, so that the user repository returns an anonymous user?
That would be more efficient than reading the cache, and then the database, to search for a purposely unknown user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was actually the situation this PR tries to solve.

The createUser action should create a real user when no id is provided and not update the anonymous user.
Note that the user is not fetched here. We only hydrate a new user with the pojoUser and persist it forcing a write:create call.

If the user id already exists in elasticsearch, the write:create action will trigger an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, ok. I clearly misunderstood the purpose of this PR, sorry :-)

@scottinet
Copy link
Contributor

+1

1 similar comment
@xbill82
Copy link
Contributor

xbill82 commented Feb 3, 2016

👍

ballinette pushed a commit that referenced this pull request Feb 3, 2016
Allows createUser to create a user without passing an id.
@ballinette ballinette merged commit f3ea6b6 into master Feb 3, 2016
@ballinette ballinette deleted the security-users-crudl-bugfixes branch February 3, 2016 10:10
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.

5 participants