Dynamic LDAP filtering for the External Storage module


we face the following problems with the External Storage Modul in combination with the LDAP Modul.


Nextcloud version: 28.0.2
Operating system and version: Ubuntu 22.04.3 LTS
Apache or nginx version: Apache/2.4.52
PHP version: PHP 8.1.2-1ubuntu2.14


It is important to know that we use the LDAP module to query users and the External storage module to query via CIFS the home directories for the logged-in user as intended.
This works as long as the home directory is called the “$home” Placeholder Field" defined in the LDAP module, in our case the LDAP attribute “cn”.
For teachers, for example, the path is: DOCS\teacher$home
The query works here.

For students home directories, the path is: DOCS\student\class$home
In LDAP attributes, the path is as follows: DOCS\student\ou\cn
This means that approx. 1000 students are distributed across 90 school classes.

The problem:

According to my research, the External Storage module cannot make a dynamic LDAP query but simply searches for the logged-in user under the specified path (DOCS.…$home). I have not found any other placeholder which executes the filter as follows: DOCS.…\ou\cn

So we are looking for a way to read the home directories of the students although they are created behind different school classes (in this case ou=class).

The option of putting all the students in one folder is not possible for us. I would be grateful for any advice on how we could solve this problem.

Many thanks in advance.