Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

[DLAB-1099]: Added a check while deleting a group; Delete group recor…#304

Merged
EpamBohdanHliva merged 3 commits intoapache:developfrom
ofuks:DLAB-1099
Sep 13, 2019
Merged

[DLAB-1099]: Added a check while deleting a group; Delete group recor…#304
EpamBohdanHliva merged 3 commits intoapache:developfrom
ofuks:DLAB-1099

Conversation

@ofuks
Copy link
Copy Markdown
Contributor

@ofuks ofuks commented Sep 13, 2019

  • Added a check while deleting a group;
  • Delete group record from Project while deleting the group.

@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)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to forbid removing group if it is used in any of project (does not matter if p.getGroups().size() == 1)
Admin should go and remove such group manually from project

throw new ResourceConflictException("Group can not be removed because it is used in some project");
}

projectDAO.removeGroupInProjects(groupId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such method call not needed because admin should firstly remove group from project manually

@EpamBohdanHliva EpamBohdanHliva merged commit e22a5f1 into apache:develop Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants