-
Notifications
You must be signed in to change notification settings - Fork 133
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
User XML configuration persistence #380
Conversation
Login and Logout Servlets do not throw useless exceptions PUT REST service replaced with proper POST method to add users add users are now persisted in the xml file
…ving username as PathParam)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those classes where a refactoring like the one in #284 would have been beneficial. In the mean time, I am not opposed to adding this fix (I do consider this to be a bug).
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersStruct.java
Outdated
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersStruct.java
Outdated
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/accounts/UserServlet.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | ||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public web API change. Is it really important that we change the method? Couldn't PUT
be adapted to also enable updating existing users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the doPost assumes the creation of a new element; since doPut assumes the edition/replacement of a new element; since, according to literature, the previous format was not in compliance. I believe this is the best way to do it.
https://spring.io/understanding/REST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, we can think of this the other way around: if this implementation PUT
does not support updating a user's properties, that can be improved. As much as we'd like to have a "pure" RESTful interface, we do not mandate such a design in Dicoogle. This part of the API was designed like this, and changing it is something we should not be accustomed to, since it has to be changed in client-sided code. As far as this one's concerned, the "resource" is a service.
dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/accounts/UserServlet.java
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersXML.java
Outdated
Show resolved
Hide resolved
updated return statement getDefaults() implemented hashing in default user to be in line with the other methods bugfix when users.xml wasn't created, the dicoogle dicoogle didn't work
removed unused import
replaced regex by split
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few more issues.
dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/accounts/UserServlet.java
Outdated
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/accounts/UserServlet.java
Show resolved
Hide resolved
improved filewriting on UserFileHandle
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UserFileHandle.java
Outdated
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersXML.java
Outdated
Show resolved
Hide resolved
…ed in the UsersStruct, voiding the deletion of admin users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersXML.java
Outdated
Show resolved
Hide resolved
dicoogle/src/main/java/pt/ua/dicoogle/server/users/UsersXML.java
Outdated
Show resolved
Hide resolved
Agreed! We can modify it for POST. |
Improvements in the User servlets:
Small improvement: .gitnore now contains MacOS files and folders