|
|
b3b562 |
From fef36da6e8d5f6f057a80c7b9bca0eae2ed2c367 Mon Sep 17 00:00:00 2001
|
|
|
b3b562 |
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
b3b562 |
Date: Thu, 9 Jun 2022 18:29:59 +0300
|
|
|
b3b562 |
Subject: [PATCH] idviews: use cached ipaOriginalUid value when resolving ID
|
|
|
b3b562 |
override anchor
|
|
|
b3b562 |
|
|
|
b3b562 |
For ID overrides 'ipaOriginalUid' value should be the human-readable
|
|
|
b3b562 |
version of the ID override anchor. Since we would have it already set in
|
|
|
b3b562 |
the ID override entry, prefer using it instead of looking up the
|
|
|
b3b562 |
override anchor.
|
|
|
b3b562 |
|
|
|
b3b562 |
This should speed up significantly operations which list all ID
|
|
|
b3b562 |
overrides in the view, like Web UI views.
|
|
|
b3b562 |
|
|
|
b3b562 |
Fixes: https://pagure.io/freeipa/issue/9178
|
|
|
b3b562 |
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
b3b562 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
b3b562 |
---
|
|
|
b3b562 |
ipaserver/plugins/idviews.py | 8 ++++++--
|
|
|
b3b562 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
b3b562 |
|
|
|
b3b562 |
diff --git a/ipaserver/plugins/idviews.py b/ipaserver/plugins/idviews.py
|
|
|
b3b562 |
index 018c1f6056f514c5c99e6b47c7d78c2c7165bf55..7dc298a14ec7d7cce85f631e00675fea93800493 100644
|
|
|
b3b562 |
--- a/ipaserver/plugins/idviews.py
|
|
|
b3b562 |
+++ b/ipaserver/plugins/idviews.py
|
|
|
b3b562 |
@@ -746,8 +746,12 @@ class baseidoverride(LDAPObject):
|
|
|
b3b562 |
|
|
|
b3b562 |
def convert_anchor_to_human_readable_form(self, entry_attrs, **options):
|
|
|
b3b562 |
if not options.get('raw'):
|
|
|
b3b562 |
- anchor = entry_attrs.single_value['ipaanchoruuid']
|
|
|
b3b562 |
+ if 'ipaoriginaluid' in entry_attrs:
|
|
|
b3b562 |
+ originaluid = entry_attrs.single_value['ipaoriginaluid']
|
|
|
b3b562 |
+ entry_attrs.single_value['ipaanchoruuid'] = originaluid
|
|
|
b3b562 |
+ return
|
|
|
b3b562 |
|
|
|
b3b562 |
+ anchor = entry_attrs.single_value['ipaanchoruuid']
|
|
|
b3b562 |
if anchor:
|
|
|
b3b562 |
try:
|
|
|
b3b562 |
object_name = resolve_anchor_to_object_name(
|
|
|
b3b562 |
@@ -991,7 +995,7 @@ class idoverrideuser(baseidoverride):
|
|
|
b3b562 |
original_uid = resolve_anchor_to_object_name(self.backend,
|
|
|
b3b562 |
self.override_object,
|
|
|
b3b562 |
anchor)
|
|
|
b3b562 |
- entry_attrs['ipaOriginalUid'] = original_uid
|
|
|
b3b562 |
+ entry_attrs['ipaoriginaluid'] = original_uid
|
|
|
b3b562 |
|
|
|
b3b562 |
except (errors.NotFound, errors.ValidationError):
|
|
|
b3b562 |
# Anchor could not be resolved, this means we had to specify the
|
|
|
b3b562 |
--
|
|
|
b3b562 |
2.37.3
|
|
|
b3b562 |
|