Package com.dotmarketing.exception

Examples of com.dotmarketing.exception.DotSecurityException


    if (st.getStructureType() == Structure.STRUCTURE_TYPE_FORM) {
      contentlet.setHost(formHost.getIdentifier());
      Host host = APILocator.getHostAPI().find(formHost.getIdentifier(), APILocator.getUserAPI().getSystemUser(), false);
      if (!perAPI.doesUserHavePermissions(host,"PARENT:"+PermissionAPI.PERMISSION_READ+", CONTENTLETS:"+PermissionAPI.PERMISSION_WRITE+"", user)) {
        throw new DotSecurityException("User doesn't have write permissions to Contentlet");
      }
    }

    /**
     * If the moderator field is set, a work flow task is created
View Full Code Here


    String inode = UtilMethods.getFileName(new File(FileUtil.getRealPath(assetPath + uri)).getName());
    com.dotmarketing.portlets.files.model.File file = APILocator.getFileAPI().find(inode, APILocator.getUserAPI().getSystemUser(), false);

    if(!Config.getBooleanProperty("ENABLE_SCRIPTING", false)){
      throw new DotSecurityException("Last Mod User does not have Scripting Developer role");
    }
    User mu = APILocator.getUserAPI().loadUserById(file.getModUser(), APILocator.getUserAPI().getSystemUser(), true);
    if(!APILocator.getRoleAPI().doesUserHaveRole(mu, APILocator.getRoleAPI().loadRoleByKey("Scripting Developer"))){
      throw new DotSecurityException("Last Mod User does not have Scripting Developer role");
    }

    FileReader fr = null;
    if(!UtilMethods.isSet(realPath)){
      fr = new FileReader(FileUtil.getRealPath(assetPath + uri));
View Full Code Here

          authenticator.authenticateByUserId(comp.getCompanyId(), username, passwd);
        }
      }
    }catch (AuthException ae) {
      Logger.debug(this, "Username : " + username + " failed to login", ae);
      throw new DotSecurityException(ae.getMessage(),ae);
    }catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
      throw new DotSecurityException(e.getMessage(),e);
    }
    UserAPI userAPI=APILocator.getUserAPI();
    if (comp.getAuthType().equals(Company.AUTH_TYPE_ID)) {
      _user = userAPI.loadUserById(username,userAPI.getSystemUser(),false);
    } else {
      _user = userAPI.loadByUserByEmail(username, userAPI.getSystemUser(), false);
    }
    if (PublicEncryptionFactory.digestString(passwd).equals(_user.getPassword())) {
      return _user;
    }else if(_user == null){
      throw new DotSecurityException("The user was returned NULL");
    }else{
      Logger.debug(this, "The user's passwords didn't match");
      throw new DotSecurityException("The user's passwords didn't match");
    }
  }
View Full Code Here

          //Validate if the user have the right permission before
          if(isAutoPub && !perAPI.doesUserHavePermission(fileAsset, PermissionAPI.PERMISSION_PUBLISH, user) ){
            APILocator.getContentletAPI().archive(fileAsset, APILocator.getUserAPI().getSystemUser(), false);
            APILocator.getContentletAPI().delete(fileAsset, APILocator.getUserAPI().getSystemUser(), false);
            throw new DotSecurityException("User does not have permission to publish contentlets");
              }else if(!isAutoPub && !perAPI.doesUserHavePermission(fileAsset, PermissionAPI.PERMISSION_EDIT, user)){
                APILocator.getContentletAPI().archive(fileAsset, APILocator.getUserAPI().getSystemUser(), false);
            APILocator.getContentletAPI().delete(fileAsset, APILocator.getUserAPI().getSystemUser(), false);
            throw new DotSecurityException("User does not have permission to edit contentlets");
              }
          if(isAutoPub && perAPI.doesUserHavePermission(fileAsset, PermissionAPI.PERMISSION_PUBLISH, user)) {
              APILocator.getContentletAPI().publish(fileAsset, user, false);

              Date currentDate = new Date();
View Full Code Here

    UserProxy up = upf.getUserProxy(userId);
   
    if(perAPI.doesUserHavePermission(up, PermissionAPI.PERMISSION_READ, user, respectFrontEndRoles)){
      return up;
    }else{
      throw new DotSecurityException("User doesn't have permissions to retrieve UserProxy");
    }
  }
View Full Code Here

  public UserProxy getUserProxyByLongLiveCookie(String dotCMSID, User user, boolean respectFrontEndRoles) throws DotRuntimeException, DotSecurityException, DotDataException{
    UserProxy up =  upf.getUserProxyByLongLiveCookie(dotCMSID);
    if(perAPI.doesUserHavePermission(up, PermissionAPI.PERMISSION_READ, user, respectFrontEndRoles)){
      return up;
    }else{
      throw new DotSecurityException("User doesn't have permissions to retrieve UserProxy");
    }
  }
View Full Code Here

  }
 
  public void saveUserProxy(UserProxy userProxy, User user, boolean respectFrontEndRoles) throws DotRuntimeException, DotDataException, DotSecurityException
  {
    if(!perAPI.doesUserHavePermission(userProxy, PermissionAPI.PERMISSION_EDIT, user, respectFrontEndRoles)){
      throw new DotSecurityException("User doesn't have permission to save the user proxy object which is trying to be saved");
    }
    upf.saveUserProxy(userProxy);
  }
View Full Code Here

    if(!isLegacyFilesSupported()){
      throw new DotStateException("File Assets have been disabled.");
    }

    if (!permissionAPI.doesUserHavePermission(source, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to read the source file.");
    }

    if (!permissionAPI.doesUserHavePermission(destination, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to write in the destination folder.");
    }

    // gets filename before extension
    String fileName = UtilMethods.getFileName(source.getFileName());
    // gets file extension
View Full Code Here

    File f = ffac.getWorkingFileByFileName(fileName, folder);
    if(!InodeUtils.isSet(f.getInode())){
      return null;
    }
    if (!permissionAPI.doesUserHavePermission(f, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to read the  file.");
    }
    return f;
  }
View Full Code Here

    boolean fileExists = (currentFile != null) && InodeUtils.isSet(currentFile.getInode());

    if (fileExists) {
      if (!permissionAPI.doesUserHavePermission(currentFile, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)) {
        throw new DotSecurityException("You don't have permission to read the source file.");
      }
    }

    if (!permissionAPI.doesUserHavePermission(folder, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles)) {
      throw new DotSecurityException("You don't have permission to write in the destination folder.");
    }

    File workingFile = null;

    try {
View Full Code Here

TOP

Related Classes of com.dotmarketing.exception.DotSecurityException

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.