Click or drag to resize
OSIsoft, LLC

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: 2.10.6.195
Syntax
public sealed class PIDatabaseSecurity

The PIDatabaseSecurity type exposes the following members.

Properties
  NameDescription
Public propertyDescription
This property identifies the description of the PIDatabaseSecurity.
Public propertyName
This property identifies the table name of the PIDatabaseSecurity.
Public propertySecurityString
This property identifies the security access permission of the PIDatabaseSecurity.
Public propertyServer
The PIServer for this PIDatabaseSecurity.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberCode exampleGetSecurityRights(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 exampleGetSecurityRights(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 methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodRefresh
Refresh the collection by loading from the PIServer.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
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;
var securityRights = PIDatabaseSecurity.GetSecurityRights(securityString.ToString());
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();
}
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6
See Also
Enabling Operational Intelligence