Package com.dotmarketing.portlets.contentlet.business

Examples of com.dotmarketing.portlets.contentlet.business.DotLockException


    public boolean canLock(Contentlet contentlet, User user, boolean respectFrontendRoles) throws   DotLockException {
        if(contentlet ==null || !UtilMethods.isSet(contentlet.getIdentifier())){
            return true;
        }
        if(user ==null){
            throw new DotLockException("null User cannot lock content");
        }

        try{
            if(APILocator.getRoleAPI().doesUserHaveRole(user, APILocator.getRoleAPI().loadCMSAdminRole())){
                return true;
            }
            else if(!APILocator.getPermissionAPI().doesUserHavePermission(contentlet, PermissionAPI.PERMISSION_EDIT, user, respectFrontendRoles)){
                throw new DotLockException("User: "+ (user != null ? user.getUserId() : "Unknown")
                    +" does not have Edit Permissions to lock content: " + (contentlet != null ? contentlet.getIdentifier() : "Unknown"));
            }
        }catch(DotDataException dde){
            throw new DotLockException("User: "+ (user != null ? user.getUserId() : "Unknown")
                +" does not have Edit Permissions to lock content: " + (contentlet != null ? contentlet.getIdentifier() : "Unknown"));
        }


        String lockedBy =null;
        try{
            lockedBy=APILocator.getVersionableAPI().getLockedBy(contentlet);
        }
        catch(Exception e){

        }
        if(lockedBy != null && !user.getUserId().equals(lockedBy)){
            throw new DotLockException(CANT_GET_LOCK_ON_CONTENT);
        }
        return true;

    }
View Full Code Here


  public Map<Relationship, List<Contentlet>> findContentRelationships(
      Contentlet contentlet, User user) throws DotDataException,
      DotSecurityException {

    if(!APILocator.getPermissionAPI().doesUserHavePermission(contentlet, PermissionAPI.PERMISSION_EDIT, user)){
            throw new DotLockException("User: " + (user != null ? user.getUserId() : "Unknown")
                + " does not have Edit Permissions on the content: " + (contentlet != null ? contentlet.getIdentifier() : "Unknown"));
        }

    return findContentRelationships(contentlet);
  }
View Full Code Here

      try{
        currentContentlet = conAPI.checkout(currentContentlet.getInode(), user, false);
      }
      catch(DotLockException dle){
        SessionMessages.add(req, "message", "message.cannot.unlock.content.for.editing");
        throw new DotLockException("User cannot lock contentlet : ", dle);
      }catch (DotSecurityException dse) {
        if(!isAutoSave)
          SessionMessages.add(req, "message", "message.insufficient.permissions.to.save");

        throw new DotSecurityException("User cannot checkout contentlet : ", dse);
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.contentlet.business.DotLockException

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.