2008-07-19 21:03:15 -05:00
|
|
|
# Authors:
|
|
|
|
# Jason Gerard DeRose <jderose@redhat.com>
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
"""
|
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
import public
|
2008-07-19 21:03:15 -05:00
|
|
|
from run import api
|
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
|
2008-07-20 20:44:59 -05:00
|
|
|
# Hypothetical functional commands (not associated with any object):
|
2008-08-05 17:21:57 -05:00
|
|
|
class krbtest(public.cmd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('test your Kerberos ticket')
|
2008-07-20 20:44:59 -05:00
|
|
|
api.register(krbtest)
|
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class discover(public.cmd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('discover IPA servers on network')
|
2008-07-20 20:44:59 -05:00
|
|
|
api.register(discover)
|
|
|
|
|
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
# Register some methods for the 'user' object:
|
2008-08-05 17:21:57 -05:00
|
|
|
class user_add(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('add new user')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(user_add)
|
2008-07-19 21:03:15 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class user_del(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('delete existing user')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(user_del)
|
2008-07-19 21:03:15 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class user_mod(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('edit existing user')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(user_mod)
|
2008-07-19 21:03:15 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class user_find(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('search for users')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(user_find)
|
2008-07-19 21:03:15 -05:00
|
|
|
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
# Register some properties for the 'user' object:
|
2008-08-11 21:03:47 -05:00
|
|
|
class user_givenname(public.prop):
|
|
|
|
def get_doc(self, _):
|
|
|
|
return _('user first name')
|
|
|
|
api.register(user_givenname)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-11 21:03:47 -05:00
|
|
|
class user_sn(public.prop):
|
|
|
|
def get_doc(self, _):
|
|
|
|
return _('user last name')
|
|
|
|
api.register(user_sn)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class user_login(public.prop):
|
2008-08-11 21:03:47 -05:00
|
|
|
def get_doc(self, _):
|
|
|
|
return _('user login')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(user_login)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
# Register some methods for the 'group' object:
|
2008-08-05 17:21:57 -05:00
|
|
|
class group_add(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('add new group')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(group_add)
|
2008-07-20 18:43:16 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class group_del(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('delete existing group')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(group_del)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class group_mod(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('edit existing group')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(group_mod)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class group_find(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('search for groups')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(group_find)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
# Register some methods for the 'service' object
|
2008-08-05 17:21:57 -05:00
|
|
|
class service_add(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('add new service')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(service_add)
|
2008-07-20 18:43:16 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class service_del(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('delete existing service')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(service_del)
|
2008-07-20 18:43:16 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class service_mod(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('edit existing service')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(service_mod)
|
2008-07-20 18:43:16 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class service_find(public.mthd):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('search for services')
|
2008-08-05 17:21:57 -05:00
|
|
|
api.register(service_find)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
|
|
|
|
2008-07-20 18:43:16 -05:00
|
|
|
# And to emphasis that the registration order doesn't matter,
|
|
|
|
# we'll register the objects last:
|
2008-08-05 17:21:57 -05:00
|
|
|
class group(public.obj):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('')
|
2008-07-20 18:43:16 -05:00
|
|
|
api.register(group)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class service(public.obj):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('')
|
2008-07-20 18:43:16 -05:00
|
|
|
api.register(service)
|
2008-07-20 13:36:02 -05:00
|
|
|
|
2008-08-05 17:21:57 -05:00
|
|
|
class user(public.obj):
|
2008-08-08 12:11:29 -05:00
|
|
|
def get_doc(self, _):
|
2008-08-08 16:40:03 -05:00
|
|
|
return _('')
|
2008-07-20 18:43:16 -05:00
|
|
|
api.register(user)
|