qwc-services / qwc-admin-gui

QWC Admin GUI
MIT License
1 stars 17 forks source link

Allow to set values for user info fields in dropdown list #79

Closed benoitblanc closed 10 months ago

benoitblanc commented 10 months ago

Hi,

This PR aims to allow administrator to use list of values when using user_info_fields.

For instance, we could set USER_INFO_FIELDS env var to the following value in qwc-admin-gui image :

USER_INFO_FIELDS: '[{"title": "Color", "name": "color", "type": "list", "values": [["255,0,0", "red"], ["0,255,0", "green"], ["0,0,255", "blue"], "required": true}]'

or

USER_INFO_FIELDS: '[{"title": "Color", "name": "color", "type": "list", "values": ["red", "green", "blue"], "required": true}]'

if values and labels are the same.

Then, when creating a new user, admin can chose between all the values in dropdown list (it is an other example with some commune names):

image

Also, I did a first commit 01d2e7c2ecc2d5914777d4371d1488e085ad8726 because I was not able to save my new user if user_info was not added to the session (SQL Alchemy error object of type <user_info> not in session add operation along user_infos_collection will not proceed)

Thanks.

manisandro commented 10 months ago

Thanks!