Package com.dotmarketing.exception

Examples of com.dotmarketing.exception.DotSecurityException


    PermissionAPI permAPI = APILocator.getPermissionAPI();

    if(!InodeUtils.isSet(f.getInode()) && parentFolder != null && !permAPI.doesUserHavePermission(parentFolder, PermissionAPI.PERMISSION_CAN_ADD_CHILDREN, user)){
      if(!InodeUtils.isSet(f.getInode()) && parentHost != null && !permAPI.doesUserHavePermission(parentHost, PermissionAPI.PERMISSION_CAN_ADD_CHILDREN, user)){
        throw new DotSecurityException("You don't have permissions to add this folder");
      }
    } else if(InodeUtils.isSet(f.getInode()) && !permAPI.doesUserHavePermission(f, PermissionAPI.PERMISSION_EDIT, user)){
      throw new DotSecurityException("You don't have permissions to edit this folder");
    }

    FolderForm folderForm = (FolderForm) form;
   
    HibernateUtil.startTransaction();
View Full Code Here


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

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

      InputStream is;
      FileReader fr = null;
      if(!UtilMethods.isSet(realPath)){
View Full Code Here

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

      if(!Config.getBooleanProperty("ENABLE_SCRIPTING", false)){
        throw new DotSecurityException("Last Mod User does not have Scripting Developer role");
      }
      User mu = userAPI.loadUserById(file.getModUser(), userAPI.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

    public void cleanHostField(Structure structure, User user, boolean respectFrontendRoles)
        throws DotSecurityException, DotDataException, DotMappingException {

        if(!perAPI.doesUserHavePermission(structure, PermissionAPI.PERMISSION_PUBLISH, user, respectFrontendRoles)){
            throw new DotSecurityException("Must be able to publish structure to clean all the fields with user: "
                + (user != null ? user.getUserId() : "Unknown"));
        }

        conFac.cleanIdentifierHostField(structure.getInode());
View Full Code Here

    }

    public void cleanField(Structure structure, Field field, User user, boolean respectFrontendRoles) throws DotSecurityException, DotDataException {

        if(!perAPI.doesUserHavePermission(structure, PermissionAPI.PERMISSION_PUBLISH, user, respectFrontendRoles)){
            throw new DotSecurityException("Must be able to publish structure to clean all the fields with user: "
                + (user != null ? user.getUserId() : "Unknown"));
        }

        String type = field.getFieldType();
        if(Field.FieldType.LINE_DIVIDER.toString().equals(type) ||
View Full Code Here

        List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
        if(contentlet == null || !InodeUtils.isSet(contentlet.getInode())){
            throw new DotContentletStateException("Contentlet must exist");
        }
        if(!perAPI.doesUserHavePermission(contentlet, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)){
            throw new DotSecurityException("User " + (user != null ? user.getUserId() : "Unknown") + " cannot read Contentlet");
        }
        Identifier id = APILocator.getIdentifierAPI().find(contentlet);
        if (!InodeUtils.isSet(id.getInode()))
            return results;
        List<MultiTree> trees = MultiTreeFactory.getMultiTreeByChild(id.getInode());
View Full Code Here

    public List<Contentlet> getAllLanguages(Contentlet contentlet, Boolean isLiveContent, User user, boolean respectFrontendRoles)
        throws DotDataException, DotSecurityException {

        if(!perAPI.doesUserHavePermission(contentlet, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)){
            throw new DotSecurityException("User: "+ (user != null ? user.getUserId() : "Unknown")+" cannot read Contentlet");
        }

        List<Contentlet> contentletList =  null;

View Full Code Here

          + "; ContentIdentifier: " + (contentlet != null ? contentlet.getIdentifier() : "Unknown"), contentlet.getHost());
    }

    public Identifier getRelatedIdentifier(Contentlet contentlet,String relationshipType, User user, boolean respectFrontendRoles)throws DotDataException, DotSecurityException {
        if(!perAPI.doesUserHavePermission(contentlet, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles)){
            throw new DotSecurityException("User: "+ (user != null ? user.getUserId() : "Unknown") +" cannot read Contentlet");
        }
        return conFac.getRelatedIdentifier(contentlet, relationshipType);
    }
View Full Code Here

        }
        List<Contentlet> perCons = perAPI.filterCollection(contentlets, PermissionAPI.PERMISSION_PUBLISH, respectFrontendRoles, user);
        List<Contentlet> contentletsVersion = new ArrayList<Contentlet>();

        if(perCons.size() != contentlets.size()){
            throw new DotSecurityException("User: "+ (user != null ? user.getUserId() : "Unknown")
                +" does not have permission to delete some or all of the contentlets");
        }

        List<String> l = new ArrayList<String>();
View Full Code Here

        List<Contentlet> perCons = perAPI.filterCollection(contentlets, PermissionAPI.PERMISSION_PUBLISH, respectFrontendRoles, user);
        List<Contentlet> contentletsVersion = new ArrayList<Contentlet>();
        contentletsVersion.addAll(contentlets);

        if(perCons.size() != contentlets.size()){
            throw new DotSecurityException("User: "+ (user != null ? user.getUserId() : "Unknown")
                +" does not have permission to delete some or all of the contentlets");
        }
        for (Contentlet con : contentlets) {
            catAPI.removeChildren(con, APILocator.getUserAPI().getSystemUser(), true);
            catAPI.removeParents(con, APILocator.getUserAPI().getSystemUser(), true);
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.