Exemple #1
0
def test_has_permissions_exact_missing(test_file):
    result = win_dacl.set_permissions(
        obj_name=str(test_file),
        principal="Backup Operators",
        permissions=["read_data", "write_data"],
        access_mode="grant",
        obj_type="file",
        reset_perms=False,
        protected=None,
    )
    assert result is True

    # Test has_permissions exact
    result = win_dacl.has_permissions(
        obj_name=str(test_file),
        principal="Backup Operators",
        permissions=["read_data", "write_data", "create_folders"],
        access_mode="grant",
        obj_type="file",
        exact=True,
    )
    assert result is False
Exemple #2
0
def test_has_permissions_contains_advanced(test_file):
    result = win_dacl.set_permissions(
        obj_name=str(test_file),
        principal="Backup Operators",
        permissions="full_control",
        access_mode="grant",
        obj_type="file",
        reset_perms=False,
        protected=None,
    )
    assert result is True

    # Test has_permissions exact
    result = win_dacl.has_permissions(
        obj_name=str(test_file),
        principal="Backup Operators",
        permissions=["read_data", "write_data"],
        access_mode="grant",
        obj_type="file",
        exact=False,
    )
    assert result is True