[Freeipa-devel] [PATCH] 1013 implement permission/aci find by subtree

Martin Kosek mkosek at redhat.com
Mon May 14 09:04:45 UTC 2012


On Fri, 2012-05-11 at 16:34 -0400, Rob Crittenden wrote:
> permission-find --subtree wasn't implemented so always returned all 
> entries (the option was ignored).
> 
> rob

I found the following 2 issues:

1) The following piece of code is over-complicated:

+                found = False
+                if kw['subtree'] == target:
+                    found = True
+                if not found:
+                    try:
+                        results.remove(a)
+                    except ValueError:
+                        pass

This would simpler and more readable:
+                if kw['subtree'] != target:
+                    try:
+                        results.remove(a)
+                    except ValueError:
+                        pass

2) I know we don't validate the subtree expression, but I wonder if we
shouldn't make the subtree comparing at least case insensitive as DN is
also not case sensitive.

Martin




More information about the Freeipa-devel mailing list