1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

netcmd: models: Add optional base_dn argument to Model.query method

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Rob van der Linde 2024-02-27 14:21:31 +13:00 committed by Andrew Bartlett
parent d961aacdf2
commit e70b875139

View File

@ -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: