code: public void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user)
      throws CmsException {
  
          if (!getGroupsOfUser(dbc, user.getName(), false).isEmpty()) {
              throw new CmsDbConsistencyException(
                  Messages.get().container(Messages.ERR_ORGUNIT_MOVE_USER_2, orgUnit.getName(), user.getName()));
          }
  
          // move the principal
          getUserDriver(dbc).setUsersOrganizationalUnit(dbc, orgUnit, user);
          // remove the principal from cache
          m_monitor.clearUserCache(user);
  
          if (!dbc.getProjectId().isNullUUID()) {
              // user modified event is not needed
              return;
          }
          // fire user modified event
          Map<String, Object> eventData = new HashMap<String, Object>();
          eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
          eventData.put(I_CmsEventListener.KEY_OU_NAME, user.getOuFqn());
          eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_SET_OU);
          OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
      }
docs: Moves an user to the given organizational unit.<p>
  
  @param dbc the current db context
  @param orgUnit the organizational unit to add the resource to
  @param user the user that is to be moved to the organizational unit
  
  @throws CmsException if something goes wrong
  
  @see org.opencms.security.CmsOrgUnitManager#setUsersOrganizationalUnit(CmsObject, String, String)