code: @GET
      public Map<String, ExternalType> getObjects(
              @QueryParam("permission") List<ObjectPermission.Type> permissions)
              throws GuacamoleException {
  
          // An admin user has access to all objects
          Permissions effective = userContext.self().getEffectivePermissions();
          SystemPermissionSet systemPermissions = effective.getSystemPermissions();
          boolean isAdmin = systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER);
  
          // Filter objects, if requested
          Collection<String> identifiers = directory.getIdentifiers();
          if (!isAdmin && permissions != null && !permissions.isEmpty()) {
              ObjectPermissionSet objectPermissions = getObjectPermissions(effective);
              identifiers = objectPermissions.getAccessibleObjects(permissions, identifiers);
          }
  
          // Translate each retrieved object into the corresponding external object
          Map<String, ExternalType> apiObjects = new HashMap<String, ExternalType>();
          for (InternalType object : directory.getAll(identifiers))
              apiObjects.put(object.getIdentifier(), translator.toExternalObject(object));
  
          return apiObjects;
  
      }
docs: Returns a map of all objects available within this DirectoryResource,
  filtering the returned map by the given permission, if specified.
  
  @param permissions
  The set of permissions to filter with. A user must have one or more
  of these permissions for the affected objects to appear in the
  result. If null, no filtering will be performed.
  
  @return
  A map of all visible objects. If a permission was specified, this
  map will contain only those objects for which the current user has
  that permission.
  
  @throws GuacamoleException
  If an error is encountered while retrieving the objects.