summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2010-02-25 14:19:56 +0100
committerRob Crittenden <rcritten@redhat.com>2010-03-01 16:53:30 -0500
commit41312ca166f5192b6e6c507225e4333206d6b5c2 (patch)
tree9d93678bcc83647ba333fa08def368668a142bfd /ipalib
parent9873ec1ca3795bdcaafe4350012cd552f8406647 (diff)
downloadfreeipa-41312ca166f5192b6e6c507225e4333206d6b5c2.tar.gz
freeipa-41312ca166f5192b6e6c507225e4333206d6b5c2.tar.xz
freeipa-41312ca166f5192b6e6c507225e4333206d6b5c2.zip
Code cleanup: remove unused stuff, take 1.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/automount.py11
-rw-r--r--ipalib/plugins/baseldap.py117
-rw-r--r--ipalib/plugins/config.py13
-rw-r--r--ipalib/plugins/group.py10
-rw-r--r--ipalib/plugins/hbac.py14
-rw-r--r--ipalib/plugins/host.py16
-rw-r--r--ipalib/plugins/hostgroup.py6
-rw-r--r--ipalib/plugins/krbtpolicy.py4
-rw-r--r--ipalib/plugins/netgroup.py10
-rw-r--r--ipalib/plugins/rolegroup.py8
-rw-r--r--ipalib/plugins/service.py6
-rw-r--r--ipalib/plugins/taskgroup.py7
-rw-r--r--ipalib/plugins/user.py35
13 files changed, 12 insertions, 245 deletions
diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index 71a21824f..5c9591473 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -100,9 +100,6 @@ class automountlocation(LDAPObject):
object_name_plural = 'automount locations'
object_class = ['nscontainer']
default_attributes = ['cn']
- attribute_names = {
- 'cn': 'name',
- }
takes_params = (
Str('cn',
@@ -220,9 +217,6 @@ class automountmap(LDAPObject):
object_name_plural = 'automount maps'
object_class = ['automountmap']
default_attributes = ['automountmapname', 'description']
- attribute_names = {
- 'automountmapname': 'name',
- }
takes_params = (
Str('automountmapname',
@@ -305,11 +299,6 @@ class automountkey(LDAPObject):
default_attributes = [
'automountkey', 'automountinformation', 'description'
]
- attribute_names = {
- 'automountkey': 'key',
- 'automountinformation': 'mount information',
- }
- attribute_order = ['automountkey', 'automountinformation']
takes_params = (
Str('automountkey',
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index bd7cb18a0..2266d851c 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -69,8 +69,6 @@ class LDAPObject(Object):
default_attributes = []
hidden_attributes = ['objectclass', 'aci']
uuid_attribute = ''
- attribute_names = {}
- attribute_order = []
attribute_members = {}
def get_dn(self, *keys, **kwargs):
@@ -109,26 +107,6 @@ class LDAPObject(Object):
)
del entry_attrs[attr]
- def print_entry(self, textui, entry, *keys, **options):
- if options.get('raw', False):
- textui.print_attribute('dn', entry[0])
- textui.print_entry1(entry[1], attr_order=self.attribute_order)
- else:
- if self.primary_key and keys[-1] is not None:
- textui.print_attribute(
- self.object_name.capitalize(), keys[-1], indent=0
- )
- else:
- textui.print_plain(self.object_name.capitalize())
- entry_attrs = entry[1]
- for a in self.hidden_attributes:
- if a in entry_attrs:
- del entry_attrs[a]
- textui.print_entry1(
- entry_attrs, attr_map=self.attribute_names,
- attr_order=self.attribute_order, one_value_per_line=False
- )
-
# Options used by create and update.
_attr_options = (
@@ -197,24 +175,6 @@ class LDAPCreate(crud.Create):
return dict(result=entry_attrs, value=keys[-1])
return dict(result=entry_attrs, value=u'')
- def dont_output_for_cli(self, textui, entry, *keys, **options):
- textui.print_name(self.name)
- self.obj.print_entry(textui, entry, *keys, **options)
- if len(keys) > 1:
- textui.print_dashed(
- 'Created %s "%s" in %s "%s".' % (
- self.obj.object_name, keys[-1],
- self.api.Object[self.obj.parent_object].object_name,
- keys[-2]
- )
- )
- elif len(keys) == 1:
- textui.print_dashed(
- 'Created %s "%s".' % (self.obj.object_name, keys[-1])
- )
- else:
- textui.print_dashed('Created %s.' % self.obj.object_name)
-
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
return dn
@@ -261,10 +221,6 @@ class LDAPRetrieve(LDAPQuery):
return dict(result=entry_attrs, value=keys[-1])
return dict(result=entry_attrs, value=u'')
- def dont_output_for_cli(self, textui, entry, *keys, **options):
- textui.print_name(self.name)
- self.obj.print_entry(textui, entry, *keys, **options)
-
def pre_callback(self, ldap, dn, attrs_list, *keys, **options):
return dn
@@ -327,24 +283,6 @@ class LDAPUpdate(LDAPQuery, crud.Update):
return dict(result=entry_attrs, value=keys[-1])
return dict(result=entry_attrs, value=u'')
- def dont_output_for_cli(self, textui, entry, *keys, **options):
- textui.print_name(self.name)
- self.obj.print_entry(textui, entry, *keys, **options)
- if len(keys) > 1:
- textui.print_dashed(
- 'Modified %s "%s" in %s "%s".' % (
- self.obj.object_name, keys[-1],
- self.api.Object[self.obj.parent_object].object_name,
- keys[-2]
- )
- )
- elif len(keys) == 1:
- textui.print_dashed(
- 'Modified %s "%s".' % (self.obj.object_name, keys[-1])
- )
- else:
- textui.print_dashed('Modified %s.' % self.obj.object_name)
-
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
return dn
@@ -387,23 +325,6 @@ class LDAPDelete(LDAPQuery):
return dict(result=result, value=keys[-1])
return dict(result=result, value=u'')
- def dont_output_for_cli(self, textui, result, *keys, **options):
- textui.print_name(self.name)
- if len(keys) > 1:
- textui.print_dashed(
- 'Deleted %s "%s" in %s "%s".' % (
- self.obj.object_name, keys[-1],
- self.api.Object[self.obj.parent_object].object_name,
- keys[-2]
- )
- )
- elif len(keys) == 1:
- textui.print_dashed(
- 'Deleted %s "%s".' % (self.obj.object_name, keys[-1])
- )
- else:
- textui.print_dashed('Deleted %s.' % self.obj.object_name)
-
def pre_callback(self, ldap, dn, *keys, **options):
return dn
@@ -448,23 +369,6 @@ class LDAPModMember(LDAPQuery):
failed[attr][ldap_obj_name].append(name)
return (dns, failed)
- def dont_output_for_cli(self, textui, result, *keys, **options):
- (completed, failed, entry) = result
-
- for (attr, objs) in failed.iteritems():
- for ldap_obj_name in objs:
- if failed[attr][ldap_obj_name]:
- failed_string = ','.join(failed[attr][ldap_obj_name])
- textui.print_plain('%ss failed: %s' % (
- to_cli(ldap_obj_name), failed_string
- )
- )
- textui.print_name(self.name)
- self.obj.print_entry(textui, entry, *keys, **options)
- textui.print_count(
- completed, self.member_count_out[0], self.member_count_out[1]
- )
-
class LDAPAddMember(LDAPModMember):
"""
@@ -681,27 +585,6 @@ class LDAPSearch(crud.Search):
truncated=truncated,
)
- def dont_output_for_cli(self, textui, result, *args, **options):
- (entries, truncated) = result
-
- textui.print_name(self.name)
- for e in entries:
- self.obj.print_entry(textui, e, e[0], **options)
- textui.print_plain('')
- textui.print_count(
- len(entries),
- '%i ' + self.obj.object_name + ' matched.',
- '%i ' + self.obj.object_name_plural + ' matched.',
- )
- if truncated:
- textui.print_dashed('These results are truncated.', below=False)
- textui.print_dashed(
- 'Please refine your search and try again.', above=False
- )
- elif len(entries) == 0:
- # nothing was found, return error code 1
- return 1
-
def pre_callback(self, ldap, filter, attrs_list, base_dn, *args, **options):
return filter
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index b49dba8f6..31e29f573 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -38,19 +38,6 @@ class config(LDAPObject):
'ipasearchrecordslimit', 'ipausersearchfields', 'ipagroupsearchfields',
'ipamigrationenabled', 'ipacertificatesubjectbase',
]
- attribute_names = {
- 'ipamaxusernamelength': 'maximum username length',
- 'ipahomesrootdir': 'root of home directories',
- 'ipadefaultloginshell': 'default login shell',
- 'ipadefaultprimarygroup': 'default primary group',
- 'ipadefaultdomain': 'default e-mail domain',
- 'ipasearchtimelimit': 'time limit for search queries',
- 'ipasearchrecordslimit': 'result count limit for search queries',
- 'ipausersearchfields': 'search fields for users',
- 'ipagroupsearchfields': 'search fields for groups',
- 'ipamigrationenabled': 'enable migration mode',
- 'ipacertificatesubjectbase': 'base for certificate subjects',
- }
takes_params = (
Int('ipamaxusernamelength?',
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 896e26e68..14b73cea8 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -40,16 +40,6 @@ class group(LDAPObject):
'cn', 'description', 'gidnumber', 'member', 'memberof'
]
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'cn': 'name',
- 'gidnumber': 'group id',
- 'member_user': 'member users',
- 'member_group': 'member groups',
- 'memberof_group': 'member of groups',
- 'memberof_netgroup': 'member of netgroups',
- 'memberof_rolegroup': 'member of rolegroup',
- 'memberof_taskgroup': 'member of taskgroup',
- }
attribute_members = {
'member': ['user', 'group'],
'memberof': ['group', 'netgroup', 'rolegroup', 'taskgroup'],
diff --git a/ipalib/plugins/hbac.py b/ipalib/plugins/hbac.py
index 7fbabdc70..b8dacc822 100644
--- a/ipalib/plugins/hbac.py
+++ b/ipalib/plugins/hbac.py
@@ -39,20 +39,6 @@ class hbac(LDAPObject):
]
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'cn': 'name',
- 'accessruletype': 'type',
- 'ipaenabledflag': 'enabled',
- 'servicename': 'service',
- 'ipauniqueid': 'unique id',
- 'memberuser user': 'affected users',
- 'memberuser group': 'affected groups',
- 'memberhost host': 'affected hosts',
- 'memberhost hostgroup': 'affected hostgroups',
- 'sourcehost host': 'affected source hosts',
- 'sourcehost hostgroup': 'affected source hostgroups',
- }
- attribute_order = ['cn', 'accessruletype', 'ipaenabledflag', 'servicename']
attribute_members = {
'memberuser': ['user', 'group'],
'memberhost': ['host', 'hostgroup'],
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 897d25bbe..d72f53051 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -58,22 +58,6 @@ class host(LDAPObject):
'nshardwareplatform', 'nsosversion', 'usercertificate', 'memberof',
]
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'cn': 'name',
- 'fqdn': 'hostname',
- 'localityname': 'locality',
- 'l': 'locality',
- 'nshostlocation': 'location',
- 'nshardwareplatform': 'platform',
- 'nsosversion': 'operating system',
- 'serverhostname': 'server hostname',
- 'enrolledby user': 'enrolled by',
- 'krbprincipalname': 'kerberos principal',
- 'ipauniqueid': 'unique identifier',
- 'memberof_hostgroup': 'member of hostgroups',
- 'memberof_netgroup': 'member of netgroups',
- 'memberof_rolegroup': 'member of rolegroups',
- }
attribute_members = {
'enrolledby': ['user'],
'memberof': ['hostgroup', 'netgroup', 'rolegroup'],
diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py
index 698b39540..f233e2869 100644
--- a/ipalib/plugins/hostgroup.py
+++ b/ipalib/plugins/hostgroup.py
@@ -35,12 +35,6 @@ class hostgroup(LDAPObject):
object_class = ['ipaobject', 'ipahostgroup']
default_attributes = ['cn', 'description', 'member', 'memberof']
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'cn': 'names',
- 'member_host': 'member hosts',
- 'member_hostgroup': 'member hostgroups',
- 'memberof_hostgroup': 'member of hostgroup',
- }
attribute_members = {
'member': ['host', 'hostgroup'],
'memberof': ['hostgroup'],
diff --git a/ipalib/plugins/krbtpolicy.py b/ipalib/plugins/krbtpolicy.py
index ada7eff16..3f9eeee68 100644
--- a/ipalib/plugins/krbtpolicy.py
+++ b/ipalib/plugins/krbtpolicy.py
@@ -40,10 +40,6 @@ class krbtpolicy(LDAPObject):
container_dn = 'cn=%s,cn=kerberos' % api.env.realm
object_name = 'kerberos ticket policy settings'
default_attributes = ['krbmaxticketlife', 'krbmaxrenewableage']
- attribute_names = {
- 'krbmaxticketlife': 'maximum life',
- 'krbmaxrenewableage': 'maximum renewable age',
- }
takes_params = (
Str('uid?',
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index aeee81d2f..124b860e3 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -39,16 +39,6 @@ class netgroup(LDAPObject):
'nisdomainname',
]
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'cn': 'name',
- 'member_user': 'member users',
- 'member_group': 'member groups',
- 'member_host': 'member hosts',
- 'member_hostgroup': 'member hostgroups',
- 'member_netgroup': 'member netgroups',
- 'memberof_netgroup': 'member of netgroups',
- 'externalhost': 'externalhost',
- }
attribute_members = {
'member': ['user', 'group', 'host', 'hostgroup', 'netgroup'],
'memberof': ['netgroup'],
diff --git a/ipalib/plugins/rolegroup.py b/ipalib/plugins/rolegroup.py
index 112999fdb..7038e904b 100644
--- a/ipalib/plugins/rolegroup.py
+++ b/ipalib/plugins/rolegroup.py
@@ -34,14 +34,6 @@ class rolegroup(LDAPObject):
object_name_plural = 'rolegroups'
object_class = ['groupofnames', 'nestedgroup']
default_attributes = ['cn', 'description', 'member', 'memberof']
- attribute_names = {
- 'cn': 'name',
- 'member_user': 'member users',
- 'member_group': 'member groups',
- 'member_host': 'member hosts',
- 'member_hostgroup': 'member hostgroups',
- 'memberof_taskgroup': 'member of taskgroup',
- }
attribute_members = {
'member': ['user', 'group', 'host', 'hostgroup'],
'memberof': ['taskgroup'],
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index b8312ba55..36988bd32 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -109,12 +109,6 @@ class service(LDAPObject):
]
default_attributes = ['krbprincipalname', 'usercertificate', 'managedby']
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'krbprincipalname': 'kerberos principal',
- 'usercertificate': 'user certificate',
- 'ipauniqueid': 'unique identifier',
- 'managedby': 'managed by',
- }
attribute_members = {
'managedby': ['host'],
}
diff --git a/ipalib/plugins/taskgroup.py b/ipalib/plugins/taskgroup.py
index 0927c3d19..a7360c352 100644
--- a/ipalib/plugins/taskgroup.py
+++ b/ipalib/plugins/taskgroup.py
@@ -35,13 +35,6 @@ class taskgroup(LDAPObject):
object_name_plural = 'taskgroups'
object_class = ['groupofnames']
default_attributes = ['cn', 'description', 'member', 'memberof']
- attribute_names = {
- 'cn': 'name',
- 'member_user': 'member users',
- 'member_group': 'member groups',
- 'member_rolegroup': 'member rolegroups',
- # FIXME: 'memberof ???': 'member of ???'
- }
attribute_members = {
'member': ['user', 'group', 'rolegroup'],
# FIXME: taskgroup can be member of ???
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 2b5c76ca2..06524a2b6 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -41,29 +41,6 @@ class user(LDAPObject):
'telephonenumber', 'title', 'memberof',
]
uuid_attribute = 'ipauniqueid'
- attribute_names = {
- 'uid': 'user id',
- 'cn': 'full name',
- 'givenname': 'first name',
- 'sn': 'last name',
- 'homedirectory': 'home directory',
- 'loginshell': 'login shell',
- 'krbprincipalname': 'kerberos principal',
- 'krblastpwdchange': 'last password change',
- 'krbpasswordexpiration': 'password expiration',
- 'uidnumber': 'uid number',
- 'gidnumber': 'gid number',
- 'memberof_group': 'member of groups',
- 'memberof_netgroup': 'member of netgroups',
- 'memberof_rolegroup': 'member of rolegroups',
- 'memberof_taskgroup': 'member of taskgroups',
- 'ipauniqueid': 'unique identifier'
- }
- attribute_order = [
- 'uid', 'cn', 'givenname', 'sn', 'title', 'telephonenumber', 'ou',
- 'homedirectory', 'loginshell', 'uidnumber', 'gidnumber', 'gecos',
- 'krbprincipalname', 'krblastpwdchange', 'krbpasswordexpiration',
- ]
attribute_members = {
'memberof': ['group', 'netgroup', 'rolegroup', 'taskgroup'],
}
@@ -132,6 +109,18 @@ class user(LDAPObject):
label=_('Groups'),
flags=['no_create', 'no_update', 'no_search'],
),
+ Str('memberof_netgroup?',
+ label=_('Netgroups'),
+ flags=['no_create', 'no_update', 'no_search'],
+ ),
+ Str('memberof_rolegroup?',
+ label=_('Rolegroups'),
+ flags=['no_create', 'no_update', 'no_search'],
+ ),
+ Str('memberof_taskgroup?',
+ label=_('Taskgroups'),
+ flags=['no_create', 'no_update', 'no_search'],
+ ),
)
api.register(user)