Changeset 4351
- Timestamp:
- 01/27/14 15:31:44 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/UserResource.java
r4301 r4351 219 219 } 220 220 } 221 222 @PUT 223 @Produces(MediaType.TEXT_PLAIN) 224 @Path("{externalId}/account/{accountType}") 225 public String updateUserAccount(@PathParam("externalId") String externalId, @PathParam("accountType") String accountType) throws IOException { 226 String remoteUser = httpServletRequest.getRemoteUser(); 227 Number remoteUserID = dbIntegrityService.getUserInternalIDFromRemoteID(remoteUser); 228 if (remoteUserID != null) { 229 if (dbIntegrityService.getTypeOfUserAccount(remoteUserID).equals(admin)) { 230 dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString()); 231 final boolean updated = dbIntegrityService.updateAccount(UUID.fromString(externalId), accountType); 232 if (updated) { 233 return "The account was updated to "+dbIntegrityService.getTypeOfUserAccount(dbIntegrityService.getUserInternalIdentifier(UUID.fromString(externalId))); 234 } else { 235 httpServletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The account was not updated."); 236 return "The account was not updated."; 237 } 238 } else { 239 httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The logged-in user does not have admin rights to update an account type in the database"); 240 return null; 241 } 242 } else { 243 httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "The logged-in user is not found in the database"); 244 return null; 245 } 246 } 221 247 222 248 @DELETE … … 276 302 return httpServletRequest.getRemoteUser().equals(dbIntegrityService.getUserRemoteID(userID)); 277 303 } 304 305 278 306 }
Note: See TracChangeset
for help on using the changeset viewer.