@Override public String addGroup(Group group) throws GroupExistsException, DomainNotSupportedException { if (group.getGroupName().getDomain() == null) { group.getGroupName().setDomain(UserCatalogConstants.DEFAULT_DOMAIN_NAME); } else { checkIfDomainSupported(group.getGroupName().getDomain()); } return groupDao.save(UserCatalogModelHibernateModelTransformer.transformGroupToHibernateGroup(group)); }
xGroup.addContent(xId); Element xDomain = new Element("domain", ns); xDomain.setText(group.getGroupName().getDomain()); xGroup.addContent(xDomain); Element xName = new Element("name", ns); xName.setText(group.getGroupName().getName()); xGroup.addContent(xName);
@Override public void updateGroup(Group group) throws GroupNotFoundException { HibernateGroup hibernateGroup = groupDao.load(group.getGroupName()); if (hibernateGroup == null) { throw new GroupNotFoundException(group.getGroupName()); } hibernateGroup.fillGroupRelatedFields(group); groupDao.update(hibernateGroup); for (HibernateUser hibernateUser : hibernateGroup.getEffectiveUsers()) { hibernateUser.setEffectiveRoles(getEffectiveRoles(hibernateUser)); try { userDao.update(hibernateUser); } catch (UserNotFoundException e) { logger.error("Previously loaded user could not be updated. " + "Very bad situation. Debug thoroughly.", e); } } }
if (cascade) { for (Group childGroup : childGroups) { deleteGroup(childGroup.getGroupName(), true); unassignGroup(childGroup.getGroupName(), groupName); } catch (CrossDomainOperationException e) { logger.error("Previously loaded group could not be unassigned. " .load(group.getParentId())); try { unassignGroup(group.getGroupName(), parentGroup.getGroupName()); } catch (Exception e) { logger.error("Previously loaded group could not be unassigned. "
/** * Fill group related fields. * * @param group the group */ public void fillGroupRelatedFields(Group group) { setName(group.getGroupName().getName()); if (CollectionUtils.isNotEmpty(getEffectiveRoles())) { getEffectiveRoles().removeAll(getRoles()); if (CollectionUtils.isNotEmpty(group.getRoles())) { getEffectiveRoles().addAll(group.getRoles()); } } else { if (CollectionUtils.isNotEmpty(group.getRoles())) { setEffectiveRoles(new HashSet<String>(group.getRoles())); } } if (CollectionUtils.isNotEmpty(group.getRoles())) { setRoles(new HashSet<String>(group.getRoles())); } else { setRoles(new HashSet<String>(0)); } if (MapUtils.isNotEmpty(group.getAttributes())) { setAttributes(new HashMap<String, String>(group.getAttributes())); } else { setAttributes(new HashMap<String, String>()); } }
for (Group group : groups.getResults()) { userCatalogFacade.deleteGroup(group.getGroupName(), false);
/** * Transform group to hibernate group. * * @param group the group * @return the hibernate group */ public static HibernateGroup transformGroupToHibernateGroup(Group group) { if (group == null) { return null; } HibernateGroup hibernateGroup = new HibernateGroup(); hibernateGroup.setId(group.getId()); hibernateGroup.setDomain(group.getGroupName().getDomain()); hibernateGroup.fillGroupRelatedFields(group); return hibernateGroup; }
@Override public GenericResponse updateGroup(GroupAwareRequest request) { Map<String, Serializable> auxParams = new HashMap<String, Serializable>(); if (request.getGroup()!=null && request.getGroup().getGroupName()!=null && request.getGroup().getGroupName().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroup().getGroupName().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroup().getGroupName().getDomain());
@Override public IdentifiedResponse addGroup(GroupAwareRequest request) { Map<String, Serializable> auxParams = new HashMap<String, Serializable>(); if (request.getGroup()!=null && request.getGroup().getGroupName()!=null && request.getGroup().getGroupName().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroup().getGroupName().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroup().getGroupName().getDomain()); } else { if (disallowNullDomain) {
assignGroup(group.getGroupName(), parentGroup.getGroupName()); } catch (Exception e) { throw new ImportException(e.getMessage(), e);