[Freeipa-users] FreeIPA Multi Valued Custom Fields

Rob Crittenden rcritten at redhat.com
Mon Jul 6 17:35:04 UTC 2009


Mark Hannessen wrote:
> Hi Rob, ( and list )
> 
> Sorry for the very late reply.
> We are still interested in using FreeIPA for our project.
> 
> Any support you could give us to the minimum needed for multi valued 
> attributes working would be more then welcome.
> 

Ok, it is going to require a fair bit of work to add them.

The files you need to edit in the source tree are in 
ipa-server/ipa-gui/ipagui. They are installed in /usr/share/ipa/ipagui.

What I would recommend doing is using the attribute mobile as a template.

You will need to define whatever new attributes you want in forms/user.py

A new field will look like:

c = ExpandingForm(name="countries", label="Country", fields=[c])

You also need to add initialization and conversion calls in 
subcontrollers/user.py.

Finally you add the new attributes to templates/usernewform.py and 
templates/usereditform.py. Again, follow the existing convention. This 
is way harder than it needs to be because we wanted totally control over 
the appearance so we couldn't use the traditional TurboGears rendering 
engine. This means that all the attributes are hardcoded and this is 
particularly ugly when it comes to multi-valued attributes. We use the 
ExpandingForm widget to display things and this relies heavily on 
Javascript.

The form uses a pluralized form of the attribute (telephonenumbers, 
mobiles, etc) to store the data visually for the user. This gets 
converted back into an LDAP attribute name in subcontrollers/user.py.

Hope that isn't too scary.

rob

> Kind Regards,
> 
> Mark Hannessen
> 
> On Tuesday 16 June 2009 03:16:25 pm Rob Crittenden wrote:
>> Mark Hannessen wrote:
>>> Hi List,
>>>
>>>
>>> I am currently deploying a freeipa installation for use in within our
>>> company.
>>> I have succesfully added a couple of custom attributes to the fedora
>>> directory server and to the webinterface using ipacustomfields in
>>> cn=ipaConfig,cn=etc
>>>
>>>
>>> All attributes however appear in the interface as single valued
>>> attributes.
>>>
>>>
>>> Does anyone know if it is possible ( or hackable ) to present them as
>>> multivalued attributes in the interface? ( all my custom attributes
>>> happen to be multi valued, so a hack that would make them all appear
>>> multi valued would be enough in my case as well )
>> Unfortunately our support for UI customization is very weak right now
>> (which is one reason we started from scratch again).
>>
>> It only supports single-valued custom attributes right now. To try to
>> add in multi-valued attributes would require a fair bit of work.  In
>> order to make the UI act the way we wanted we had to dump the TurboGears
>> template system so it isn't as simple as adding in a new reference to a
>> UI object. A bunch of custom code needs to be added, particularly for
>> multi-valued fields.
>>
>> It isn't an impossible task but it would require a bit of coding on your
>> end. I can try to point you in the right direction if you want to go
>> that route (you'd just have to be careful about saving your work so an
>> IPA update doesn't wipe it all out).
>>
>> rob
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-users/attachments/20090706/cc909733/attachment.bin>


More information about the Freeipa-users mailing list