diff options
author | Björn Baumbach <bb@sernet.de> | 2020-07-21 12:34:19 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-12-17 13:59:38 +0000 |
commit | f4e578aa24bc020d87716915ea5037d7677b75e9 (patch) | |
tree | 0c5b6eaf7df702fc0cbc5eb1bcf138f610270074 /python | |
parent | b082cf321e4267cc214f2a74550847585275e25a (diff) | |
download | samba-f4e578aa24bc020d87716915ea5037d7677b75e9.tar.gz |
python/ntacls.py: add SMBHelper.set_acl() helper function
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/ntacls.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/samba/ntacls.py b/python/samba/ntacls.py index b8a7d9b442b..4f189965d05 100644 --- a/python/samba/ntacls.py +++ b/python/samba/ntacls.py @@ -339,6 +339,20 @@ class SMBHelper: return ntacl_sd.as_sddl(self.dom_sid) if as_sddl else ntacl_sd + def set_acl(self, smb_path, ntacl_sd, + sinfo=None, access_mask=None): + assert '/' not in smb_path + + assert(isinstance(ntacl_sd, str) or isinstance(ntacl_sd, security.descriptor)) + if isinstance(ntacl_sd, str): + tmp_desc = security.descriptor.from_sddl(ntacl_sd, self.domain_sid) + elif isinstance(ntacl_sd, security.descriptor): + tmp_desc = ntacl_sd + + self.smb_conn.set_acl(smb_path, tmp_desc, + sinfo=sinfo, + access_mask=access_mask) + def list(self, smb_path=''): """ List file and dir base names in smb_path without recursive. |