dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37300
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19093: User group deletion, removing a user group from managed groups
------------------------------------------------------------
revno: 19093
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-05-06 09:46:20 +0200
message:
User group deletion, removing a user group from managed groups
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
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-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserGroupDeletionHandler.java 2015-05-06 07:46:20 +0000
@@ -30,6 +30,7 @@
import java.util.Set;
+import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.system.deletion.DeletionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -44,12 +45,8 @@
// Dependencies
// -------------------------------------------------------------------------
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
+ @Autowired
+ private IdentifiableObjectManager idObjectManager;
@Autowired
private JdbcTemplate jdbcTemplate;
@@ -72,7 +69,7 @@
for ( UserGroup group : userGroups )
{
group.getMembers().remove( user );
- userGroupService.updateUserGroup( group );
+ idObjectManager.updateNoAcl( group );
}
}
@@ -83,4 +80,16 @@
return count == 0 ? null : "";
}
+
+ @Override
+ public void deleteUserGroup( UserGroup userGroup )
+ {
+ Set<UserGroup> userGroups = userGroup.getManagedByGroups();
+
+ for ( UserGroup group : userGroups )
+ {
+ group.getManagedGroups().remove( userGroup );
+ idObjectManager.updateNoAcl( group );
+ }
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-05-03 14:12:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-05-06 07:46:20 +0000
@@ -1121,9 +1121,7 @@
<bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler" />
- <bean id="org.hisp.dhis.user.UserGroupDeletionHandler" class="org.hisp.dhis.user.UserGroupDeletionHandler">
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
+ <bean id="org.hisp.dhis.user.UserGroupDeletionHandler" class="org.hisp.dhis.user.UserGroupDeletionHandler" />
<bean id="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler" class="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler">
<property name="userService" ref="org.hisp.dhis.user.UserService" />
=== 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 2015-03-18 18:51:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-05-06 07:46:20 +0000
@@ -28,8 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.common.IdentifiableObjectUtils;
@@ -45,7 +53,6 @@
import org.hisp.dhis.schema.descriptors.UserSchemaDescriptor;
import org.hisp.dhis.security.RestoreOptions;
import org.hisp.dhis.security.SecurityService;
-import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.util.ValidationUtils;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
@@ -67,14 +74,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -103,9 +104,6 @@
private SecurityService securityService;
@Autowired
- private SystemSettingManager systemSettingManager;
-
- @Autowired
private OrganisationUnitService organisationUnitService;
// -------------------------------------------------------------------------