docs: public boolean hasRoleForResource(CmsDbContext dbc, CmsUser user, CmsRole role, CmsResource resource) {
  
          // guest user has no role
          if (user.isGuestUser()) {
              return false;
          }
  
          // try to read from cache
          String key = user.getId().toString() + role.getGroupName() + resource.getRootPath();
          Boolean result = OpenCms.getMemoryMonitor().getCachedRole(key);
          if (result != null) {
              return result.booleanValue();
          }
  
          // read all roles of the current user
          List<CmsGroup> roles;
          try {
              roles = new ArrayList<CmsGroup>(
                  m_driverManager.getGroupsOfUser(
                      dbc,
                      user.getName(),
                      "",
                      true,
                      true,
                      true,
                      dbc.getRequestContext().getRemoteAddress()));
          } catch (CmsException e) {
              if (LOG.isErrorEnabled()) {
                  LOG.error(e.getLocalizedMessage(), e);
              }
              // any exception: return false
              return false;
          }
  
          // first check the user has the role at all
          if (!hasRole(role.forOrgUnit(null), roles)) {
              result = Boolean.FALSE;
          }
  
          // then check if one applies to the given resource
          Iterator<CmsGroup> it = roles.iterator();
          while ((result == null) && it.hasNext()) {
              CmsGroup group = it.next();
              CmsRole givenRole = CmsRole.valueOf(group);
              if (hasRole(role.forOrgUnit(null), Collections.singletonList(group))) {
                  // we have the same role, now check the resource if needed
                  if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(givenRole.getOuFqn())) {
                      try {
                          CmsOrganizationalUnit orgUnit = m_driverManager.readOrganizationalUnit(
                              dbc,
                              givenRole.getOuFqn());
                          Iterator<CmsResource> itResources = m_driverManager.getResourcesForOrganizationalUnit(
                              dbc,
                              orgUnit).iterator();
                          while (itResources.hasNext()) {
                              CmsResource givenResource = itResources.next();
                              if (resource.getRootPath().startsWith(givenResource.getRootPath())) {
                                  result = Boolean.TRUE;
                                  break;
                              }
                          }
                      } catch (CmsException e) {
                          if (LOG.isErrorEnabled()) {
                              LOG.error(e.getLocalizedMessage(), e);
                          }
                          // ignore
                      }
                  } else {
                      result = Boolean.TRUE;
                  }
              }
          }
  
          if (result == null) {
              result = Boolean.FALSE;
          }
          OpenCms.getMemoryMonitor().cacheRole(key, result.booleanValue());
          return result.booleanValue();
      }