code: public Set<CmsResource> getResourcesForPrincipal(
          CmsRequestContext context,
          CmsUUID principalId,
          CmsPermissionSet permissions,
          boolean includeAttr)
      throws CmsException {
  
          Set<CmsResource> dependencies;
          CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
          try {
              dependencies = m_driverManager.getResourcesForPrincipal(
                  dbc,
                  dbc.currentProject(),
                  principalId,
                  permissions,
                  includeAttr);
          } catch (Exception e) {
              dbc.report(null, Messages.get().container(Messages.ERR_READ_RESOURCES_FOR_PRINCIPAL_LOG_1, principalId), e);
              dependencies = new HashSet<CmsResource>();
          } finally {
              dbc.clear();
          }
          return dependencies;
      }
docs: Returns all resources associated to a given principal via an ACE with the given permissions.<p>
  
  If the <code>includeAttr</code> flag is set it returns also all resources associated to
  a given principal through some of following attributes.<p>
  
  <ul>
  <li>User Created</li>
  <li>User Last Modified</li>
  </ul><p>
  
  @param context the current request context
  @param principalId the id of the principal
  @param permissions a set of permissions to match, can be <code>null</code> for all ACEs
  @param includeAttr a flag to include resources associated by attributes
  
  @return a set of <code>{@link CmsResource}</code> objects
  
  @throws CmsException if something goes wrong