mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #44945 from gtmanfred/2017.7
Fix handling of effective acls
This commit is contained in:
commit
e8e3b3c8ff
2 changed files with 19 additions and 3 deletions
|
@ -144,17 +144,17 @@ def _parse_acl(acl, user, group):
|
|||
# Set the permissions fields
|
||||
octal = 0
|
||||
vals['permissions'] = {}
|
||||
if 'r' in comps[2]:
|
||||
if 'r' in comps[-1]:
|
||||
octal += 4
|
||||
vals['permissions']['read'] = True
|
||||
else:
|
||||
vals['permissions']['read'] = False
|
||||
if 'w' in comps[2]:
|
||||
if 'w' in comps[-1]:
|
||||
octal += 2
|
||||
vals['permissions']['write'] = True
|
||||
else:
|
||||
vals['permissions']['write'] = False
|
||||
if 'x' in comps[2]:
|
||||
if 'x' in comps[-1]:
|
||||
octal += 1
|
||||
vals['permissions']['execute'] = True
|
||||
else:
|
||||
|
|
|
@ -63,6 +63,22 @@ class LinuxAclTestCase(TestCase, LoaderModuleMockMixin):
|
|||
linux_acl.getfacl(*self.files, recursive=True)
|
||||
self.cmdrun.assert_called_once_with('getfacl --absolute-names -R ' + ' '.join(self.quoted_files), python_shell=False)
|
||||
|
||||
def test_getfacl__effective_acls(self):
|
||||
line = 'group:webmaster:r-x #effective:---'
|
||||
user = 'root'
|
||||
group = 'root'
|
||||
expected = {
|
||||
'type': 'acl',
|
||||
'group': 'webmaster',
|
||||
'permissions': {
|
||||
'read': False,
|
||||
'write': False,
|
||||
'execute': False
|
||||
},
|
||||
'octal': 0,
|
||||
}
|
||||
self.assertEqual(linux_acl._parse_acl(line, user, group), expected)
|
||||
|
||||
def test_wipefacls_wo_args(self):
|
||||
self.assertRaises(CommandExecutionError, linux_acl.wipefacls)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue