Andreas Moog via FreeIPA-users wrote:
> Hello there,
>
> I need to change the length and default value of an existing attribute for a
> user. In this case, the displayname. I thought I could simply add a plugin
> with:
>
> from ipaserver.plugins.user import user
> from ipalib import Str, _
> user.takes_params += (
> Str('displayname?',
> label=_('Display name'),
> default_from=lambda givenname, sn: '%s%s' % (givenname[0],
> sn[0:3]),
> maxlength=5,
> autofill=True,
> ),
> )
>
> But that results in an error:
> AttributeError: cannot override NameSpace.displayname value...
>
> What am I doing wrong? Is this not the right way to do it? This is with
> FreeIPA 4.9.13 on RedHat 8.
You can't replace or extend an existing parameter. I think the best you
could do in this case is a pre_callback() to enforce the length.
rob
--
_______________________________________________
FreeIPA-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/[email protected]
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue