From: Rob van der Linde Date: Tue, 27 Feb 2024 01:21:31 +0000 (+1300) Subject: netcmd: models: Add optional base_dn argument to Model.query method X-Git-Tag: tdb-1.4.11~1551 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e70b87513986fbbeae03b73b571f84f0d44eafdc;p=thirdparty%2Fsamba.git netcmd: models: Add optional base_dn argument to Model.query method Signed-off-by: Rob van der Linde Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/domain/models/model.py b/python/samba/netcmd/domain/models/model.py index b4f34ce75e4..a9b10a7b53e 100644 --- a/python/samba/netcmd/domain/models/model.py +++ b/python/samba/netcmd/domain/models/model.py @@ -225,7 +225,7 @@ class Model(metaclass=ModelMeta): return expression @classmethod - def query(cls, ldb, polymorphic=False, **kwargs): + def query(cls, ldb, polymorphic=False, base_dn=None, **kwargs): """Returns a search query for this model. NOTE: If polymorphic is enabled then querying will return instances @@ -237,9 +237,11 @@ class Model(metaclass=ModelMeta): :param ldb: Ldb connection :param polymorphic: If true enables polymorphic querying (see note) + :param base_dn: Optional provide base dn for searching or use the model :param kwargs: Search criteria as keyword args """ - base_dn = cls.get_search_dn(ldb) + if base_dn is None: + base_dn = cls.get_search_dn(ldb) # If the container does not exist produce a friendly error message. try: