2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-28 06:03:22 +00:00

Add SetAttribute support to the server

This change adds SetAttribute operation support to the PyKMIP
server, including additional attribute policy functionality to
check for certain attribute characteristics that preclude
SetAttribute operation functionality. Specifically, the operation
cannot set the value of any multivalued attribute nor the value
of any attribute not modifiable by the client. New unit tests
have been added to cover these changes.

Partially implements #547
This commit is contained in:
Peter Hamilton
2019-11-22 16:01:21 -05:00
committed by Peter Hamilton
parent e313731692
commit 3be219144a
4 changed files with 230 additions and 0 deletions

View File

@@ -1155,6 +1155,20 @@ class AttributePolicy(object):
rule_set = self._attribute_rule_sets.get(attribute)
return rule_set.deletable_by_client
def is_attribute_modifiable_by_client(self, attribute):
"""
Check if the attribute can be modified by the client.
Args:
attribute (string): The name of the attribute (e.g., "Name").
Returns:
bool: True if the attribute can be modified by the client. False
otherwise.
"""
rule_set = self._attribute_rule_sets.get(attribute)
return rule_set.modifiable_by_client
def is_attribute_applicable_to_object_type(self, attribute, object_type):
"""
Check if the attribute is supported by the given object type.