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

AF SDK Reference

PIDatabaseSecurity Class

  • Last UpdatedNov 18, 2025
  • 5 minute read
PIDatabaseSecurity Class
The PIDatabaseSecurity object represents an access control to a PIServer table resource.

Inheritance Hierarchy

SystemObject
  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

  NameDescription
Public property
Description
This property identifies the description of the PIDatabaseSecurity.
Public property
Name
This property identifies the table name of the PIDatabaseSecurity.
Public property
SecurityString
This property identifies the security access permission of the PIDatabaseSecurity.
Public property
Server
The PIServer for this PIDatabaseSecurity.

Methods

  NameDescription
Public method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberCode example
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.
Public methodStatic memberCode example
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.
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
Refresh
Refresh the collection by loading from the PIServer.
Public method
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.

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, 2.6

See Also

TitleResults for “How to create a CRG?”Also Available in