formcreator icon indicating copy to clipboard operation
formcreator copied to clipboard

use variable in (LDAP-)Questions

Open magheinz opened this issue 2 years ago • 3 comments

Is there a way to use Variables in Questions?

I want to create a LDAP-Question with a filter by username, so i can show every group the user is member of.

is it possible?

magheinz avatar Sep 01 '22 19:09 magheinz

Hi

For now, this is not possible.

Also, querying directly the directory may be less efficient. If you want to develop such feature I suggest you consider to import LDAP groups in glpi then use these imported groups as source for your need.

btry avatar Sep 01 '22 19:09 btry

Ok. How can i show a list with groups, where the user is member ob, so he can select one of this groups in a form? I only need every group, only the groups with names like: "share_admins_XYZ" where the user is member of.

So he can ceate a ticket for changin quotas, by example.

magheinz avatar Sep 01 '22 19:09 magheinz

If I remember well there is a method in the class User, group or group_user which gives all groups a user is member of. Iterate on those groups to filter by name with a SQL query and using the operator LIKE.

To show this list in a form, I suggest you create a custom question type implementing the rough algorithm above. I think you can create a class inherited from the glpi object field.

btry avatar Sep 01 '22 19:09 btry