dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34808
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17856: User search, fixed bug related to disjoint roles
------------------------------------------------------------
revno: 17856
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-01-01 16:54:26 +0100
message:
User search, fixed bug related to disjoint roles
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserServiceTest.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-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2014-12-29 12:52:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java 2015-01-01 15:54:26 +0000
@@ -229,8 +229,8 @@
private void handleUserQueryParams( UserQueryParams params )
{
- boolean disjointRoles = (Boolean) systemSettingManager.getSystemSetting( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, false );
- params.setDisjointRoles( disjointRoles );
+ boolean canGrantOwnRoles = (Boolean) systemSettingManager.getSystemSetting( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, false );
+ params.setDisjointRoles( !canGrantOwnRoles );
if ( params.getUser() == null )
{
@@ -241,6 +241,7 @@
{
params.setCanManage( false );
params.setAuthSubset( false );
+ params.setDisjointRoles( false );
}
if ( params.getInactiveMonths() != null )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2014-12-30 14:29:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2015-01-01 15:54:26 +0000
@@ -87,12 +87,12 @@
hql += hlp.whereAnd() + " u.phoneNumber = :phoneNumber ";
}
- if ( params.isCanManage() )
+ if ( params.isCanManage() && params.getUser() != null )
{
hql += hlp.whereAnd() + " g.id in (:ids) ";
}
- if ( params.isAuthSubset() )
+ if ( params.isAuthSubset() && params.getUser() != null )
{
hql += hlp.whereAnd() + " not exists (" +
"select uc2 from UserCredentials uc2 " +
@@ -102,7 +102,7 @@
"and a not in (:auths) ) ";
}
- if ( params.isDisjointRoles() )
+ if ( params.isDisjointRoles() && params.getUser() != null )
{
hql += hlp.whereAnd() + " not exists (" +
"select uc3 from UserCredentials uc3 " +
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserServiceTest.java 2014-12-30 14:29:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserServiceTest.java 2015-01-01 15:54:26 +0000
@@ -421,7 +421,7 @@
@Test
public void testGetManagedGroupsLessAuthoritiesDisjointRoles()
{
- systemSettingManager.saveSystemSetting( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, true );
+ systemSettingManager.saveSystemSetting( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, false );
User userA = createUser( 'A' );
User userB = createUser( 'B' );