2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-31 07:33:30 +00:00

Rename the 'default' policy section to 'preset'

This change tweaks the format of operation policy files, renaming
the 'default' section of each policy to 'preset'. This reinforces
the idea that this section of the policy is used only when group-
based access control is disabled. It also removes any ambiguity
between this section of the policy and the actual 'default'
policy built into the server.
This commit is contained in:
Peter Hamilton
2018-05-17 13:55:50 -04:00
parent c3319afd67
commit 008f86cfa9
7 changed files with 20 additions and 20 deletions

View File

@@ -106,7 +106,7 @@ class TestPolicy(testtools.TestCase):
f.write(
'{"test": {'
'"groups": {"group_A": {"SPLIT_KEY": {"GET": "ALLOW_ALL"}}}, '
'"default": {"SPLIT_KEY": {"GET": "ALLOW_ALL"}}}'
'"preset": {"SPLIT_KEY": {"GET": "ALLOW_ALL"}}}'
'}'
)
@@ -123,7 +123,7 @@ class TestPolicy(testtools.TestCase):
}
}
},
'default': {
'preset': {
enums.ObjectType.SPLIT_KEY: {
enums.Operation.GET: enums.Policy.ALLOW_ALL
}
@@ -166,7 +166,7 @@ class TestPolicy(testtools.TestCase):
def test_read_policy_from_file_default_only(self):
"""
Test that reading a policy file with only a default section works
Test that reading a policy file with only a preset section works
correctly.
"""
policy_file = tempfile.NamedTemporaryFile(
@@ -176,7 +176,7 @@ class TestPolicy(testtools.TestCase):
with open(policy_file.name, 'w') as f:
f.write(
'{"test": '
'{"default": {"SPLIT_KEY": {"GET": "ALLOW_ALL"}}}}'
'{"preset": {"SPLIT_KEY": {"GET": "ALLOW_ALL"}}}}'
)
policies = policy.read_policy_from_file(policy_file.name)
@@ -185,7 +185,7 @@ class TestPolicy(testtools.TestCase):
self.assertIn('test', policies.keys())
expected = {
'default': {
'preset': {
enums.ObjectType.SPLIT_KEY: {
enums.Operation.GET: enums.Policy.ALLOW_ALL
}
@@ -239,7 +239,7 @@ class TestPolicy(testtools.TestCase):
self.assertIn('test', policies.keys())
expected = {
'default': {
'preset': {
enums.ObjectType.CERTIFICATE: {
enums.Operation.LOCATE: enums.Policy.ALLOW_ALL
}