From e84dd7a69d6f0ab83ec00c4207186ad189ec7cb9 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 25 Sep 2008 00:58:16 +0000 Subject: 357: Some experimenting with the example plugins --- ipalib/plugins/example.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/example.py b/ipalib/plugins/example.py index 143f9f292..36af33cda 100644 --- a/ipalib/plugins/example.py +++ b/ipalib/plugins/example.py @@ -27,6 +27,26 @@ from ipalib.frontend import Param from ipalib import api +class user(frontend.Object): + 'User object' + takes_params = ( + 'givenname', + 'sn', + Param('uid', + primary_key=True, + default_from=lambda givenname, sn: givenname[0] + sn, + normalize=lambda value: value.lower(), + ), + Param('krbprincipalname', + default_from=lambda uid: '%s@EXAMPLE.COM' % uid, + ), + Param('homedirectory', + default_from=lambda uid: '/home/%s' % uid, + ) + ) +api.register(user) + + # Hypothetical functional commands (not associated with any object): class krbtest(frontend.Command): 'Test your Kerberos ticket.' @@ -130,13 +150,3 @@ api.register(group) class service(frontend.Object): 'Service object' api.register(service) - -class user(frontend.Object): - 'User object' - takes_params = ( - 'givenname', - 'sn', - 'uid', - 'krbprincipalname', - ) -api.register(user) -- cgit