=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserRolesAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserRolesAction.java 2011-06-18 17:33:31 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetUserRolesAction.java 2011-06-19 08:32:02 +0000 @@ -32,6 +32,9 @@ import java.util.List; import org.hisp.dhis.paging.ActionPagingSupport; +import org.hisp.dhis.system.filter.UserAuthorityGroupSubsetFilter; +import org.hisp.dhis.system.util.FilterUtils; +import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.user.UserAuthorityGroup; import org.hisp.dhis.user.UserService; import org.hisp.dhis.user.comparator.UserRoleComparator; @@ -53,6 +56,13 @@ this.userService = userService; } + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + // ------------------------------------------------------------------------- // Input & Output // ------------------------------------------------------------------------- @@ -73,6 +83,8 @@ { userRoles = new ArrayList( userService.getAllUserAuthorityGroups() ); + FilterUtils.filter( userRoles, new UserAuthorityGroupSubsetFilter( currentUserService.getCurrentUser() ) ); + Collections.sort( userRoles, new UserRoleComparator() ); if ( usePaging ) === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-06-18 17:19:28 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-06-19 08:32:02 +0000 @@ -327,6 +327,7 @@ +