bhliva commented on a change in pull request #304: [DLAB-1099]: Added a check 
while deleting a group; Delete group recor…
URL: https://github.com/apache/incubator-dlab/pull/304#discussion_r324193160
 
 

 ##########
 File path: 
services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java
 ##########
 @@ -83,6 +88,12 @@ public void removeGroupFromRole(Set<String> groups, 
Set<String> roleIds) {
 
        @Override
        public void removeGroup(String groupId) {
+               if 
(projectDAO.getProjectsWithStatusNotIn(ProjectDTO.Status.DELETED, 
ProjectDTO.Status.DELETING).stream()
+                               .anyMatch(p -> p.getGroups().contains(groupId) 
&& p.getGroups().size() == 1)) {
+                       throw new ResourceConflictException("Group can not be 
removed because it is used in some project");
+               }
+
+               projectDAO.removeGroupInProjects(groupId);
 
 Review comment:
   such method call not needed because admin should firstly remove group from 
project manually

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to