From: Rob van der Linde Date: Tue, 4 Jul 2023 09:34:38 +0000 (+1200) Subject: netcmd: add Subnet and Site models X-Git-Tag: talloc-2.4.1~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9d01c6420760e65012af8beaf46f2bfb5a7b33e;p=thirdparty%2Fsamba.git netcmd: add Subnet and Site models Signed-off-by: Rob van der Linde Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/domain/models/__init__.py b/python/samba/netcmd/domain/models/__init__.py index 85acb3e32fe..165f03fe802 100644 --- a/python/samba/netcmd/domain/models/__init__.py +++ b/python/samba/netcmd/domain/models/__init__.py @@ -25,5 +25,7 @@ from .auth_silo import AuthenticationSilo from .claim_type import ClaimType from .model import MODELS from .schema import AttributeSchema, ClassSchema +from .site import Site +from .subnet import Subnet from .user import User from .value_type import ValueType diff --git a/python/samba/netcmd/domain/models/site.py b/python/samba/netcmd/domain/models/site.py new file mode 100644 index 00000000000..53db6e2c3b1 --- /dev/null +++ b/python/samba/netcmd/domain/models/site.py @@ -0,0 +1,45 @@ +# Unix SMB/CIFS implementation. +# +# Site model. +# +# Copyright (C) Catalyst.Net Ltd. 2023 +# +# Written by Rob van der Linde +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +from .fields import BooleanField, DnField, IntegerField +from .model import Model + + +class Site(Model): + show_in_advanced_view_only = BooleanField("showInAdvancedViewOnly") + site_object_bl = DnField("siteObjectBL") + system_flags = IntegerField("systemFlags") + + @staticmethod + def get_base_dn(ldb): + """Return the base DN for the Site model. + + :param ldb: Ldb connection + :return: Dn to use for new objects + """ + base_dn = ldb.get_config_basedn() + base_dn.add_child("CN=Sites") + return base_dn + + @staticmethod + def get_object_class(): + return "site" diff --git a/python/samba/netcmd/domain/models/subnet.py b/python/samba/netcmd/domain/models/subnet.py new file mode 100644 index 00000000000..6301655d8d3 --- /dev/null +++ b/python/samba/netcmd/domain/models/subnet.py @@ -0,0 +1,45 @@ +# Unix SMB/CIFS implementation. +# +# Subnet model. +# +# Copyright (C) Catalyst.Net Ltd. 2023 +# +# Written by Rob van der Linde +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +from .fields import BooleanField, DnField, IntegerField +from .model import Model + + +class Subnet(Model): + show_in_advanced_view_only = BooleanField("showInAdvancedViewOnly") + site_object = DnField("siteObject") + system_flags = IntegerField("systemFlags") + + @staticmethod + def get_base_dn(ldb): + """Return the base DN for the Subnet model. + + :param ldb: Ldb connection + :return: Dn to use for new objects + """ + base_dn = ldb.get_config_basedn() + base_dn.add_child("CN=Subnets,CN=Sites") + return base_dn + + @staticmethod + def get_object_class(): + return "subnet"