Commit d99e0bfc authored by michael.simon's avatar michael.simon
Browse files

Additional null checks

parent 0992b8b9
......@@ -108,6 +108,7 @@ public class LdapUidNumberGroupHook implements GroupServiceHook {
logger.warn("Group with GID {} not available in LDAP. Creating one with GID as name", gid);
group = dao.createNew();
group.setUsers(new HashSet<UserGroupEntity>());
group.setParents(new HashSet<GroupEntity>());
group.setGidNumber(gid);
group.setName("noname_" + gid);
group.setPrefix("ka");
......@@ -125,6 +126,7 @@ public class LdapUidNumberGroupHook implements GroupServiceHook {
logger.info("Group with GID {} not found, creating (Name: {})", gid, groupNameFromLdap);
group = dao.createNew();
group.setUsers(new HashSet<UserGroupEntity>());
group.setParents(new HashSet<GroupEntity>());
group.setGidNumber(gid);
group.setName(groupNameFromLdap);
group.setPrefix("ka");
......
......@@ -28,7 +28,6 @@ import edu.kit.scc.webreg.dao.BaseDao;
import edu.kit.scc.webreg.dao.GroupDao;
import edu.kit.scc.webreg.dao.HomeOrgGroupDao;
import edu.kit.scc.webreg.dao.ServiceGroupFlagDao;
import edu.kit.scc.webreg.dao.UserDao;
import edu.kit.scc.webreg.entity.AuditStatus;
import edu.kit.scc.webreg.entity.EventType;
import edu.kit.scc.webreg.entity.GroupEntity;
......@@ -87,9 +86,11 @@ public class HomeOrgGroupServiceImpl extends BaseServiceImpl<HomeOrgGroupEntity,
HashSet<GroupEntity> allChangedGroups = new HashSet<GroupEntity>(changedGroups.size());
for (GroupEntity group : changedGroups) {
allChangedGroups.add(group);
for (GroupEntity parent : group.getParents()) {
logger.debug("Adding parent group to changed groups: {}", parent.getName());
allChangedGroups.add(parent);
if (group.getParents() != null) {
for (GroupEntity parent : group.getParents()) {
logger.debug("Adding parent group to changed groups: {}", parent.getName());
allChangedGroups.add(parent);
}
}
}
......@@ -286,6 +287,7 @@ public class HomeOrgGroupServiceImpl extends BaseServiceImpl<HomeOrgGroupEntity,
groupEntity = dao.createNew();
groupEntity.setUsers(new HashSet<UserGroupEntity>());
groupEntity.setParents(new HashSet<GroupEntity>());
groupEntity.setName(group);
auditor.logAction(groupEntity.getName(), "SET FIELD", "name", groupEntity.getName(), AuditStatus.SUCCESS);
groupEntity.setPrefix(homeId);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment