Package com.dotmarketing.business.web

Examples of com.dotmarketing.business.web.UserWebAPI


  }

  public String deleteAddress(String userId, String addressId) throws DotDataException {
    UserAPI uAPI = APILocator.getUserAPI();
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();

    Address ad;
    try {
      ad = uAPI.loadAddressById(addressId, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));
      uAPI.deleteAddress(ad, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));
    } catch (DotRuntimeException e) {
      Logger.error(this, e.getMessage(), e);
      throw new DotDataException(e.getMessage(), e);
    } catch (PortalException e) {
      Logger.error(this, e.getMessage(), e);
View Full Code Here


  }

  public void saveUserAddittionalInfo(String userId, boolean active, String prefix, String suffix, String title, String company, String website, String[] additionalVars)
     throws DotDataException {

    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    UserAPI uAPI = APILocator.getUserAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    try {

      User user = uAPI.loadUserById(userId,uWebAPI.getLoggedInUser(request),false);

      UserProxyAPI uProxyAPI = APILocator.getUserProxyAPI();
      User u = uAPI.loadUserById(userId, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));
      UserProxy up = uProxyAPI.getUserProxy(u, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));


      if(!active && u.getUserId().equals(uWebAPI.getLoggedInUser(request).getUserId())){
        throw new DotRuntimeException(LanguageUtil.get(uWebAPI.getLoggedInUser(request),"deactivate-your-own-user-error"));
      }

      u.setActive(active);
      up.setPrefix(prefix);
      up.setSuffix(suffix);
      up.setTitle(title);
      up.setCompany(company);
      up.setWebsite(website);
      for(int i = 1; i <= additionalVars.length; i++) {
        up.setVar(i, additionalVars[i - 1]);
      }

      uAPI.save(u, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));
      uProxyAPI.saveUserProxy(up, uWebAPI.getLoggedInUser(request), !uWebAPI.isLoggedToBackend(request));

      User modUser = getUser();
      String date = DateUtil.getCurrentDate();

      ActivityLogger.logInfo(getClass(), "Updating User Additional Info. 'Is User Enabled' was set to: " + active , "Date: " + date + "; "+ "User:" + modUser.getUserId());
View Full Code Here

    // TODO Auto-generated method stub

  }

  public Map<String, Object> getRoleById(String roleId) throws Exception {
      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getRoleById by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here

    return aRecord;
  }

  public Map<String, Object> getUsersAndRolesList(String assetInode, String permission, Map<String, String> params) throws Exception {

      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getRoleById by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here

  }


  public Map<String, Object> getRolesList(String assetInode, String permission, Map<String, String> params) throws Exception {

      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getRoleById by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here



  public Map<String, Object> getUsersList(String assetInode, String permission, Map<String, String> params) throws Exception {

      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getUsersList by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here

    return results;
  }

  public List getUsersList2(String assetInode, String permission, Map<String, String> params) throws Exception {

      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getUsersList2 by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here

    return results;
  }


  public boolean hasUserRoles(String userId, String[] roles) throws Exception {
      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();

        // lock down to users with access to Users portlet
        User loggedInUser=uWebAPI.getLoggedInUser(request);
        if(loggedInUser==null || APILocator.getLayoutAPI().loadLayoutsForUser(loggedInUser).isEmpty()) {
            SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call hasUserRoles by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
            throw new DotSecurityException("not authorized");
        }
View Full Code Here

    }
    return false;
  }

  public List<Map<String, Object>> getUserCategories(String userId) throws PortalException, SystemException, DotDataException, DotSecurityException {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    UserProxyAPI userProxyAPI = APILocator.getUserProxyAPI();

    CategoryAPI catAPI = APILocator.getCategoryAPI();
    UserProxy uProxy = userProxyAPI.getUserProxy(userId, uWebAPI.getLoggedInUser(request), uWebAPI.isLoggedToBackend(request));
    List<Category> children = catAPI.getChildren(uProxy, uWebAPI.getLoggedInUser(request), uWebAPI.isLoggedToBackend(request));

    List<Map<String, Object>> toReturn = new ArrayList<Map<String,Object>>();
    for(Category child: children) {
      toReturn.add(child.getMap());
    }
View Full Code Here

    return toReturn;
  }

  public void updateUserCategories(String userId, String[] categories) throws PortalException, SystemException, DotSecurityException, DotDataException {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    UserProxyAPI userProxyAPI = APILocator.getUserProxyAPI();

    User user = uWebAPI.getLoggedInUser(request);
    boolean respectFrontend = uWebAPI.isLoggedToBackend(request);

    CategoryAPI catAPI = APILocator.getCategoryAPI();
    UserProxy userProxy = userProxyAPI.getUserProxy(userId, uWebAPI.getLoggedInUser(request), uWebAPI.isLoggedToBackend(request));

    HibernateUtil.startTransaction();
    List<Category> myUserCategories = catAPI.getChildren(userProxy, user, respectFrontend);
    for (Object o : myUserCategories) {
      if(o instanceof Category && catAPI.canUseCategory((Category)o, user, respectFrontend)){
View Full Code Here

TOP

Related Classes of com.dotmarketing.business.web.UserWebAPI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.