PIDatabaseSecurity Class
- Last UpdatedNov 18, 2025
- 5 minute read
- PI System
- AF SDK 2024 R2
- Developer
The PIDatabaseSecurity object represents an access control to a PIServer table resource.

Inheritance Hierarchy
SystemObject
OSIsoft.AF.PIPIDatabaseSecurity
OSIsoft.AF.PIPIDatabaseSecurity
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public sealed class PIDatabaseSecurity
Public NotInheritable Class PIDatabaseSecurity Dim instance As PIDatabaseSecurity
public ref class PIDatabaseSecurity sealed
[<SealedAttribute>] type PIDatabaseSecurity = class end
The PIDatabaseSecurity type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Description |
This property identifies the description of the PIDatabaseSecurity.
| |
| Name |
This property identifies the table name of the PIDatabaseSecurity.
| |
| SecurityString |
This property identifies the security access permission of the PIDatabaseSecurity.
| |
| Server |
The PIServer for this PIDatabaseSecurity.
|
Methods
| Name | Description | |
|---|---|---|
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetSecurityRights(String) |
This method parses the SecurityString into a collection of AFSecurityRights where
the key is the name of a PI identity, user, or group.
| |
| GetSecurityRights(String, String, String) |
This method convert the legacy Access Permission model (prior to PI 3.4.380) into a collection of AFSecurityRights where the key is
the name of a PI identity, user, or group.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Refresh |
Refresh the collection by loading from the PIServer.
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
Remarks
PIDatabaseSecurity tables control accesses to most PI Data Archive resources.
These include permissions to configure archives, view the audit trail, change tuning parameters, run backups, etc.
The exception is that permissions for specific points and modules are configured on the objects themselves. In other words,
PIDatabaseSecurity for the case of PIPOINT and PIModules tables only control top-level access to
points and modules, respectively.
Examples
// Get the PIDatabaseSecurities from the PIServer PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; PIServer myPIServer = PIServer.FindPIServer(myPISystem, piServerName); // Display information about each PIDatabaseSecurity and its properties PIDatabaseSecurities dbSecurities = myPIServer.DatabaseSecurities; Console.WriteLine("Found {0} database security tables", dbSecurities.Count); foreach (PIDatabaseSecurity dbSecurity in dbSecurities) { Console.WriteLine(dbSecurity.Name); if (!String.IsNullOrEmpty(dbSecurity.Description)) //Note: For PIServer older than 3.4.380.x, Description is null Console.WriteLine(" Description: {0}", dbSecurity.Description); Console.WriteLine(" SecurityString: {0}", dbSecurity.SecurityString); Console.WriteLine(); } // Display information for a specific PIDatabaseSecurity table, e.g. PIPOINT string tableName = "PIPOINT"; PIDatabaseSecurity pipointDbSecurity = myPIServer.DatabaseSecurities[tableName]; Console.WriteLine(tableName); if (!String.IsNullOrEmpty(pipointDbSecurity.Description)) //Note: For PIServer older than 3.4.380.x, Description is null Console.WriteLine(" Description: {0}", pipointDbSecurity.Description); Console.WriteLine(" SecurityString: {0}", pipointDbSecurity.SecurityString); Console.WriteLine(); // Get and Display AFSecurityRights for the PIPoint DatabaseSecurity table string securityString = pipointDbSecurity.SecurityString; Console.WriteLine($"Security string: {securityString}"); var securityRights = PIDatabaseSecurity.GetSecurityRights(securityString); Console.WriteLine(String.Format("SecurityRights for {0} table", tableName)); foreach (var securityRight in securityRights) { Console.WriteLine(" Identity = {0}, SecurityRight = {1}", securityRight.Key, securityRight.Value); Console.WriteLine(); }
' Get the PIDatabaseSecurities from the PIServer Dim myPISystems As PISystems = New PISystems() Dim myPISystem As PISystem = myPISystems.DefaultPISystem Dim myPIServer As PIServer = PIServer.FindPIServer(myPISystem, piServerName) ' Display information about each PIDatabaseSecurity and its properties Dim dbSecurities As PIDatabaseSecurities = myPIServer.DatabaseSecurities Console.WriteLine("Found {0} database security tables", dbSecurities.Count) For Each dbSecurity As PIDatabaseSecurity In dbSecurities Console.WriteLine(dbSecurity.Name) If Not String.IsNullOrEmpty(dbSecurity.Description) Then 'Note: For PIServer older than 3.4.380.x, Description is null Console.WriteLine(" Description: {0}", dbSecurity.Description) End If Console.WriteLine(" SecurityString: {0}", dbSecurity.SecurityString) Console.WriteLine() Next ' Display information for a specific PIDatabaseSecurity table, e.g. PIPOINT Dim tableName As String = "PIPOINT" Dim pipointDbSecurity As PIDatabaseSecurity = myPIServer.DatabaseSecurities(tableName) Console.WriteLine(tableName) If Not String.IsNullOrEmpty(pipointDbSecurity.Description) Then 'Note: For PIServer older than 3.4.380.x, Description is null Console.WriteLine(" Description: {0}", pipointDbSecurity.Description) End If Console.WriteLine(" SecurityString: {0}", pipointDbSecurity.SecurityString) Console.WriteLine() ' Get and Display AFSecurityRights for the PIPoint DatabaseSecurity table Dim securityString As String = pipointDbSecurity.SecurityString Dim securityRights As IList(Of KeyValuePair(Of String, AFSecurityRights)) = PIDatabaseSecurity.GetSecurityRights(securityString.ToString()) Console.WriteLine(String.Format("SecurityRights for {0} table", tableName)) For Each securityRight As KeyValuePair(Of String, AFSecurityRights) In securityRights Console.WriteLine(" Identity = {0}, SecurityRight = {1}", securityRight.Key, securityRight.Value) Console.WriteLine() Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.