dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21431
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10147: Sharing controllor, text message in post response
------------------------------------------------------------
revno: 10147
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-03-11 18:29:55 +0100
message:
Sharing controllor, text message in post response
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SharingController.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/api/controller/SharingController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SharingController.java 2013-01-18 15:54:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SharingController.java 2013-03-11 17:29:55 +0000
@@ -127,7 +127,7 @@
JacksonUtils.toJson( response.getOutputStream(), sharing );
}
- @RequestMapping(value = "", method = RequestMethod.POST, consumes = "application/json")
+ @RequestMapping(value = "", method = { RequestMethod.POST, RequestMethod.PUT }, consumes = "application/json")
public void setSharing( @RequestParam String type, @RequestParam String id, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
BaseIdentifiableObject object = (BaseIdentifiableObject) manager.get( SharingUtils.classForType( type ), id );
@@ -145,8 +145,8 @@
Sharing sharing = JacksonUtils.fromJson( request.getInputStream(), Sharing.class );
- // just ignore publicAccess if user is not allowed to make objects public, this should be hidden
- // in the UI.
+ // Ignore publicAccess if user is not allowed to make objects public
+
if ( SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), object ) )
{
object.setPublicAccess( sharing.getObject().getPublicAccess() );
@@ -184,6 +184,8 @@
}
manager.update( object );
+
+ ContextUtils.okResponse( response, "Access control set" );
}
@RequestMapping( value = "/search", produces = { "application/json", "text/*" } )