/** * Fetch child groups. * * @param groupName the group name * @return the sets the */ public Set<HibernateGroup> fetchChildGroups(GroupName groupName) { @SuppressWarnings("unchecked") List<HibernateGroup> childGroups = (List<HibernateGroup>) getHibernateTemplate().find( "from HibernateGroup as hg where hg.parentGroup.name = ? and hg.parentGroup.domain = ?", new Object[] { groupName.getName(), groupName.getDomain() }); return new HashSet<HibernateGroup>(childGroups); }
public Object doInHibernate(Session session) throws HibernateException, SQLException { return session.createQuery("from HibernateGroup as group" + " where domain= :domain and name = :name") .setString("domain", groupName.getDomain()).setString("name", groupName.getName()) .uniqueResult(); } };
@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);
@Override public void assignUser(String userId, GroupName group) throws UserNotFoundException, GroupNotFoundException, CrossDomainOperationException { HibernateUser hibernateUser = userDao.load(userId, null); if (hibernateUser == null) { throw new UserNotFoundException(userId); } else { if (!hibernateUser.getDomain().equals(group.getDomain())) { throw new CrossDomainOperationException(); } else { HibernateGroup hibernateGroup = groupDao.load(group); if (hibernateGroup == null) { throw new GroupNotFoundException(group); } else { hibernateUser.getDirectGroups().add(hibernateGroup); hibernateUser.getEffectiveGroups().add(hibernateGroup); hibernateUser.getEffectiveGroups().addAll(groupDao.getEffectiveGroups(group)); hibernateUser.getEffectiveRoles().addAll(hibernateGroup.getEffectiveRoles()); userDao.update(hibernateUser); } } } }
"select count(user) from HibernateGroup as gr " + "left join gr.users as user where gr.name = :name and gr.domain = :domain", new String[] { "name", "domain" }, new Object[] { groupName.getName(), groupName.getDomain() }); return new PaginationResult<HibernateUser>(listCountValues.iterator().next().intValue(), listHibernateUsers);
/** * 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 deleteGroup(DeleteGroupRequest request) { Map<String, Serializable> auxParams = new HashMap<String, Serializable>(); if (request.getGroupName()!=null && request.getGroupName().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroupName().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroupName().getDomain());
auxParams.put(BackendAuthorizerRequest.UNSUFFIXED_GENERIC_PARAM_VALUE, request.getGroup().getName()); if (request.getGroup().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroup().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroup().getDomain());
auxParams.put(BackendAuthorizerRequest.UNSUFFIXED_GENERIC_PARAM_VALUE, request.getGroup().getName()); if (request.getGroup().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroup().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroup().getDomain());
ObligationContext obligCtx = new ObligationContext(); Map<String, Serializable> auxParams = new HashMap<String, Serializable>(); if (request.getGroupName()!=null && request.getGroupName().getDomain()!=null) { auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_ROOT_SUFFIX, extractDomainRoot(request.getGroupName().getDomain())); auxParams.put(XACMLConstants.SUBJECT_AUX_PARAM_DOMAIN_SUFFIX, request.getGroupName().getDomain());
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 void unassignUser(String userId, GroupName group) throws UserNotFoundException, GroupNotFoundException, CrossDomainOperationException { HibernateUser hibernateUser = userDao.load(userId, null); if (hibernateUser == null) { throw new UserNotFoundException(userId); } else { if (!hibernateUser.getDomain().equals(group.getDomain())) { throw new CrossDomainOperationException(); } else { HibernateGroup hibernateGroup = groupDao.load(group); if (hibernateGroup == null) { throw new GroupNotFoundException(group); } else { hibernateUser.getDirectGroups().remove(hibernateGroup); userDao.update(hibernateUser); hibernateUser.setEffectiveGroups(getEffectiveGroups(hibernateUser)); hibernateUser.setEffectiveRoles(getEffectiveRoles(hibernateUser)); userDao.update(hibernateUser); } } } }
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) {