On Fri, 21 Mar 2014 10:13:55 +0100
Misnyovszki Adam <[email protected]> wrote:

> On Fri, 21 Feb 2014 16:06:27 +0100
> Petr Vobornik <[email protected]> wrote:
> 
> > On 21.2.2014 15:45, Adam Misnyovszki wrote:
> > > Hi,
> > > According to http://tools.ietf.org/html/rfc2798 ipa client and web
> > > ui extended with employeenumber field.
> > >
> > > https://fedorahosted.org/freeipa/ticket/4165
> > >
> > > Question is, that should we extend user with other fields which
> > > are in the RFC, (carLicense, departmentNumber, employeeType, etc)
> > > if we already touched this code?
> > >
> > > Thanks
> > > Adam
> > >
> > 
> > 
> > +        Int('employeenumber?',
> > +            label=_('Employee ID'),
> > +            minvalue=1,
> > +        ),
> > 
> > 
> > Why Int and different label? IMO it should be Str and 'Employee
> > Number'
> > 
> > 2.4. Employee Number
> > 
> >     Numeric or alphanumeric identifier assigned to a person,
> > typically based on order of hire or association with an
> > organization. Single valued.
> > 
> >      ( 2.16.840.1.113730.3.1.3
> >        NAME 'employeeNumber'
> >        DESC 'numerically identifies an employee within an
> > organization' EQUALITY caseIgnoreMatch
> >        SUBSTR caseIgnoreSubstringsMatch
> >        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
> >        SINGLE-VALUE )
> > 
> Hi,
> fixed, also some other fields added. Note, that according to the rfc,
> licence plate field should be multivalue, should I cange that(it is an
> existing field). Also, should I write test cases(especially for
> preferredlanguage)?
> Greets
> Adam

self NACK,
VERSION bump because API change

Greets
Adam
>From 5b657e13580635a0c7862d22de76841c4c9a13a2 Mon Sep 17 00:00:00 2001
From: Adam Misnyovszki <[email protected]>
Date: Fri, 21 Mar 2014 10:59:26 +0100
Subject: [PATCH] Extending user plugin with inetOrgPerson fields

According to http://tools.ietf.org/html/rfc2798 ipa client
and web ui extended with inetOrgPerson fields:
- employeenumber
- employeetype
- preferredlanguage
- departmentnumber

https://fedorahosted.org/freeipa/ticket/4165
---
 API.txt                        | 18 +++++++++++++++---
 VERSION                        |  4 ++--
 install/ui/src/freeipa/user.js |  6 +++++-
 ipalib/plugins/user.py         | 15 +++++++++++++++
 4 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/API.txt b/API.txt
index 8e1f7713ade2b3dc046e9db82fdd6be2d85eec56..16b72963302d39a79a4f961635750ff66412b690 100644
--- a/API.txt
+++ b/API.txt
@@ -3791,13 +3791,16 @@ output: Entry('result', <type 'dict'>, Gettext('A dictionary representing an LDA
 output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
 output: Output('value', <type 'unicode'>, None)
 command: user_add
-args: 1,39,3
+args: 1,43,3
 arg: Str('uid', attribute=True, cli_name='login', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
 option: Str('carlicense', attribute=True, cli_name='carlicense', multivalue=False, required=False)
 option: Str('cn', attribute=True, autofill=True, cli_name='cn', multivalue=False, required=True)
+option: Str('departmentnumber', attribute=True, cli_name='departmentnumber', multivalue=False, required=False)
 option: Str('displayname', attribute=True, autofill=True, cli_name='displayname', multivalue=False, required=False)
+option: Str('employeenumber', attribute=True, cli_name='employeenumber', multivalue=False, required=False)
+option: Str('employeetype', attribute=True, cli_name='employeetype', multivalue=False, required=False)
 option: Str('facsimiletelephonenumber', attribute=True, cli_name='fax', multivalue=True, required=False)
 option: Str('gecos', attribute=True, autofill=True, cli_name='gecos', multivalue=False, required=False)
 option: Int('gidnumber', attribute=True, cli_name='gidnumber', minvalue=1, multivalue=False, required=False)
@@ -3820,6 +3823,7 @@ option: Bool('nsaccountlock', attribute=True, cli_name='nsaccountlock', multival
 option: Str('ou', attribute=True, cli_name='orgunit', multivalue=False, required=False)
 option: Str('pager', attribute=True, cli_name='pager', multivalue=True, required=False)
 option: Str('postalcode', attribute=True, cli_name='postalcode', multivalue=False, required=False)
+option: Str('preferredlanguage', attribute=True, cli_name='preferredlanguage', multivalue=False, pattern='^[a-zA-Z]{1,8}[-[a-zA-Z]{1,8}]?$', required=False)
 option: Flag('random', attribute=False, autofill=True, cli_name='random', default=False, multivalue=False, required=False)
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
@@ -3858,12 +3862,15 @@ output: Output('result', <type 'bool'>, None)
 output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
 output: Output('value', <type 'unicode'>, None)
 command: user_find
-args: 1,49,4
+args: 1,53,4
 arg: Str('criteria?', noextrawhitespace=False)
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
 option: Str('carlicense', attribute=True, autofill=False, cli_name='carlicense', multivalue=False, query=True, required=False)
 option: Str('cn', attribute=True, autofill=False, cli_name='cn', multivalue=False, query=True, required=False)
+option: Str('departmentnumber', attribute=True, autofill=False, cli_name='departmentnumber', multivalue=False, query=True, required=False)
 option: Str('displayname', attribute=True, autofill=False, cli_name='displayname', multivalue=False, query=True, required=False)
+option: Str('employeenumber', attribute=True, autofill=False, cli_name='employeenumber', multivalue=False, query=True, required=False)
+option: Str('employeetype', attribute=True, autofill=False, cli_name='employeetype', multivalue=False, query=True, required=False)
 option: Str('facsimiletelephonenumber', attribute=True, autofill=False, cli_name='fax', multivalue=True, query=True, required=False)
 option: Str('gecos', attribute=True, autofill=False, cli_name='gecos', multivalue=False, query=True, required=False)
 option: Int('gidnumber', attribute=True, autofill=False, cli_name='gidnumber', minvalue=1, multivalue=False, query=True, required=False)
@@ -3895,6 +3902,7 @@ option: Str('ou', attribute=True, autofill=False, cli_name='orgunit', multivalue
 option: Str('pager', attribute=True, autofill=False, cli_name='pager', multivalue=True, query=True, required=False)
 option: Flag('pkey_only?', autofill=True, default=False)
 option: Str('postalcode', attribute=True, autofill=False, cli_name='postalcode', multivalue=False, query=True, required=False)
+option: Str('preferredlanguage', attribute=True, autofill=False, cli_name='preferredlanguage', multivalue=False, pattern='^[a-zA-Z]{1,8}[-[a-zA-Z]{1,8}]?$', query=True, required=False)
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Int('sizelimit?', autofill=False, minvalue=0)
 option: Str('sn', attribute=True, autofill=False, cli_name='last', multivalue=False, query=True, required=False)
@@ -3914,14 +3922,17 @@ output: ListOfEntries('result', (<type 'list'>, <type 'tuple'>), Gettext('A list
 output: Output('summary', (<type 'unicode'>, <type 'NoneType'>), None)
 output: Output('truncated', <type 'bool'>, None)
 command: user_mod
-args: 1,40,3
+args: 1,44,3
 arg: Str('uid', attribute=True, cli_name='login', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', primary_key=True, query=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
 option: Str('carlicense', attribute=True, autofill=False, cli_name='carlicense', multivalue=False, required=False)
 option: Str('cn', attribute=True, autofill=False, cli_name='cn', multivalue=False, required=False)
 option: Str('delattr*', cli_name='delattr', exclude='webui')
+option: Str('departmentnumber', attribute=True, autofill=False, cli_name='departmentnumber', multivalue=False, required=False)
 option: Str('displayname', attribute=True, autofill=False, cli_name='displayname', multivalue=False, required=False)
+option: Str('employeenumber', attribute=True, autofill=False, cli_name='employeenumber', multivalue=False, required=False)
+option: Str('employeetype', attribute=True, autofill=False, cli_name='employeetype', multivalue=False, required=False)
 option: Str('facsimiletelephonenumber', attribute=True, autofill=False, cli_name='fax', multivalue=True, required=False)
 option: Str('gecos', attribute=True, autofill=False, cli_name='gecos', multivalue=False, required=False)
 option: Int('gidnumber', attribute=True, autofill=False, cli_name='gidnumber', minvalue=1, multivalue=False, required=False)
@@ -3942,6 +3953,7 @@ option: Bool('nsaccountlock', attribute=True, autofill=False, cli_name='nsaccoun
 option: Str('ou', attribute=True, autofill=False, cli_name='orgunit', multivalue=False, required=False)
 option: Str('pager', attribute=True, autofill=False, cli_name='pager', multivalue=True, required=False)
 option: Str('postalcode', attribute=True, autofill=False, cli_name='postalcode', multivalue=False, required=False)
+option: Str('preferredlanguage', attribute=True, autofill=False, cli_name='preferredlanguage', multivalue=False, pattern='^[a-zA-Z]{1,8}[-[a-zA-Z]{1,8}]?$', required=False)
 option: Flag('random', attribute=False, autofill=True, cli_name='random', default=False, multivalue=False, required=False)
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('rename', cli_name='rename', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', primary_key=True, required=False)
diff --git a/VERSION b/VERSION
index 4f01e38c0c3a52ae6293e458fdb4d3e0a14aa8aa..f04949ac855ad90f0cee6c5185ef946112294ec7 100644
--- a/VERSION
+++ b/VERSION
@@ -89,5 +89,5 @@ IPA_DATA_VERSION=20100614120000
 #                                                      #
 ########################################################
 IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=78
-# Last change: pviktori - permission extratargetfilter
+IPA_API_VERSION_MINOR=79
+# Last change: amisnyov - user plugin extend
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 6c5fbac4d68586075ff0c99d37f7eb6e96a8742f..bf86033b995f68232f9a23f8f911d46d38f1903a 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -244,7 +244,11 @@ return {
                             name: 'manager',
                             other_entity: 'user',
                             other_field: 'uid'
-                        }
+                        },
+                        'departmentnumber',
+                        'employeenumber',
+                        'employeetype',
+                        'preferredlanguage'
                     ]
                 },
                 {
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index edda273b24b6d92bb4360a2ff6ec9b05a2a630ca..006bb2f666954d8045a35739430fbe2c05f19118 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -397,6 +397,21 @@ class user(LDAPObject):
             cli_name='radius_username',
             label=_('RADIUS proxy username'),
         ),
+        Str('departmentnumber?',
+            label=_('Department Number'),
+        ),
+        Str('employeenumber?',
+            label=_('Employee ID'),
+        ),
+        Str('employeetype?',
+            label=_('Employee Type'),
+        ),
+        Str('preferredlanguage?',
+            label=_('Preferred Language'),
+            pattern='^[a-zA-Z]{1,8}[-[a-zA-Z]{1,8}]?$',
+            pattern_errmsg='must match according to RFC 2068 - 14.4, ' \
+                + '1 to 8 letters, and optionally a dash and 1 to 8 letters',
+        ),
     )
 
     def _normalize_and_validate_email(self, email, config=None):
-- 
1.8.5.3

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to