code: private void updateNoUploadReason(CmsObject searchCms, CmsGallerySearchBean searchObj) {
  
          if ((searchObj.getGalleries().size() + searchObj.getFolders().size()) == 1) {
              String target = !searchObj.getGalleries().isEmpty()
              ? searchObj.getGalleries().get(0)
              : searchObj.getFolders().iterator().next();
              try {
                  CmsResource targetRes;
                  if (searchCms.existsResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                      targetRes = searchCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
                  } else {
                      CmsObject rootCms = OpenCms.initCmsObject(searchCms);
                      rootCms.getRequestContext().setSiteRoot("");
                      targetRes = rootCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
                  }
                  searchObj.setNoUploadReason(
                      new CmsResourceUtil(searchCms, targetRes).getNoEditReason(getWorkplaceLocale(), true));
              } catch (CmsException e) {
                  searchObj.setNoUploadReason(e.getLocalizedMessage(getWorkplaceLocale()));
              }
          } else {
              searchObj.setNoUploadReason(null);
          }
      }
docs: Checks the current users permissions on the upload target folder to update the no upload reason.<p>
  
  @param searchCms the cms context
  @param searchObj the search data