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

AddUser and password #509

Closed
franiis opened this issue Feb 9, 2016 · 3 comments
Closed

AddUser and password #509

franiis opened this issue Feb 9, 2016 · 3 comments

Comments

@franiis
Copy link

franiis commented Feb 9, 2016

Hi,

I think that now it's impossible to create user with addUser API's Method.
If you look into DataServiceImpl code, there is if which requires login and password to create user (from User.java model).
But User.java's password has JsonIgnore annotation.

So when I send request to AddUser with password, model doesn't use that field and throws exception on mentioned "if". It can be solved by deleting this annotation (methods works then), but IMO it's bad solution (unsafe).

Is there different method to use this method and I'm doing something incorrect?

Greetings
Piotr - franiis

@vitalidze
Copy link
Owner

To add user you can call 'register' method. As for the solution for addUser method I believe the @JsonIgnore@ annotation can be put on thegetPassword()method only so the user entity won't be transferred with password. But then it will require to make some changes inupdateUsermethod so it will ignore users withnull` passwords.

@franiis
Copy link
Author

franiis commented Feb 9, 2016

Thank you for answer.
I can do (more or less) the same thing with register (I don't know Traccar good enough to determine for example value managedBy_id column) and adding @JsonIgnore to getPassword (without further changes) doesn't solve it (I tried it).
I just tried to report slightly broken API method :)

vitalidze added a commit that referenced this issue Feb 9, 2016
@vitalidze vitalidze added the bug label Feb 9, 2016
@vitalidze
Copy link
Owner

Fixed, written news, updated latest and demo versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants