From 1fce1487f9ba85aeee36178c4efadbc983b612cc Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 5 Aug 2008 21:28:29 +0000 Subject: 51: Moved old_plugins.py back to plugins.py --- ipalib/old_plugins.py | 136 -------------------------------------------------- ipalib/plugins.py | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++ ipalib/startup.py | 2 +- 3 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 ipalib/old_plugins.py create mode 100644 ipalib/plugins.py diff --git a/ipalib/old_plugins.py b/ipalib/old_plugins.py deleted file mode 100644 index 85f3a9f46..000000000 --- a/ipalib/old_plugins.py +++ /dev/null @@ -1,136 +0,0 @@ -# Authors: -# Jason Gerard DeRose -# -# Copyright (C) 2008 Red Hat -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; version 2 only -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -""" -Some example plugins. -""" - -import crud -import base -from run import api - - -# Hypothetical functional commands (not associated with any object): -class krbtest(base.Command): - def get_doc(self, _): - return _('test your Kerberos ticket') -api.register(krbtest) - -class discover(base.Command): - def get_doc(self, _): - return _('discover IPA servers on network') -api.register(discover) - - -# Register some methods for the 'user' object: -class user__add(crud.Add): - def get_doc(self, _): - return _('add new user') -api.register(user__add) - -class user__del(crud.Del): - def get_doc(self, _): - return _('delete existing user') -api.register(user__del) - -class user__mod(crud.Mod): - def get_doc(self, _): - return _('edit existing user') -api.register(user__mod) - -class user__find(crud.Find): - def get_doc(self, _): - return _('search for users') -api.register(user__find) - - -# Register some properties for the 'user' object: -class user__firstname(base.Property): - pass -api.register(user__firstname) - -class user__lastname(base.Property): - pass -api.register(user__lastname) - -class user__login(base.Property): - pass -api.register(user__login) - - -# Register some methods for the 'group' object: -class group__add(crud.Add): - def get_doc(self, _): - return _('add new group') -api.register(group__add) - -class group__del(crud.Del): - def get_doc(self, _): - return _('delete existing group') -api.register(group__del) - -class group__mod(crud.Mod): - def get_doc(self, _): - return _('exit existing group') -api.register(group__mod) - -class group__find(crud.Find): - def get_doc(self, _): - return _('search for groups') -api.register(group__find) - - -# Register some methods for the 'service' object -class service__add(crud.Add): - def get_doc(self, _): - return _('add new service') -api.register(service__add) - -class service__del(crud.Del): - def get_doc(self, _): - return _('delete existing service') -api.register(service__del) - -class service__mod(crud.Mod): - def get_doc(self, _): - return _('edit existing service') -api.register(service__mod) - -class service__find(crud.Find): - def get_doc(self, _): - return _('search for services') -api.register(service__find) - - -# And to emphasis that the registration order doesn't matter, -# we'll register the objects last: -class group(base.Object): - def get_doc(self, _): - return _('') -api.register(group) - -class service(base.Object): - def get_doc(self, _): - return _('') -api.register(service) - -class user(base.Object): - def get_doc(self, _): - return _('') -api.register(user) diff --git a/ipalib/plugins.py b/ipalib/plugins.py new file mode 100644 index 000000000..85f3a9f46 --- /dev/null +++ b/ipalib/plugins.py @@ -0,0 +1,136 @@ +# Authors: +# Jason Gerard DeRose +# +# Copyright (C) 2008 Red Hat +# see file 'COPYING' for use and warranty information +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 only +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" +Some example plugins. +""" + +import crud +import base +from run import api + + +# Hypothetical functional commands (not associated with any object): +class krbtest(base.Command): + def get_doc(self, _): + return _('test your Kerberos ticket') +api.register(krbtest) + +class discover(base.Command): + def get_doc(self, _): + return _('discover IPA servers on network') +api.register(discover) + + +# Register some methods for the 'user' object: +class user__add(crud.Add): + def get_doc(self, _): + return _('add new user') +api.register(user__add) + +class user__del(crud.Del): + def get_doc(self, _): + return _('delete existing user') +api.register(user__del) + +class user__mod(crud.Mod): + def get_doc(self, _): + return _('edit existing user') +api.register(user__mod) + +class user__find(crud.Find): + def get_doc(self, _): + return _('search for users') +api.register(user__find) + + +# Register some properties for the 'user' object: +class user__firstname(base.Property): + pass +api.register(user__firstname) + +class user__lastname(base.Property): + pass +api.register(user__lastname) + +class user__login(base.Property): + pass +api.register(user__login) + + +# Register some methods for the 'group' object: +class group__add(crud.Add): + def get_doc(self, _): + return _('add new group') +api.register(group__add) + +class group__del(crud.Del): + def get_doc(self, _): + return _('delete existing group') +api.register(group__del) + +class group__mod(crud.Mod): + def get_doc(self, _): + return _('exit existing group') +api.register(group__mod) + +class group__find(crud.Find): + def get_doc(self, _): + return _('search for groups') +api.register(group__find) + + +# Register some methods for the 'service' object +class service__add(crud.Add): + def get_doc(self, _): + return _('add new service') +api.register(service__add) + +class service__del(crud.Del): + def get_doc(self, _): + return _('delete existing service') +api.register(service__del) + +class service__mod(crud.Mod): + def get_doc(self, _): + return _('edit existing service') +api.register(service__mod) + +class service__find(crud.Find): + def get_doc(self, _): + return _('search for services') +api.register(service__find) + + +# And to emphasis that the registration order doesn't matter, +# we'll register the objects last: +class group(base.Object): + def get_doc(self, _): + return _('') +api.register(group) + +class service(base.Object): + def get_doc(self, _): + return _('') +api.register(service) + +class user(base.Object): + def get_doc(self, _): + return _('') +api.register(user) diff --git a/ipalib/startup.py b/ipalib/startup.py index cfeb57b16..edc144054 100644 --- a/ipalib/startup.py +++ b/ipalib/startup.py @@ -28,4 +28,4 @@ unnecessary side effects (needed for unit tests, among other things). from run import api import plugins -api.finalize() +api() -- cgit