dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31181
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15865: Added me/authorization method to web api
------------------------------------------------------------
revno: 15865
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-26 17:29:06 +0200
message:
Added me/authorization method to web api
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java 2014-06-26 15:29:06 +0000
@@ -258,6 +258,15 @@
userService.updateUser( currentUser );
}
+ @RequestMapping( value = "/authorization", produces = { "application/json", "text/*" } )
+ public void getAuthorization( HttpServletResponse response ) throws IOException
+ {
+ User currentUser = currentUserService.getCurrentUser();
+
+ response.setContentType( MediaType.APPLICATION_JSON_VALUE );
+ JacksonUtils.toJson( response.getOutputStream(), currentUser.getUserCredentials().getAllAuthorities() );
+ }
+
@RequestMapping( value = "/authorization/{auth}", produces = { "application/json", "text/*" } )
public void hasAuthorization( @PathVariable String auth, HttpServletResponse response ) throws IOException
{