AFSecurity.AddUser Method (PISystem, String, AFSecurityRights, AFSecurityRights, AFSecurityOperation)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Add security for a user account to all objects in the PISystem.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void AddUser( PISystem system, string accountName, AFSecurityRights accessRights = AFSecurityRights.None, AFSecurityRights denyRights = AFSecurityRights.None, AFSecurityOperation operation = AFSecurityOperation.Merge )
Public Shared Sub AddUser ( system As PISystem, accountName As String, Optional accessRights As AFSecurityRights = AFSecurityRights.None, Optional denyRights As AFSecurityRights = AFSecurityRights.None, Optional operation As AFSecurityOperation = AFSecurityOperation.Merge ) Dim system As PISystem Dim accountName As String Dim accessRights As AFSecurityRights Dim denyRights As AFSecurityRights Dim operation As AFSecurityOperation AFSecurity.AddUser(system, accountName, accessRights, denyRights, operation)
public: static void AddUser( PISystem^ system, String^ accountName, AFSecurityRights accessRights = AFSecurityRights::None, AFSecurityRights denyRights = AFSecurityRights::None, AFSecurityOperation operation = AFSecurityOperation::Merge )
static member AddUser : system : PISystem * accountName : string * ?accessRights : AFSecurityRights * ?denyRights : AFSecurityRights * ?operation : AFSecurityOperation (* Defaults: let _accessRights = defaultArg accessRights AFSecurityRights.None let _denyRights = defaultArg denyRights AFSecurityRights.None let _operation = defaultArg operation AFSecurityOperation.Merge *) -> unit
Parameters
- system
- Type: OSIsoft.AFPISystem
The PISystem containing the objects to be modified. - accountName
- Type: SystemString
The account name of the user to be added to the objects. - accessRights (Optional)
- Type: OSIsoft.AFAFSecurityRights
The access security rights for the accountName 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 accountName 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.
Remarks
This method will add the access and/or deny security rights for the user account to every object
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.
| For PI AF Server 2.7 or later you can call the AddIdentity Overload method to set the security access control with the new security identities which is supported by newer servers. You can use the PISystem.Supports method to check if the server supports SecurityIdentity. |