LDAP sync: improve validation of synced attributes
and skip the ones not fitting our schema, while warning the user about
them.
Also warns the user if the specified 'sync_attributes' mapping
contains entries for attributes that don't exist, e.g.
'enabled=active' (since the property on PVE side is called 'enable').
For the 'enable' property, any value coming from the server led to the
user being enabled, even "0", because it is a string. This is not
changed by this patch, by not trying to validate or parse a boolean.
In get_users(), the username is also set in the returned hash, but
without the realm. This doesn't seem to be necessary for syncing,
because the username with the realm is used as a hash key and that's
what's relied upon when updating the config. But the tests require it
to be set, so that is not changed by this patch either.
Relies on the user properties (other than username) to be standard
options called 'user-XYZ'. Could be improved by moving the schema for
user properties from the API module to a module that can be accessed
by both API and plugin here and creating a helper for accessing it.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
(cherry picked from commit
cb93636b55c26f641fdbedef10dbb6e80b4502b8)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>