← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17763: Removed redundant check for superuser

 

------------------------------------------------------------
revno: 17763
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-12-21 21:26:25 +0100
message:
  Removed redundant check for superuser
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.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/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-12-21 18:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-12-21 20:26:25 +0000
@@ -404,8 +404,7 @@
 
         if ( currentUser != null && user.getGroups() != null )
         {
-            boolean authorizedToAdd = currentUserService.currentUserIsSuper() ||
-                    currentUser.getUserCredentials().isAuthorized( UserGroup.AUTH_USER_ADD );
+            boolean authorizedToAdd = currentUser.getUserCredentials().isAuthorized( UserGroup.AUTH_USER_ADD );
 
             for ( UserGroup ug : user.getGroups() )
             {
@@ -413,7 +412,7 @@
 
                 if ( group == null )
                 {
-                    throw new CreateAccessDeniedException( "Can't add/update user: Can't find user group with UID = " + ug.getUid() );
+                    throw new CreateAccessDeniedException( "Can't add/update user, can't find user group: " + ug.getUid() );
                 }
 
                 if ( !authorizedToAdd && CollectionUtils.containsAny( group.getManagedByGroups(), currentUser.getGroups() ) )
@@ -424,7 +423,7 @@
 
             if ( !authorizedToAdd )
             {
-                throw new CreateAccessDeniedException( "Can't add user: User must belong to a group that you manage." );
+                throw new CreateAccessDeniedException( "Can't add user, user must belong to a group that you manage." );
             }
         }
     }