code: public CmsResource getPermissionCheckFolder(CmsObject cms) throws CmsException {
  
          CmsResource folder = getFolder(cms);
          if (folder != null) {
              return folder;
          }
          String parentPath = CmsResource.getParentFolder(m_path);
          CmsResource parent = cms.readResource(parentPath);
          return parent;
      }
docs: Returns the folder to check for permissions, which is either the folder itself if it already exists,
  or the parent folder if it doesn't.<p>
  
  @param cms the current CMS context
  
  @return the folder to check for permissions
  
  @throws CmsException if something goes wrong