2009-05-13 07:21:30 -05:00
|
|
|
# Authors:
|
|
|
|
# Rob Crittenden <rcritten@redhat.com>
|
|
|
|
# Pavel Zuna <pzuna@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
|
|
|
|
"""
|
2009-06-16 09:51:44 -05:00
|
|
|
IPA configuration
|
2009-05-13 07:21:30 -05:00
|
|
|
"""
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
from ipalib import api
|
2009-11-30 05:10:06 -06:00
|
|
|
from ipalib import Bool, Int, Str
|
2009-08-27 08:49:58 -05:00
|
|
|
from ipalib.plugins.baseldap import *
|
2010-02-19 10:08:16 -06:00
|
|
|
from ipalib import _
|
2009-05-13 07:21:30 -05:00
|
|
|
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
class config(LDAPObject):
|
2009-05-13 07:21:30 -05:00
|
|
|
"""
|
2009-08-27 08:49:58 -05:00
|
|
|
IPA configuration object
|
2009-05-13 07:21:30 -05:00
|
|
|
"""
|
2009-08-27 08:49:58 -05:00
|
|
|
object_name = 'configuration options'
|
|
|
|
default_attributes = [
|
|
|
|
'ipamaxusernamelength', 'ipahomesrootdir', 'ipadefaultloginshell',
|
|
|
|
'ipadefaultprimarygroup', 'ipadefaultdomain', 'ipasearchtimelimit',
|
|
|
|
'ipasearchrecordslimit', 'ipausersearchfields', 'ipagroupsearchfields',
|
2010-01-20 10:26:20 -06:00
|
|
|
'ipamigrationenabled', 'ipacertificatesubjectbase',
|
2009-08-27 08:49:58 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
takes_params = (
|
2009-05-13 07:21:30 -05:00
|
|
|
Int('ipamaxusernamelength?',
|
|
|
|
cli_name='maxusername',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Max username length'),
|
2009-05-13 07:21:30 -05:00
|
|
|
minvalue=1,
|
|
|
|
),
|
|
|
|
Str('ipahomesrootdir?',
|
|
|
|
cli_name='homedirectory',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Home directory base'),
|
|
|
|
doc=_('Default location of home directories'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
|
|
|
Str('ipadefaultloginshell?',
|
|
|
|
cli_name='defaultshell',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Default shell'),
|
|
|
|
doc=_('Default shell for new users'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
|
|
|
Str('ipadefaultprimarygroup?',
|
|
|
|
cli_name='defaultgroup',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Default users group'),
|
|
|
|
doc=_('Default group for new users'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
|
|
|
Str('ipadefaultemaildomain?',
|
|
|
|
cli_name='emaildomain',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Default e-mail domain'),
|
|
|
|
doc=_('Default e-mail domain new users'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
|
|
|
Int('ipasearchtimelimit?',
|
|
|
|
cli_name='searchtimelimit',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Search time limit'),
|
|
|
|
doc=_('Max. amount of time (sec.) for a search (-1 is unlimited)'),
|
2009-05-13 07:21:30 -05:00
|
|
|
minvalue=-1,
|
|
|
|
),
|
|
|
|
Int('ipasearchrecordslimit?',
|
|
|
|
cli_name='searchrecordslimit',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Search size limit'),
|
|
|
|
doc=_('Max. number of records to search (-1 is unlimited)'),
|
2009-05-13 07:21:30 -05:00
|
|
|
minvalue=-1,
|
|
|
|
),
|
|
|
|
Str('ipausersearchfields?',
|
|
|
|
cli_name='usersearch',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('User search fields'),
|
|
|
|
doc=_('A comma-separated list of fields to search when searching for users'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
|
|
|
Str('ipagroupsearchfields?',
|
|
|
|
cli_name='groupsearch',
|
2010-01-20 10:26:20 -06:00
|
|
|
label='Group search fields',
|
2010-03-05 15:11:21 -06:00
|
|
|
doc=_('A comma-separated list of fields to search when searching for groups'),
|
2009-05-13 07:21:30 -05:00
|
|
|
),
|
2009-11-30 05:10:06 -06:00
|
|
|
Bool('ipamigrationenabled?',
|
|
|
|
cli_name='enable_migration',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Migration mode'),
|
|
|
|
doc=_('Enabled migration mode'),
|
2009-11-30 05:10:06 -06:00
|
|
|
),
|
2010-01-20 10:26:20 -06:00
|
|
|
Str('ipacertificatesubjectbase?',
|
|
|
|
cli_name='subject',
|
2010-02-19 10:08:16 -06:00
|
|
|
label=_('Certificate Subject base'),
|
|
|
|
doc=_('base for certificate subjects (OU=Test,O=Example)'),
|
2010-01-20 10:26:20 -06:00
|
|
|
),
|
2009-05-13 07:21:30 -05:00
|
|
|
)
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
def get_dn(self, *keys, **kwargs):
|
|
|
|
return 'cn=ipaconfig,cn=etc'
|
2009-05-13 07:21:30 -05:00
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
api.register(config)
|
2009-05-13 07:21:30 -05:00
|
|
|
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
class config_mod(LDAPUpdate):
|
|
|
|
"""
|
|
|
|
Modify configuration options.
|
|
|
|
"""
|
2009-11-30 05:10:06 -06:00
|
|
|
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
|
|
|
|
if 'ipamigrationenabled' in entry_attrs:
|
|
|
|
if entry_attrs['ipamigrationenabled']:
|
|
|
|
entry_attrs['ipamigrationenabled'] = 'TRUE'
|
|
|
|
else:
|
|
|
|
entry_attrs['ipamigrationenabled'] = 'FALSE'
|
|
|
|
return dn
|
2009-05-13 07:21:30 -05:00
|
|
|
|
2009-07-02 02:50:48 -05:00
|
|
|
api.register(config_mod)
|
2009-05-13 07:21:30 -05:00
|
|
|
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
class config_show(LDAPRetrieve):
|
2009-05-13 07:21:30 -05:00
|
|
|
"""
|
2009-08-27 08:49:58 -05:00
|
|
|
Display configuration options.
|
2009-05-13 07:21:30 -05:00
|
|
|
"""
|
|
|
|
|
2009-08-27 08:49:58 -05:00
|
|
|
api.register(config_show)
|