mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
netcmd: Add ‘allow_device_in_sddl’ parameter to SDDLField()
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
7f0f930a42
commit
c5932c4794
@ -315,6 +315,17 @@ class GUIDField(Field):
|
||||
class SDDLField(Field):
|
||||
"""A SDDL field encodes and decodes SDDL data."""
|
||||
|
||||
def __init__(self,
|
||||
name,
|
||||
*,
|
||||
many=False,
|
||||
default=None,
|
||||
hidden=False,
|
||||
allow_device_in_sddl=True):
|
||||
"""Create a new SDDLField."""
|
||||
self.allow_device_in_sddl = allow_device_in_sddl
|
||||
super().__init__(name, many=many, default=default, hidden=hidden)
|
||||
|
||||
def from_db_value(self, ldb, value):
|
||||
if value is None:
|
||||
return
|
||||
@ -330,13 +341,18 @@ class SDDLField(Field):
|
||||
return
|
||||
elif isinstance(value, list):
|
||||
return MessageElement([ndr_pack(security.descriptor.from_sddl(
|
||||
item, domain_sid)) for item in value],
|
||||
item,
|
||||
domain_sid,
|
||||
allow_device_in_sddl=self.allow_device_in_sddl))
|
||||
for item in value],
|
||||
flags,
|
||||
self.name)
|
||||
else:
|
||||
return MessageElement(
|
||||
ndr_pack(security.descriptor.from_sddl(value,
|
||||
domain_sid)),
|
||||
ndr_pack(security.descriptor.from_sddl(
|
||||
value,
|
||||
domain_sid,
|
||||
allow_device_in_sddl=self.allow_device_in_sddl)),
|
||||
flags,
|
||||
self.name
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user