Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFSecurity.AddIdentity Method (PISystem, AFSecurityIdentity, IList(AFSecurity), AFSecurityRights, AFSecurityRights, AFSecurityOperation, Boolean)

AFSecurity.AddIdentity Method (PISystem, AFSecurityIdentity, IList(AFSecurity), AFSecurityRights, AFSecurityRights, AFSecurityOperation, Boolean)

  • Last UpdatedNov 18, 2025
  • 5 minute read
AFSecurity.AddIdentity Method (PISystem, AFSecurityIdentity, IList(AFSecurity), AFSecurityRights, AFSecurityRights, AFSecurityOperation, Boolean)
Add security for an AFSecurityIdentity to specified objects in the PISystem.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public static void AddIdentity(
	PISystem system,
	AFSecurityIdentity identity,
	IList<AFSecurity> items,
	AFSecurityRights accessRights = AFSecurityRights.None,
	AFSecurityRights denyRights = AFSecurityRights.None,
	AFSecurityOperation operation = AFSecurityOperation.Merge,
	bool applyToChildren = false
)
Public Shared Sub AddIdentity ( 
	system As PISystem,
	identity As AFSecurityIdentity,
	items As IList(Of AFSecurity),
	Optional accessRights As AFSecurityRights = AFSecurityRights.None,
	Optional denyRights As AFSecurityRights = AFSecurityRights.None,
	Optional operation As AFSecurityOperation = AFSecurityOperation.Merge,
	Optional applyToChildren As Boolean = false
)

Dim system As PISystem
Dim identity As AFSecurityIdentity
Dim items As IList(Of AFSecurity)
Dim accessRights As AFSecurityRights
Dim denyRights As AFSecurityRights
Dim operation As AFSecurityOperation
Dim applyToChildren As Boolean

AFSecurity.AddIdentity(system, identity, 
	items, accessRights, denyRights, 
	operation, applyToChildren)
public:
static void AddIdentity(
	PISystem^ system, 
	AFSecurityIdentity^ identity, 
	IList<AFSecurity^>^ items, 
	AFSecurityRights accessRights = AFSecurityRights::None, 
	AFSecurityRights denyRights = AFSecurityRights::None, 
	AFSecurityOperation operation = AFSecurityOperation::Merge, 
	bool applyToChildren = false
)
static member AddIdentity : 
        system : PISystem * 
        identity : AFSecurityIdentity * 
        items : IList<AFSecurity> * 
        ?accessRights : AFSecurityRights * 
        ?denyRights : AFSecurityRights * 
        ?operation : AFSecurityOperation * 
        ?applyToChildren : bool 
(* Defaults:
        let _accessRights = defaultArg accessRights AFSecurityRights.None
        let _denyRights = defaultArg denyRights AFSecurityRights.None
        let _operation = defaultArg operation AFSecurityOperation.Merge
        let _applyToChildren = defaultArg applyToChildren false
*)
-> unit 

Parameters

system
Type: OSIsoft.AFPISystem
The PISystem containing the objects to be modified.
identity
Type: OSIsoft.AFAFSecurityIdentity
The AFSecurityIdentity to be added to the objects.
items
Type: System.Collections.GenericIListAFSecurity
The list of AFSecurity objects to have the security rights modified for the specified identity.
accessRights (Optional)
Type: OSIsoft.AFAFSecurityRights
The access security rights for the identity to be added to the objects. Specify None to not specify any access security rights to be added.
denyRights (Optional)
Type: OSIsoft.AFAFSecurityRights
The deny security rights for the identity to be added to the objects. Specify None to not specify any deny security rights to be added.
operation (Optional)
Type: OSIsoft.AFAFSecurityOperation
The security operation which defines the behavior when adding security rights to an object that the user already has security rights specified.
applyToChildren (Optional)
Type: SystemBoolean

This parameter only has an effect if the associated object is an AFElement or AFEventFrame that has been added to a collection and saved to the server. For all other objects or if this parameter is , then the new access permissions are only applied to the associated object.

If and the associated object is an AFElement or AFEventFrame that has been added to a collection, then the access permissions for any parent or child objects might also change. The behavior depends on the reference type:

  • For weak reference types, access permissions are never inherited. So, if you change the access permissions for the parent object, the permissions for the child object are not affected. Similarly, if you change the access permissions for the child object, the permissions for the parent object are not affected.
  • For parent-child reference types, child permissions change when you change the permissions on the primary parent permissions. Parent permissions do not change when you change child permissions. Child elements that have a parent-child reference to the parent element, but are owned by a different element, are not in the primary path and will not have their permissions modified.
If the AFElement or AFEventFrame is a new object that has not been saved to the server, then it will be automatically saved so that the server can apply the security changes to the children.

Note Notes to Callers
For composition reference types, access permissions for child and parent are always the same, therefore the value of this parameter is ignored. So, if you change the access permissions for the child, the parent access permissions are automatically changed to match the child permissions. Similarly, if you change the access permissions for the parent, the child access permissions are automatically changed to match the parent permissions. These changes cascade down (and up) through the hierarchy.

Remarks

This method will add the access and/or deny security rights for the security identity to the specified objects in the PI AF Server associated with the PISystem. See the documentation for AFSecurityOperation for a description of the behavior of calling this method on existing security rights for an object.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in