2
0
mirror of https://github.com/openkmip/pykmip synced 2026-01-06 18:43:51 +00:00

Add DeleteAttribute support to the server

This change adds DeleteAttribute operation support to the PyKMIP
server, supporting functionality unique to KMIP 1.0 - 1.4 and the
newer KMIP 2.0. Due to the current list of attributes supported
by the server, only multivalued attributes can currently be
deleted from a stored KMIP object. Over a dozen unit tests have
been added to verify the functionality of the new additions.

Partially implements #547
This commit is contained in:
Peter Hamilton
2019-11-08 16:45:13 -05:00
committed by Peter Hamilton
parent e48aff7b9a
commit 676aaf5e72
5 changed files with 920 additions and 4 deletions

View File

@@ -129,6 +129,7 @@ class AttributePolicy(object):
"""
self._version = version
# TODO (peterhamilton) Alphabetize these
self._attribute_rule_sets = {
'Unique Identifier': AttributeRuleSet(
True,
@@ -872,9 +873,9 @@ class AttributePolicy(object):
'Object Group': AttributeRuleSet(
False,
('server', 'client'),
False,
False,
False,
True,
True,
True,
True,
(
enums.Operation.CREATE,
@@ -1116,6 +1117,20 @@ class AttributePolicy(object):
else:
return False
def is_attribute_deletable_by_client(self, attribute):
"""
Check if the attribute can be deleted by the client.
Args:
attribute (string): The name of the attribute (e.g., "Name").
Returns:
bool: True if the attribute can be deleted by the client. False
otherwise.
"""
rule_set = self._attribute_rule_sets.get(attribute)
return rule_set.deletable_by_client
def is_attribute_applicable_to_object_type(self, attribute, object_type):
"""
Check if the attribute is supported by the given object type.