mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Modify the default attributes shown in user-find to match the UI design.
This change means the UI can stop using the --all option and have to retrieve significantly less information from the server. It also speeds up user-find as it doesn't have to calculate membership. This adds a new baseclass parameter, search_display_attributes, which can provide a separate list from default_attributes just for find commands. The UI will need to be changed to switch from using cn to using givenname and sn. ticket 1136
This commit is contained in:
parent
f746121824
commit
d3b0c64fce
@ -256,6 +256,7 @@ class LDAPObject(Object):
|
|||||||
search_attributes = []
|
search_attributes = []
|
||||||
search_attributes_config = None
|
search_attributes_config = None
|
||||||
default_attributes = []
|
default_attributes = []
|
||||||
|
search_display_attributes = [] # attributes displayed in LDAPSearch
|
||||||
hidden_attributes = ['objectclass', 'aci']
|
hidden_attributes = ['objectclass', 'aci']
|
||||||
# set rdn_attribute only if RDN attribute differs from primary key!
|
# set rdn_attribute only if RDN attribute differs from primary key!
|
||||||
rdn_attribute = ''
|
rdn_attribute = ''
|
||||||
@ -1362,11 +1363,15 @@ class LDAPSearch(CallbackInterface, crud.Search):
|
|||||||
|
|
||||||
search_kw = self.args_options_2_entry(**options)
|
search_kw = self.args_options_2_entry(**options)
|
||||||
|
|
||||||
|
if self.obj.search_display_attributes:
|
||||||
|
defattrs = self.obj.search_display_attributes
|
||||||
|
else:
|
||||||
|
defattrs = self.obj.default_attributes
|
||||||
if options.get('all', False):
|
if options.get('all', False):
|
||||||
attrs_list = ['*'] + self.obj.default_attributes
|
attrs_list = ['*'] + defattrs
|
||||||
else:
|
else:
|
||||||
attrs_list = list(
|
attrs_list = list(
|
||||||
set(self.obj.default_attributes + search_kw.keys())
|
set(defattrs + search_kw.keys())
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.obj.search_attributes:
|
if self.obj.search_attributes:
|
||||||
|
@ -86,6 +86,11 @@ class user(LDAPObject):
|
|||||||
'telephonenumber', 'title', 'memberof', 'nsaccountlock',
|
'telephonenumber', 'title', 'memberof', 'nsaccountlock',
|
||||||
'memberofindirect',
|
'memberofindirect',
|
||||||
]
|
]
|
||||||
|
search_display_attributes = [
|
||||||
|
'uid', 'givenname', 'sn', 'homedirectory', 'loginshell',
|
||||||
|
'mail', 'telephonenumber', 'title', 'nsaccountlock',
|
||||||
|
'uidnumber', 'gidnumber',
|
||||||
|
]
|
||||||
uuid_attribute = 'ipauniqueid'
|
uuid_attribute = 'ipauniqueid'
|
||||||
attribute_members = {
|
attribute_members = {
|
||||||
'memberof': ['group', 'netgroup', 'role'],
|
'memberof': ['group', 'netgroup', 'role'],
|
||||||
|
@ -184,8 +184,9 @@ class test_user(Declarative):
|
|||||||
loginshell=[u'/bin/sh'],
|
loginshell=[u'/bin/sh'],
|
||||||
sn=[u'User1'],
|
sn=[u'User1'],
|
||||||
uid=[user1],
|
uid=[user1],
|
||||||
memberof_group=[u'ipausers'],
|
|
||||||
nsaccountlock=[u'False'],
|
nsaccountlock=[u'False'],
|
||||||
|
uidnumber=[fuzzy_digits],
|
||||||
|
gidnumber=[fuzzy_digits],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
summary=u'1 user matched',
|
summary=u'1 user matched',
|
||||||
@ -208,8 +209,9 @@ class test_user(Declarative):
|
|||||||
loginshell=[u'/bin/bash'],
|
loginshell=[u'/bin/bash'],
|
||||||
sn=[u'Administrator'],
|
sn=[u'Administrator'],
|
||||||
uid=[u'admin'],
|
uid=[u'admin'],
|
||||||
memberof_group=[u'admins'],
|
|
||||||
nsaccountlock=[u'False'],
|
nsaccountlock=[u'False'],
|
||||||
|
uidnumber=[fuzzy_digits],
|
||||||
|
gidnumber=[fuzzy_digits],
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||||
@ -218,8 +220,9 @@ class test_user(Declarative):
|
|||||||
loginshell=[u'/bin/sh'],
|
loginshell=[u'/bin/sh'],
|
||||||
sn=[u'User1'],
|
sn=[u'User1'],
|
||||||
uid=[user1],
|
uid=[user1],
|
||||||
memberof_group=[u'ipausers'],
|
|
||||||
nsaccountlock=[u'False'],
|
nsaccountlock=[u'False'],
|
||||||
|
uidnumber=[fuzzy_digits],
|
||||||
|
gidnumber=[fuzzy_digits],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
summary=u'2 users matched',
|
summary=u'2 users matched',
|
||||||
@ -242,8 +245,9 @@ class test_user(Declarative):
|
|||||||
loginshell=[u'/bin/bash'],
|
loginshell=[u'/bin/bash'],
|
||||||
sn=[u'Administrator'],
|
sn=[u'Administrator'],
|
||||||
uid=[u'admin'],
|
uid=[u'admin'],
|
||||||
memberof_group=[u'admins'],
|
|
||||||
nsaccountlock=[u'False'],
|
nsaccountlock=[u'False'],
|
||||||
|
uidnumber=[fuzzy_digits],
|
||||||
|
gidnumber=[fuzzy_digits],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
summary=u'1 user matched',
|
summary=u'1 user matched',
|
||||||
@ -459,7 +463,7 @@ class test_user(Declarative):
|
|||||||
uid=[user2],
|
uid=[user2],
|
||||||
memberof_group=[u'ipausers'],
|
memberof_group=[u'ipausers'],
|
||||||
nsaccountlock=[u'False'],
|
nsaccountlock=[u'False'],
|
||||||
manager=user1,
|
manager=[user1],
|
||||||
),
|
),
|
||||||
summary=u'Modified user "%s"' % user2,
|
summary=u'Modified user "%s"' % user2,
|
||||||
value=user2,
|
value=user2,
|
||||||
|
Loading…
Reference in New Issue
Block a user