docs: public CmsPermissionSet getPermissions(CmsObject cms, CmsResource resource) {
  
          String cacheKey = getPermissionsCacheKey(cms, resource);
          CmsPermissionSetCustom permissions;
          if (cacheKey != null) {
              permissions = m_permissionsCache.get(cacheKey);
              if (permissions != null) {
                  return permissions;
              }
          }
          CmsAccessControlList acl = (CmsAccessControlList)m_accessControlList.clone();
  
          CmsUser user = cms.getRequestContext().getCurrentUser();
          List<CmsGroup> groups = null;
          try {
              groups = cms.getGroupsOfUser(user.getName(), false);
          } catch (CmsException e) {
              // error reading the groups of the current user
              LOG.error(Messages.get().getBundle().key(Messages.LOG_READ_GROUPS_OF_USER_FAILED_1, user.getName()), e);
          }
          List<CmsRole> roles = null;
          try {
              roles = OpenCms.getRoleManager().getRolesForResource(cms, user, resource);
          } catch (CmsException e) {
              // error reading the roles of the current user
              LOG.error(Messages.get().getBundle().key(Messages.LOG_READ_GROUPS_OF_USER_FAILED_1, user.getName()), e);
          }
          String defaultPermissions = m_accessControl.get(PRINCIPAL_DEFAULT);
          // add the default permissions to the acl
          if ((defaultPermissions != null) && !user.isGuestUser()) {
              boolean found = false;
              if (acl.getPermissions(user.getId()) != null) {
                  // acl already contains the user, no need for default
                  found = true;
              }
              if (!found && (groups != null)) {
                  // look up all groups to see if we need the default
                  Iterator<CmsGroup> itGroups = groups.iterator();
                  while (itGroups.hasNext()) {
                      CmsGroup group = itGroups.next();
                      if (acl.getPermissions(group.getId()) != null) {
                          // acl already contains the group, no need for default
                          found = true;
                          break;
                      }
                  }
              }
              if (!found && (roles != null)) {
                  // look up all roles to see if we need the default
                  Iterator<CmsRole> itRoles = roles.iterator();
                  while (itRoles.hasNext()) {
                      CmsRole role = itRoles.next();
                      if (acl.getPermissions(role.getId()) != null) {
                          // acl already contains the group, no need for default
                          found = true;
                          break;
                      }
                  }
              }
              if (!found) {
                  // add default access control settings for current user
                  CmsAccessControlEntry entry = new CmsAccessControlEntry(null, user.getId(), defaultPermissions);
                  acl.add(entry);
              }
          }
          permissions = acl.getPermissions(user, groups, roles);
  
          if (cacheKey != null) {
              m_permissionsCache.put(cacheKey, permissions);
          }
          return permissions;
      }