-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
|
||
from middlewared.test.integration.assets.pool import dataset | ||
from middlewared.test.integration.utils import call | ||
from middlewared.test.integration.utils.audit import expect_audit_method_calls | ||
|
||
JENNY = 8675309 | ||
|
||
|
||
def test_audit_chown(): | ||
with dataset('audit_chown') as ds: | ||
payload = { | ||
'path': os.path.join('/mnt', ds), | ||
'uid': JENNY | ||
} | ||
|
||
with expect_audit_method_calls([{ | ||
'method': 'filesystem.chown', | ||
'params': [payload], | ||
'description': 'Filesystem change owner' | ||
}]): | ||
call('filesystem.chown', payload, job=True) | ||
|
||
|
||
def test_audit_setperm(): | ||
with dataset('audit_setperm') as ds: | ||
payload = { | ||
'path': os.path.join('/mnt', ds), | ||
'mode': '777' | ||
} | ||
|
||
with expect_audit_method_calls([{ | ||
'method': 'filesystem.setperm', | ||
'params': [payload], | ||
'description': 'Filesystem change permission' | ||
}]): | ||
call('filesystem.setperm', payload, job=True) | ||
|
||
|
||
def test_audit_setacl(): | ||
with dataset('audit_setacl', {'share_type': 'SMB') as ds: | ||
the_acl = call('filesystem.getacl', os.path.join('/mnt', ds))['acl'] | ||
the_acl.append({ | ||
'tag': 'USER', | ||
'id': JENNY, | ||
'perms': {'BASIC': 'FULL_CONTROL'}, | ||
'flags': {'BASIC': 'INHERIT'}, | ||
'type': 'ALLOW' | ||
}) | ||
|
||
payload = { | ||
'path': os.path.join('/mnt', ds), | ||
'dacl': the_acl | ||
} | ||
|
||
with expect_audit_method_calls([{ | ||
'method': 'filesystem.setacl', | ||
'params': [payload], | ||
'description': 'Filesystem set ACL' | ||
}]): | ||
call('filesystem.setacl', payload, job=True) |