code: protected Acl collectAcl(CmsObject cms, CmsResource resource, boolean onlyBasic) throws CmsException {
  
          AccessControlListImpl cmisAcl = new AccessControlListImpl();
          List<Ace> cmisAces = new ArrayList<Ace>();
          List<CmsAccessControlEntry> aces = cms.getAccessControlEntries(resource.getRootPath(), true);
          for (CmsAccessControlEntry ace : aces) {
              boolean isDirect = ace.getResource().equals(resource.getResourceId());
              CmsUUID principalId = ace.getPrincipal();
              String principalName = getAcePrincipalName(cms, principalId);
              AccessControlEntryImpl cmisAce = new AccessControlEntryImpl();
              AccessControlPrincipalDataImpl cmisPrincipal = new AccessControlPrincipalDataImpl();
              cmisPrincipal.setId(principalName);
              cmisAce.setPrincipal(cmisPrincipal);
              cmisAce.setPermissions(onlyBasic ? getCmisPermissions(ace) : getNativePermissions(ace));
              cmisAce.setDirect(isDirect);
              cmisAces.add(cmisAce);
          }
          cmisAcl.setAces(cmisAces);
          cmisAcl.setExact(Boolean.FALSE);
          return cmisAcl;
      }
docs: Compiles the ACL for a file or folder.
  @param cms the CMS context
  @param resource the resource for which to collect the ACLs
  @param onlyBasic flag to only include basic ACEs
  
  @return the ACL for the resource
  @throws CmsException if something goes wrong