[Freeipa-users] HOW to Add employeenumber to user easily? there is account object with emoployee number ttribute

Martin Kosek mkosek at redhat.com
Thu Feb 6 14:53:58 UTC 2014


On 02/06/2014 01:12 PM, Petr Viktorin wrote:
> On 02/06/2014 01:08 PM, Dmitri Pal wrote:
>> On 02/06/2014 05:59 AM, Petr Viktorin wrote:
>>> On 02/06/2014 09:31 AM, barrykfl at gmail.com wrote:
>>>> Hi:
>>>>
>>>> I can make it show on ldap browser or the ui but finding where to add it
>>>> in command base.
>>>>
>>>> ipa  user-mod  ---employeenumber no such parameter.
>>>
>>> You can use setattr where we don't provide specialized CLI arguments.
>>> Also note that employeenumber won't show in the default output; you'll
>>> want to use --all to retrieve all the attributes.
>>> ipa user-mod somerandomuser --setattr=employeenumber=1234 --all
>>> ipa user-show somerandomuser --all
>>>
>>>
>>> To add this to the CLI, you would need to modify the user object in
>>> your plugin. Something like:
>>>
>>> from ipalib.plugins import user
>>> from ipalib.parameters import Str
>>>
>>> user.takes_params = user.takes_params + (
>>>          Str('employeenumber',
>>>              cli_name='first',
>>
>> did you mean
>>
>> cli_name='employeenumber'
>>
>>
>> ?
>> Copy paste?
> 
> Right, sorry for the mistake.

Note that you do not need to add this cli_name part of it equals the actual
attribute name. cli_name defaults to attribute name.

> 
>>>              label=_('Employee number'),
>>>          ),
>>> )
>>>
>>>> Moreover can i change the attribute just by name and make use of it.
>>>>
>>>> E.g. i found car license no really useful for staff so i want to change
>>>> the label to staff id card number
>>>
>>> You should ideally create a new LDAP attribute for this, but the label
>>> is defined in ipalib.plugins.user.

It seems to me that current employeeNumber attribute present in inetorgperson
objectClass is ok for this use case. If yes, then no schema change is needed.

Martin




More information about the Freeipa-users mailing list