]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netcmd: models: add a Group model
authorRob van der Linde <rob@catalyst.net.nz>
Tue, 21 Nov 2023 03:00:18 +0000 (16:00 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 22 Nov 2023 23:35:33 +0000 (23:35 +0000)
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain/models/__init__.py
python/samba/netcmd/domain/models/group.py [new file with mode: 0644]

index 165f03fe80211bd049390288dc820551036b159e..8a6b254c70ae81c2388071e48505c57625bae2ea 100644 (file)
@@ -23,6 +23,7 @@
 from .auth_policy import AuthenticationPolicy
 from .auth_silo import AuthenticationSilo
 from .claim_type import ClaimType
+from .group import Group
 from .model import MODELS
 from .schema import AttributeSchema, ClassSchema
 from .site import Site
diff --git a/python/samba/netcmd/domain/models/group.py b/python/samba/netcmd/domain/models/group.py
new file mode 100644 (file)
index 0000000..9473127
--- /dev/null
@@ -0,0 +1,42 @@
+# Unix SMB/CIFS implementation.
+#
+# Group 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, SIDField, StringField
+from .model import Model
+
+
+class Group(Model):
+    admin_count = IntegerField("adminCount")
+    description = StringField("description")
+    is_critical_system_object = BooleanField("isCriticalSystemObject",
+                                             default=False, readonly=True)
+    member = DnField("member", many=True)
+    object_sid = SIDField("objectSid")
+    system_flags = IntegerField("systemFlags")
+
+    @staticmethod
+    def get_object_class():
+        return "group"
+
+    def get_authentication_sddl(self):
+        return "O:SYG:SYD:(XA;OICI;CR;;;WD;(Member_of_any {SID(%s)}))" % (
+            self.object_sid)