]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netcmd: add Subnet and Site models
authorRob van der Linde <rob@catalyst.net.nz>
Tue, 4 Jul 2023 09:34:38 +0000 (21:34 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 19 Jul 2023 03:31:30 +0000 (03:31 +0000)
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>
python/samba/netcmd/domain/models/__init__.py
python/samba/netcmd/domain/models/site.py [new file with mode: 0644]
python/samba/netcmd/domain/models/subnet.py [new file with mode: 0644]

index 85acb3e32fe934801975990524f6e5d88799bf42..165f03fe80211bd049390288dc820551036b159e 100644 (file)
@@ -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 (file)
index 0000000..53db6e2
--- /dev/null
@@ -0,0 +1,45 @@
+# Unix SMB/CIFS implementation.
+#
+# Site model.
+#
+# Copyright (C) Catalyst.Net Ltd. 2023
+#
+# Written by Rob van der Linde <rob@catalyst.net.nz>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+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 (file)
index 0000000..6301655
--- /dev/null
@@ -0,0 +1,45 @@
+# Unix SMB/CIFS implementation.
+#
+# Subnet model.
+#
+# Copyright (C) Catalyst.Net Ltd. 2023
+#
+# Written by Rob van der Linde <rob@catalyst.net.nz>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+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"