AFSecurity.RemoveUser Method (PISystem, String, IList(AFSecurity), Boolean)
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void RemoveUser( PISystem system, string accountName, IList<AFSecurity> items, bool applyToChildren = false )
Public Shared Sub RemoveUser ( system As PISystem, accountName As String, items As IList(Of AFSecurity), Optional applyToChildren As Boolean = false ) Dim system As PISystem Dim accountName As String Dim items As IList(Of AFSecurity) Dim applyToChildren As Boolean AFSecurity.RemoveUser(system, accountName, items, applyToChildren)
public: static void RemoveUser( PISystem^ system, String^ accountName, IList<AFSecurity^>^ items, bool applyToChildren = false )
static member RemoveUser : system : PISystem * accountName : string * items : IList<AFSecurity> * ?applyToChildren : bool (* Defaults: let _applyToChildren = defaultArg applyToChildren false *) -> 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 removed from the objects. - items
- Type: System.Collections.GenericIListAFSecurity
The list of AFSecurity objects to have the security rights modified for the user account. - 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.
Notes to CallersFor 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 remove all the access and deny security rights for the user account from the specified objects in the PI AF Server associated with the PISystem.
| Since the AddUser Overload method can modify existing security settings, this method cannot restore the objects to their original security settings. |
For PI AF Server 2.7 or later you can call the RemoveUser Overload method that accepts an AFSecurityIdentity 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. This method is not supported on a server before PI AF Server 2.6 if the applyToChildren parameter is . |