code: protected boolean isWritable(CmsObject cms, CmsResource resource) throws CmsException {
  
          boolean writable = cms.hasPermissions(
              resource,
              CmsPermissionSet.ACCESS_WRITE,
              false,
              CmsResourceFilter.IGNORE_EXPIRATION);
          if (writable) {
              CmsLock lock = cms.getLock(resource);
              writable = lock.isUnlocked() || lock.isOwnedBy(cms.getRequestContext().getCurrentUser());
              if (writable) {
                  CmsResourceUtil resUtil = new CmsResourceUtil(cms, resource);
                  writable = resUtil.isInsideProject() && !resUtil.getProjectState().isLockedForPublishing();
              }
          }
          return writable;
      }
docs: Returns whether the current user has write permissions, the resource is lockable or already locked by the current user and is in the current project.<p>
  
  @param cms the cms context
  @param resource the resource
  
  @return <code>true</code> if the resource is writable
  
  @throws CmsException in case checking the permissions fails