Target Access Required is a feature of object-valued properties that allows an application designer to specify the access rights that are necessary on the target object in order to assign it to a property. This feature is implemented as a property named Target Access Required on the PropertyDefinitionObject class. Property Definition Objects are used to define object valued properties as part of Class Definitions. The Target Access Required property specifies the access level that the caller must be granted by the target object in order to assign it as the value of the object value property being defined.
The default value for Target Access Required is View properties, that is, if the Target Access Required is not specified then the caller must have at least Read access on the target object to refer to it using an object-valued property.
Suppose there are two classes, A and B. Class A includes an object-valued property named OVP_B. The definition for OVP_B specifies that its required class is B and the Target Access Required is Modify All Properties. This means that the value of A.OVP_B, when it is set, must always be an instance of class B. It also means that in order assign a value to A.OVP_B the caller must be granted Modify All Properties by the instance of B that is the target of the assignment.
Consider the following code snippet that illustrates assigning the value of an instance of class B to an instance of class As OVP_B property:
Dim IA as A
Dim IB as B
Set IA = ObjectStore.ConnectObject(A, guidIA)
Set IB = ObjectStore.ConnectObject(B, guidIB)
IA.OVP_B = IB
In this example, the target object is IB; therefore the caller must have Modify All Properties access on IB or the assignment will fail.
Suppose there are two additional classes, C and D. Class C includes an object-valued property named OVP_D. The definition for OVP_D specifies that its required class is D; however the Target Access Required is not specified. This means that the value of C.OVP_D, when it is set, must always be an instance of class D; however, since the Target Access Required on the definition for OVP_D is not specified, the caller only needs to be granted View properties by the instance of D.
Consider the following code snippet that illustrates assigning the value of an instance of class D to an instance of class Cs OVP_D property:
Dim IC1 as C
Dim ID1 as D
Set IC1 = ObjectStore.ConnectObject(C, guidIC1)
Set IC1 = ObjectStore.ConnectObject(B, guidIB)
IC.OVP_D = ID
In this example, the target object is IC. There is no Target Access Required on the property definition for OVP_D therefore it defaults to View properties which means that the caller must have Read access to IB or the assignment will fail.